diff --git a/channels/altadefinizione.py b/channels/altadefinizione.py index 938e18d5..cc20d38a 100644 --- a/channels/altadefinizione.py +++ b/channels/altadefinizione.py @@ -70,7 +70,7 @@ def peliculas(item): action = 'check' patron = r'src="(?Phttp[^"]+)(?:[^>]+>){4}\s*]+>\s*(?P[^\[\(\<]+)(?:\[(?P<quality>[^\]]+)\])?\s*(?:\((?P<lang>[a-zA-z-]+)\))?\s*(?:\((?P<year>\d+)\))?\s*</a>\s*</h2>' if item.args == 'search': - patron = '<title>(?P<title>[^\[\(\<]+)(?:\[(?P<quality>[^\]]+)\])?\s*(?:\((?P<lang>[a-zA-z-]+)\))?[^>]+>\s*<link>(?P<url>[^<]+)' + patron = r'<title>(?P<title>[^\[\(\<]+)(?:\[(?P<quality>[^\]]+)\])?\s*(?:\((?P<lang>[a-zA-z-]+)\))?\s*(?:\((?P<year>\d+)\))?\s*[^>]+>\s*<link>(?P<url>[^<]+)' patronNext = r'href="([^"]+)[^>]+>Successivo' return locals() diff --git a/channels/filmstreaming.py b/channels/filmstreaming.py index c2ac9276..feced848 100644 --- a/channels/filmstreaming.py +++ b/channels/filmstreaming.py @@ -64,9 +64,11 @@ def newest(categoria): @support.scrape def peliculas(item): + # debug=True if item.args == 'last': patronBlock = r'inseriti:(?P<block>.*?)<div class="block-showmore' - patron = r'item-movie">[^>]+><a href="(?P<url>[^"]+)[^>]+><img data-src="(?P<thumb>[^"]+)(?:[^>]+>){6}(?P<title>[^<]+)(?:[^>]+>){6}(?P<quality>[^<]+)' + patron = r'item-movie">[^>]+><a href="(?P<url>[^"]+)[^>]+><img data-src="(?P<thumb>[^"]+)(?:[^>]+>){6}(?P<title>[^<]+)(?:[^>]+>){4}(?P<year>\d+)?(?:[^>]+>){2}(?P<quality>[^<]+)' + # patron = r'item-movie">[^>]+><a href="(?P<url>[^"]+)[^>]+><img data-src="(?P<thumb>[^"]+)(?:[^>]+>){6}(?P<title>[^<]+)(?:[^>]+>){6}(?P<quality>[^<]+)' patronNext = r'<a href="([^"]+)">&rarr' return locals() diff --git a/contextmenu.py b/contextmenu.py index 7460af2a..f3b86a0d 100644 --- a/contextmenu.py +++ b/contextmenu.py @@ -1,10 +1,12 @@ from platformcode import config, logger import xbmc, sys, xbmcgui, os + librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib')) sys.path.insert(0, librerias) from core import jsontools, support +from core.item import Item addon_id = config.get_addon_core().getAddonInfo('id') @@ -41,15 +43,6 @@ def build_menu(): contextmenuitems.extend([item for item, fn in module_item_actions]) contextmenuactions.extend([fn for item, fn in module_item_actions]) - if 'kod' in filePath and mediatype in ['movie', 'episode'] and config.get_setting('autoplay'): - logger.debug('Add Select server menu item') - contextmenuitems.append(config.get_localized_string(70192)) - from core import filetools - from core.item import Item - item = Item().fromurl(filetools.read(filePath)) - item.disableAutoplay = True - contextmenuactions.append(item) - if len(contextmenuitems) == 0: logger.debug('No contextmodule found, build an empty one') contextmenuitems.append(empty_item()) @@ -59,11 +52,7 @@ def build_menu(): if ret > -1: logger.debug('Contextmenu module index', ret, ', label=' + contextmenuitems[ret]) - if isinstance(contextmenuactions[ret], Item): - from platformcode.launcher import run - run(contextmenuactions[ret]) - else: - contextmenuactions[ret]() + contextmenuactions[ret]() def empty_item(): diff --git a/core/tmdb.py b/core/tmdb.py index c2418df0..5a6880fb 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -1033,7 +1033,13 @@ class Tmdb(object): if len(results) > 1: from lib.fuzzy_match import algorithims if self.search_type == 'multi': - results.sort(key=lambda r: algorithims.trigram(text_simple, r.get('name', '') if r.get('media_type') == 'tv' else r.get('title', '')), reverse=True) + if self.search_year: + for r in results: + if (r.get('release_date', '') and r.get('release_date', '')[:4] == self.search_year) or (r.get('first_air_date', '') and r.get('first_air_date', '')[:4] == self.search_year): + results = [r] + break + if len(results) > 1: + results.sort(key=lambda r: algorithims.trigram(text_simple, r.get('name', '') if r.get('media_type') == 'tv' else r.get('title', '')), reverse=True) else: results.sort(key=lambda r: algorithims.trigram(text_simple, r.get('name', '') if self.search_type == 'tv' else r.get('title', '')), reverse=True) diff --git a/platformcode/contextmenu/contextmenu.json b/platformcode/contextmenu/contextmenu.json index 3acd6121..a5b2787f 100644 --- a/platformcode/contextmenu/contextmenu.json +++ b/platformcode/contextmenu/contextmenu.json @@ -1,5 +1,6 @@ [ "platformcode.contextmenu.search", "platformcode.contextmenu.tvshow_options", - "platformcode.contextmenu.trailer" + "platformcode.contextmenu.trailer", + "platformcode.contextmenu.show_servers" ] \ No newline at end of file diff --git a/platformcode/contextmenu/show_servers.py b/platformcode/contextmenu/show_servers.py new file mode 100644 index 00000000..cd128de9 --- /dev/null +++ b/platformcode/contextmenu/show_servers.py @@ -0,0 +1,23 @@ +import xbmc + +from core.item import Item +from platformcode import config + + +def get_menu_items(): + mediatype = xbmc.getInfoLabel('ListItem.DBTYPE') + filePath = xbmc.getInfoLabel('ListItem.FileNameAndPath') + res = [] + if 'kod' in filePath and mediatype in ['movie', 'episode'] and config.get_setting('autoplay'): + res = [(config.get_localized_string(70192), execute)] + return res + + +def execute(): + from core import filetools + from platformcode.launcher import run + filePath = xbmc.getInfoLabel('ListItem.FileNameAndPath') + item = Item().fromurl(filetools.read(filePath)) + item.disableAutoplay = True + + run(item) diff --git a/specials/videolibrary.json b/specials/videolibrary.json index 1e8a4223..7f98310e 100644 --- a/specials/videolibrary.json +++ b/specials/videolibrary.json @@ -37,7 +37,7 @@ "type": "list", "label": "@60613", "default": 1, - "enabled": "eq(-2,@60604)|eq(-2,@60605)|eq(-1,@60607)", + "enabled": "eq(-2,@60604)|eq(-2,@60605)|eq(-2,@60608)", "lvalues": [ "00:00", "04:00",