From 2bfb3cc93275293e657e23bacfe4e47f2258175c Mon Sep 17 00:00:00 2001 From: coder-alpha Date: Mon, 8 Apr 2019 02:36:55 -0400 Subject: [PATCH] re-commit --- Contents/Code/common.py | 6 ++++-- Contents/Code/main.py | 28 +++++++++++++++------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Contents/Code/common.py b/Contents/Code/common.py index ec020a4..827b521 100644 --- a/Contents/Code/common.py +++ b/Contents/Code/common.py @@ -159,7 +159,7 @@ FMOVIES_SERVER_REMAP = {'Server F':'Google-F', 'Server G':'Google-G', 'F5 Beta':'PrettyFast', 'F5 - HQ':'PrettyFast'} FMOVIES_HOSTS_DISABLED = ['MyCloud','PrettyFast'] -MISC_OPTIONS_KEYS = ['SOURCE_SEARCH_TIMEOUT','SMART_ADD_EP_FALLOUT_DAYS','SMART_ADD_SEASON_FALLOUT_DAYS','Extend-Smart-Add-For-Seasons','Retry-Failed-Downloads','Dont-Refresh-Library-Downloads','Retrieve-And-Display-Partial-Sources','FMOVIES_HOSTS_UNPLAYABLE','SHOW_PLEX_SERVICE_LINKS'] +MISC_OPTIONS_KEYS = ['SOURCE_SEARCH_TIMEOUT','SMART_ADD_EP_FALLOUT_DAYS','SMART_ADD_SEASON_FALLOUT_DAYS','Extend-Smart-Add-For-Seasons','Retry-Failed-Downloads','Dont-Refresh-Library-Downloads','Retrieve-And-Display-Partial-Sources','FMOVIES_HOSTS_UNPLAYABLE','SHOW_PLEX_SERVICE_LINKS','SHOW_EXTRAS'] MISC_OPTIONS_CONST = { MISC_OPTIONS_KEYS[0]:{'type':'num','title':'AutoPilot Source Search Timeout','val':600, 'unit':'sec', 'desc':'AutoPilot Source Timeout seconds (%s-%s): %s','LL':300,'UL':300*4}, MISC_OPTIONS_KEYS[1]:{'type':'num','title':'AutoPilot Smart Add (Episode) Entry','val':30,'unit':'day', 'desc':'AutoPilot Smart Add (Episode) Entry retain days (%s-%s): %s','LL':15,'UL':15*6}, @@ -168,7 +168,8 @@ MISC_OPTIONS_KEYS[5]:{'type':'bool','title':'Don\'t perform a Library Section Refresh after an Item is Downloaded','val':False,'unit':'', 'desc':'Don\'t perform a Library Section Refresh after an Item is Downloaded: %s','LL':0,'UL':0}, MISC_OPTIONS_KEYS[6]:{'type':'bool','title':'Retrieve And Display Partial Sources','val':False,'unit':'', 'desc':'Retrieve And Display Partial Sources while Provider is processing All Sources: %s','LL':0,'UL':0}, MISC_OPTIONS_KEYS[7]:{'type':'bool','title':'Show Unplayable Hosts for FMovies site','val':False,'unit':'', 'desc':'Show Unplayable Hosts for FMovies site in item listing %s: %s' % (FMOVIES_HOSTS_DISABLED, '%s'),'LL':0,'UL':0}, - MISC_OPTIONS_KEYS[8]:{'type':'bool','title':'Show Plex Service Links','val':False,'unit':'', 'desc':'Show Plex Service Links: %s','LL':0,'UL':0} + MISC_OPTIONS_KEYS[8]:{'type':'bool','title':'Show Plex Service Links','val':False,'unit':'', 'desc':'Show Plex Service Links: %s','LL':0,'UL':0}, + MISC_OPTIONS_KEYS[9]:{'type':'bool','title':'Show Extras','val':True,'unit':'', 'desc':'Show Extras (Trailer, etc.): %s','LL':0,'UL':0} } MISC_OPTIONS = MISC_OPTIONS_CONST.copy() @@ -265,6 +266,7 @@ USE_DOWNLOAD_RESUME_GEN = True USE_DOWNLOAD_RESUME_MEGA = True USE_EXT_URLSERVICES = True +USE_EXTRAS = True USE_COOKIES = True DOWNLOAD_BACKUP_OPER = True USE_SECOND_REQUEST = True diff --git a/Contents/Code/main.py b/Contents/Code/main.py index 4546eff..63b6dde 100644 --- a/Contents/Code/main.py +++ b/Contents/Code/main.py @@ -4561,6 +4561,21 @@ def ExtSources(title, url, summary, thumb, art, rating, duration, genre, directo Log(gen_play) Log(e) + if common.USE_EXTRAS == True and common.MISC_OPTIONS[common.MISC_OPTIONS_KEYS[9]]['val'] == True: + for source in extras_playback_links: + extExtrasSources_urlservice.append(source) + + extExtrasSources_urlservice = common.OrderBasedOn(extExtrasSources_urlservice, use_host=False, use_filesize=common.UsingOption(key=common.DEVICE_OPTIONS[9], session=session)) + cx = len(extExtrasSources_urlservice) + + if cx > 0: + ext_summmary = ', '.join('%s (%s)' % (x['label'],'enabled' if str(x['enabled']).lower()=='true' else 'disabled') for x in common.INTERNAL_SOURCES_FILETYPE if 'Movie/Show' not in x['label']) + ocp = DirectoryObject(title = 'Extras (%s items)' % str(cx), key = Callback(PSExtSources, con_title='Extras (%s items)' % str(cx), extSources_play=E(JSON.StringFromObject(extExtrasSources_urlservice)), session=session, watch_title=watch_title, year=year, summary=summary, thumb=thumb, art=art, url=url, duration=duration, rating=rating, genre=genre, mode_trailer=True), summary=ext_summmary,thumb=R(common.ICON_PLEX)) + if prog < 100: + oc.insert(1,ocp) + else: + oc.insert(0,ocp) + if common.USE_EXT_URLSERVICES == True and common.MISC_OPTIONS[common.MISC_OPTIONS_KEYS[8]]['val'] == True: external_extSources = extSourKey @@ -4575,12 +4590,6 @@ def ExtSources(title, url, summary, thumb, art, rating, duration, genre, directo break if bool == True: extSources_urlservice.append(source) - - for source in extras_playback_links: - extExtrasSources_urlservice.append(source) - - extExtrasSources_urlservice = common.OrderBasedOn(extExtrasSources_urlservice, use_host=False, use_filesize=common.UsingOption(key=common.DEVICE_OPTIONS[9], session=session)) - cx = len(extExtrasSources_urlservice) for source in plexservice_playback_links: extSources_urlservice.append(source) @@ -4599,13 +4608,6 @@ def ExtSources(title, url, summary, thumb, art, rating, duration, genre, directo if common.DEV_DEBUG == True and Prefs["use_debug"] == True: Log(extSources_urlservice) - if cx > 0: - ext_summmary = ', '.join('%s (%s)' % (x['label'],'enabled' if str(x['enabled']).lower()=='true' else 'disabled') for x in common.INTERNAL_SOURCES_FILETYPE if 'Movie/Show' not in x['label']) - ocp = DirectoryObject(title = 'Extras (%s items)' % str(cx), key = Callback(PSExtSources, con_title='Extras (%s items)' % str(cx), extSources_play=E(JSON.StringFromObject(extExtrasSources_urlservice)), session=session, watch_title=watch_title, year=year, summary=summary, thumb=thumb, art=art, url=url, duration=duration, rating=rating, genre=genre, mode_trailer=True), summary=ext_summmary,thumb=R(common.ICON_PLEX)) - if prog < 100: - oc.insert(1,ocp) - else: - oc.insert(0,ocp) if c > 0: ocp = DirectoryObject(title = 'External Sources (via Plex-Service) %s links' % str(c), key = Callback(PSExtSources, con_title='External Sources (via Plex-Service) %s links' % str(c), extSources_play=E(JSON.StringFromObject(extSources_urlservice)), session=session, watch_title=watch_title, year=year, summary=summary, thumb=thumb, art=art, url=url, duration=duration, rating=rating, genre=genre), summary='Playable via Plex services that are available and a Generic Player that tries its best to handle the rest.', thumb=R(common.ICON_PLEX)) oc.append(ocp)