From 63c399c8df386a91c45a063e611c7bb7765e9e70 Mon Sep 17 00:00:00 2001 From: tzagim <2285958+tzagim@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:23:24 +0300 Subject: [PATCH] 3.5.9 --- addon.xml | 8 ++++---- changelog.txt | 4 ++++ resources/language/English/strings.xml | 4 ++-- .../language/resource.language.en_gb/strings.po | 4 ++-- resources/lib/common.py | 13 +++++++++---- resources/lib/keshet.py | 9 ++++++--- resources/lib/reshet.py | 7 ++++--- resources/lib/service.py | 14 +++++++++++--- 8 files changed, 42 insertions(+), 21 deletions(-) diff --git a/addon.xml b/addon.xml index 96cfd54a..032e2128 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + @@ -8,8 +8,8 @@ video - - + + true @@ -19,7 +19,7 @@ all צפיה בערוצי עידן פלוס ובתכניות מהאתרים הרשמיים. צפיה בערוצי עידן פלוס ובתכניות מהאתרים הרשמיים.[CR]אפשרויות שונות בהגדרות ההרחבה ובקליק ימני על פריט ברשימה. - - Fix for Kan icons.[CR]- Fix for Keshet.[CR]- Added cache. + - Addon loads faster.[CR]- Fix for Reshet old site VODs. tvshows diff --git a/changelog.txt b/changelog.txt index 807597f9..8a7d621e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +v3.5.9 - 05/06/2024 +- Addon loads faster. +- Fix for Reshet old site VODs. + v3.5.8 - 12/05/2024 - Fix for Kan icons. - Fix for Keshet. diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index f7fbdfd7..ffe285ea 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -68,8 +68,8 @@ כנסת 99 רענון רשימה ערוץ הקניות 21 - האח הגדול 26 - האח הגדול 26 - גיבוי + האח הגדול 26 - מנותקים + האח הגדול 26 - מנותקים - גיבוי Ynet Live כאן 4K וואלה+ diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 58c7ba80..19c3d1e0 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -268,11 +268,11 @@ msgid "ערוץ הקניות 21" msgstr "" msgctxt "#30621" -msgid "האח הגדול 26" +msgid "האח הגדול 26 - מנותקים" msgstr "" msgctxt "#30625" -msgid "האח הגדול 26 - גיבוי" +msgid "האח הגדול 26 - מנותקים - גיבוי" msgstr "" msgctxt "#30622" diff --git a/resources/lib/common.py b/resources/lib/common.py index e1023fac..d511d5ca 100644 --- a/resources/lib/common.py +++ b/resources/lib/common.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import xbmc, xbmcgui, xbmcplugin, xbmcaddon -import sys, gzip, os, io, random, re, json, urllib, requests, xmltodict, time, collections, xml.parsers.expat as expat -import resources.lib.cloudscraper as cloudscraper +import sys, gzip, os, io, random, re, json, urllib, xmltodict, time, collections, xml.parsers.expat as expat +#import requests, resources.lib.cloudscraper as cloudscraper #import zipfile try: @@ -139,8 +139,8 @@ def translatePath(path): 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36' ] -# userAgent = random.choice(userAgents) -userAgent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0' +userAgent = random.choice(userAgents) + def GetAddon(): Addon = xbmcaddon.Addon(AddonID) @@ -229,10 +229,12 @@ def GetUserAgent(): return userAgent def GetSession(): + import requests return requests.session() def OpenURL(url, headers={}, user_data=None, session=None, cookies=None, retries=1, responseMethod='text', verify=True): link = "" + import requests if headers.get('Accept-encoding', '') == '': headers['Accept-encoding'] = 'gzip' if headers.get('User-agent', '') == '': @@ -267,6 +269,7 @@ def OpenURL(url, headers={}, user_data=None, session=None, cookies=None, retries def GetRedirect(url, headers={}): try: + import requests response = requests.head(url, headers=headers, allow_redirects=False) if response.status_code in set([301, 302, 303, 307]) and 'location' in response.headers: url = response.headers['location'] @@ -663,6 +666,7 @@ def GetYouTube(url): def GetCF(url, ua=None, retries=10, responseMethod='text'): + import resources.lib.cloudscraper as cloudscraper for i in range(retries): try: scraper = cloudscraper.create_scraper(interpreter = 'native') @@ -681,6 +685,7 @@ def GetCF(url, ua=None, retries=10, responseMethod='text'): return '' def GetCFheaders(url, ua=None, retries=10): + import resources.lib.cloudscraper as cloudscraper for i in range(retries): try: scraper = cloudscraper.create_scraper(interpreter = 'native') diff --git a/resources/lib/keshet.py b/resources/lib/keshet.py index 569779fa..dfbf2075 100644 --- a/resources/lib/keshet.py +++ b/resources/lib/keshet.py @@ -11,7 +11,7 @@ programUrl = "{0}/_next/data/4.7.0/{{0}}/{{1}}.json?mako_vod_channel={{0}}&program={{1}}".format(baseUrl) entitlementsServices = 'https://mass.mako.co.il/ClicksStatistics/entitlementsServicesV2.jsp' UA = common.GetUserAgent() - +UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' def GetJson(url): resultJSON = common.OpenURL(url, headers={"User-Agent": UA}, responseMethod='json') @@ -42,7 +42,7 @@ def GetCategoriesList(iconimage): def GetSeriesList(url, iconimage): url = "{0}&{1}".format(url, endings) if "?" in url else "{0}?{1}".format(url, endings) #prms = GetJson(url) - prms = cache.get(GetJson, 24, url, table='pages') + prms = cache.get(GetJson, 72, url, table='pages') if prms is None: "Cannot get list for url {0}".format(url) return @@ -155,7 +155,8 @@ def WatchLive(url, name='', iconimage='', quality='best'): '24': '{0}/mako-vod-live-tv/VOD-b3480d2eff3fd31006.htm'.format(baseUrl), '2025': '{0}/mako-vod-live-tv/VOD-7469dcd71dcb761006.htm'.format(baseUrl) } - PlayItem(channels[url], name, iconimage, quality, swichCdn=True) + #PlayItem(channels[url], name, iconimage, quality, swichCdn=True) + PlayItem(channels[url], name, iconimage, quality='auto', swichCdn=True) def PlayItem(url, name='', iconimage='', quality='best', swichCdn=False): prms = GetJson("{0}?{1}".format(url, endings)) @@ -204,6 +205,8 @@ def GetLink(media, cdn, dv, headers, quality): if url.startswith('//'): url = 'https:{0}'.format(url) #xbmc.log('{0}?{1}'.format(url, ticket), 5) + if quality == 'auto': + return '{0}&{1}'.format(url, ticket) if '?' in url else '{0}?{1}'.format(url, ticket), None session = common.GetSession() link = common.GetStreams('{0}&{1}'.format(url, ticket) if '?' in url else '{0}?{1}'.format(url, ticket), headers=headers, session=session, quality=quality) #xbmc.log(link, 5) diff --git a/resources/lib/reshet.py b/resources/lib/reshet.py index 92f20534..5f76085e 100644 --- a/resources/lib/reshet.py +++ b/resources/lib/reshet.py @@ -84,13 +84,14 @@ def GetSeriesListOld(url, iconimage): continue series[link] = name seriesIDs.append(seriesID) + image = serie['imageObj']['d'] pageTitle = serie.get('secondaryTitle', {}) description = '' if pageTitle is None else common.encode(pageTitle, 'utf-8') matches = [grids_arr.index(x) for x in grids_arr if link == x[1]] if len(matches) == 1: - grids_arr[matches[0]] = (name, link, serie['image'], {"Title": name, "Plot": description,'mediatype': 'movie'}) + grids_arr[matches[0]] = (name, link, image, {"Title": name, "Plot": description,'mediatype': 'movie'}) else: - grids_arr.append((name, link, serie['image'], {"Title": name, "Plot": description,'mediatype': 'movie'})) + grids_arr.append((name, link, image, {"Title": name, "Plot": description,'mediatype': 'movie'})) except Exception as ex: xbmc.log('SerieID: {0}\n{1}'.format(seriesID, str(ex)), 3) mainMenus = result.get('Header', {}).get('mainMenu', []) @@ -392,7 +393,7 @@ def GetNewsCategoriesList(iconimage): def GetSeriesList(url, iconimage): #result = GetUrlJson(url, root=True) root = True - result = cache.get(GetUrlJson, 24, url, root, table='pages') + result = cache.get(GetUrlJson, 72, url, root, table='pages') if len(result) < 1: return buildId = result['buildId'] diff --git a/resources/lib/service.py b/resources/lib/service.py index 87224a9a..6e78d187 100644 --- a/resources/lib/service.py +++ b/resources/lib/service.py @@ -1,5 +1,13 @@ import xbmc +from time import time -refreshCommand = 'RunPlugin(plugin://plugin.video.idanplus/?mode=7)' -xbmc.executebuiltin(refreshCommand) -xbmc.executebuiltin('AlarmClock(idanplus,{0},12:00:00,silent,loop)'.format(refreshCommand)) +end_pause = time() + 15 +monitor = xbmc.Monitor() +wait_for_abort = monitor.waitForAbort + +while not monitor.abortRequested(): + while time() < end_pause: wait_for_abort(1) + refreshCommand = 'RunPlugin(plugin://plugin.video.idanplus/?mode=7)' + xbmc.executebuiltin(refreshCommand) + xbmc.executebuiltin('AlarmClock(idanplus,{0},12:00:00,silent,loop)'.format(refreshCommand)) + break \ No newline at end of file