Community Channels:

- disable_pagination
 - ordered Json
This commit is contained in:
Alhaziel01
2020-04-16 12:11:16 +02:00
parent 8dbd306657
commit cb4c8acfd1
+13 -7
View File
@@ -16,6 +16,7 @@ except: lang = 'it'
defpage = ["", "20", "40", "60", "80", "100"] defpage = ["", "20", "40", "60", "80", "100"]
defp = defpage[config.get_setting('pagination','community')] defp = defpage[config.get_setting('pagination','community')]
disable_pagination = False
show_seasons = config.get_setting('show_seasons','community') show_seasons = config.get_setting('show_seasons','community')
list_servers = ['directo', 'akstream', 'wstream', 'backin', 'cloudvideo', 'clipwatching', 'fembed', 'gounlimited', 'mega', 'mixdrop'] list_servers = ['directo', 'akstream', 'wstream', 'backin', 'cloudvideo', 'clipwatching', 'fembed', 'gounlimited', 'mega', 'mixdrop']
@@ -23,7 +24,6 @@ list_quality = ['SD', '720', '1080', '4k']
tmdb_api = 'a1ab8b8669da03637a4b98fa39c39228' tmdb_api = 'a1ab8b8669da03637a4b98fa39c39228'
def mainlist(item): def mainlist(item):
support.log() support.log()
@@ -89,6 +89,9 @@ def show_menu(item):
json = item.url json = item.url
else: else:
json = load_json(item) json = load_json(item)
if 'disable_pagination' in json:
item.disable_pagination = True
# support.dbg()
for key in json: for key in json:
if key == 'menu': if key == 'menu':
get_menu(item, json, key, itemlist) get_menu(item, json, key, itemlist)
@@ -104,13 +107,15 @@ def show_menu(item):
search_json = json['search'] search_json = json['search']
itemlist += get_search_menu(item, search_json) itemlist += get_search_menu(item, search_json)
if 'channel_name' in json and not 'disable_search' in json: if 'channel_name' in json and not 'disable_search' in json:
if 'search' in json and 'url' in json['search']: if 'search' in json and 'url' in json['search']:
search_json = json['search'] search_json = json['search']
itemlist += get_search_menu(item, search_json, channel_name=json['channel_name']) itemlist += get_search_menu(item, search_json, channel_name=json['channel_name'])
else: else:
itemlist += get_search_menu(item, json, channel_name=json['channel_name']) itemlist += get_search_menu(item, json, channel_name=json['channel_name'])
support.log('PAGINATION:', disable_pagination)
return itemlist return itemlist
@@ -160,7 +165,7 @@ def global_search(item, text):
def peliculas(item, json='', key='', itemlist=[]): def peliculas(item, json='', key='', itemlist=[]):
item.plot = item.thumb = item.fanart ='' item.plot = item.thumb = item.fanart =''
support.log() support.log('PAGINATION:', item.disable_pagination)
if not json: if not json:
key = item.key key = item.key
json = load_json(item)[key] json = load_json(item)[key]
@@ -172,7 +177,7 @@ def peliculas(item, json='', key='', itemlist=[]):
itlist = filterkey = [] itlist = filterkey = []
action = 'findvideos' action = 'findvideos'
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search'] and not item.filterkey: if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search'] and not item.filterkey and not item.disable_pagination:
Pagination = int(defp) if defp.isdigit() else '' Pagination = int(defp) if defp.isdigit() else ''
else: Pagination = '' else: Pagination = ''
pag = item.page if item.page else 1 pag = item.page if item.page else 1
@@ -258,7 +263,7 @@ def get_seasons(item):
for item in itemlist: for item in itemlist:
itlist = episodios(item) itlist = episodios(item)
itemlist = itlist itemlist = itlist
if inspect.stack()[2][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest'] and defpage: if inspect.stack()[2][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest'] and defp and not itemdisable_pagination:
itemlist = pagination(item, itemlist) itemlist = pagination(item, itemlist)
return itemlist return itemlist
@@ -350,7 +355,7 @@ def episodios(item, json ='', key='', itemlist =[]):
filterseason=str(season), filterseason=str(season),
path=item.path)) path=item.path))
elif defpage and inspect.stack()[1][3] not in ['get_seasons']: elif defp and inspect.stack()[1][3] not in ['get_seasons'] and not item.disable_pagination:
if Pagination and len(itemlist) >= Pagination: if Pagination and len(itemlist) >= Pagination:
if inspect.stack()[1][3] != 'get_newest': if inspect.stack()[1][3] != 'get_newest':
item.title = support.typo(config.get_localized_string(30992), 'color kod bold') item.title = support.typo(config.get_localized_string(30992), 'color kod bold')
@@ -583,6 +588,7 @@ def filter_thread(filter, key, item, description):
# for load json from item or url # for load json from item or url
def load_json(item): def load_json(item):
support.log() support.log()
from collections import OrderedDict
url = item.url if type(item) == Item else item url = item.url if type(item) == Item else item
try: try:
@@ -591,7 +597,7 @@ def load_json(item):
else: else:
json_file = open(url, "r").read() json_file = open(url, "r").read()
json = jsontools.load(json_file) json = jsontools.load(json_file, object_pairs_hook=OrderedDict)
except: except:
json = {} json = {}