mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Add recently added filter
To ignore playcount, now supports plugin://plugin.video.emby/?id=Tag&mode=recentepisodes&limit=25&filters=playcount
This commit is contained in:
parent
b6346a49cf
commit
82ab2f2311
2 changed files with 14 additions and 9 deletions
|
@ -44,7 +44,7 @@ class Main(object):
|
|||
base_url = sys.argv[0]
|
||||
path = sys.argv[2]
|
||||
params = urlparse.parse_qs(path[1:])
|
||||
log.warn("Parameter string: %s", path)
|
||||
log.warn("Parameter string: %s params: %s", path, params)
|
||||
try:
|
||||
mode = params['mode'][0]
|
||||
except (IndexError, KeyError):
|
||||
|
@ -111,7 +111,11 @@ class Main(object):
|
|||
database_id = params.get('dbid')
|
||||
action(item_id, database_id)
|
||||
|
||||
elif mode in ('nextup', 'inprogressepisodes', 'recentepisodes'):
|
||||
elif mode == 'recentepisodes':
|
||||
limit = int(params['limit'][0])
|
||||
action(item_id, limit, params.get('filters', [""])[0])
|
||||
|
||||
elif mode in ('nextup', 'inprogressepisodes'):
|
||||
limit = int(params['limit'][0])
|
||||
action(item_id, limit)
|
||||
|
||||
|
|
|
@ -1060,9 +1060,10 @@ def getInProgressEpisodes(tagname, limit):
|
|||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
||||
|
||||
##### GET RECENT EPISODES FOR TAGNAME #####
|
||||
def getRecentEpisodes(tagname, limit):
|
||||
def getRecentEpisodes(tagname, limit, filters=""):
|
||||
|
||||
count = 0
|
||||
filters = filters.split(',') if filters else []
|
||||
# if the addon is called with recentepisodes parameter,
|
||||
# we return the recentepisodes list of the given tagname
|
||||
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
|
||||
|
@ -1076,7 +1077,7 @@ def getRecentEpisodes(tagname, limit):
|
|||
|
||||
'sort': {'order': "descending", 'method': "dateadded"},
|
||||
'filter': {'operator': "is", 'field': "tag", 'value': "%s" % tagname},
|
||||
'properties': ["title","sorttitle"]
|
||||
'properties': ["title", "sorttitle"]
|
||||
}
|
||||
}
|
||||
result = xbmc.executeJSONRPC(json.dumps(query))
|
||||
|
@ -1087,9 +1088,7 @@ def getRecentEpisodes(tagname, limit):
|
|||
except (KeyError, TypeError):
|
||||
pass
|
||||
else:
|
||||
allshowsIds = set()
|
||||
for item in items:
|
||||
allshowsIds.add(item['tvshowid'])
|
||||
allshowsIds = set(item['tvshowid'] for item in items)
|
||||
|
||||
query = {
|
||||
|
||||
|
@ -1099,15 +1098,17 @@ def getRecentEpisodes(tagname, limit):
|
|||
'params': {
|
||||
|
||||
'sort': {'order': "descending", 'method': "dateadded"},
|
||||
'filter': {'operator': "lessthan", 'field': "playcount", 'value': "1"},
|
||||
'properties': [
|
||||
"title", "playcount", "season", "episode", "showtitle", "plot",
|
||||
"file", "rating", "resume", "tvshowid", "art", "streamdetails",
|
||||
"firstaired", "runtime", "cast", "writer", "dateadded", "lastplayed"
|
||||
],
|
||||
"limits": {"end": limit}
|
||||
"limits": {"end": limit*5}
|
||||
}
|
||||
}
|
||||
if 'playcount' not in filters:
|
||||
query['params']['filter'] = {'operator': "lessthan", 'field': "playcount", 'value': "1"}
|
||||
|
||||
result = xbmc.executeJSONRPC(json.dumps(query))
|
||||
result = json.loads(result)
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue