mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-12 21:26:10 +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]
|
base_url = sys.argv[0]
|
||||||
path = sys.argv[2]
|
path = sys.argv[2]
|
||||||
params = urlparse.parse_qs(path[1:])
|
params = urlparse.parse_qs(path[1:])
|
||||||
log.warn("Parameter string: %s", path)
|
log.warn("Parameter string: %s params: %s", path, params)
|
||||||
try:
|
try:
|
||||||
mode = params['mode'][0]
|
mode = params['mode'][0]
|
||||||
except (IndexError, KeyError):
|
except (IndexError, KeyError):
|
||||||
|
@ -111,7 +111,11 @@ class Main(object):
|
||||||
database_id = params.get('dbid')
|
database_id = params.get('dbid')
|
||||||
action(item_id, database_id)
|
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])
|
limit = int(params['limit'][0])
|
||||||
action(item_id, limit)
|
action(item_id, limit)
|
||||||
|
|
||||||
|
|
|
@ -1060,9 +1060,10 @@ def getInProgressEpisodes(tagname, limit):
|
||||||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
|
||||||
|
|
||||||
##### GET RECENT EPISODES FOR TAGNAME #####
|
##### GET RECENT EPISODES FOR TAGNAME #####
|
||||||
def getRecentEpisodes(tagname, limit):
|
def getRecentEpisodes(tagname, limit, filters=""):
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
filters = filters.split(',') if filters else []
|
||||||
# if the addon is called with recentepisodes parameter,
|
# if the addon is called with recentepisodes parameter,
|
||||||
# we return the recentepisodes list of the given tagname
|
# we return the recentepisodes list of the given tagname
|
||||||
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
|
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
|
||||||
|
@ -1076,7 +1077,7 @@ def getRecentEpisodes(tagname, limit):
|
||||||
|
|
||||||
'sort': {'order': "descending", 'method': "dateadded"},
|
'sort': {'order': "descending", 'method': "dateadded"},
|
||||||
'filter': {'operator': "is", 'field': "tag", 'value': "%s" % tagname},
|
'filter': {'operator': "is", 'field': "tag", 'value': "%s" % tagname},
|
||||||
'properties': ["title","sorttitle"]
|
'properties': ["title", "sorttitle"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = xbmc.executeJSONRPC(json.dumps(query))
|
result = xbmc.executeJSONRPC(json.dumps(query))
|
||||||
|
@ -1087,9 +1088,7 @@ def getRecentEpisodes(tagname, limit):
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
allshowsIds = set()
|
allshowsIds = set(item['tvshowid'] for item in items)
|
||||||
for item in items:
|
|
||||||
allshowsIds.add(item['tvshowid'])
|
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
|
|
||||||
|
@ -1099,15 +1098,17 @@ def getRecentEpisodes(tagname, limit):
|
||||||
'params': {
|
'params': {
|
||||||
|
|
||||||
'sort': {'order': "descending", 'method': "dateadded"},
|
'sort': {'order': "descending", 'method': "dateadded"},
|
||||||
'filter': {'operator': "lessthan", 'field': "playcount", 'value': "1"},
|
|
||||||
'properties': [
|
'properties': [
|
||||||
"title", "playcount", "season", "episode", "showtitle", "plot",
|
"title", "playcount", "season", "episode", "showtitle", "plot",
|
||||||
"file", "rating", "resume", "tvshowid", "art", "streamdetails",
|
"file", "rating", "resume", "tvshowid", "art", "streamdetails",
|
||||||
"firstaired", "runtime", "cast", "writer", "dateadded", "lastplayed"
|
"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 = xbmc.executeJSONRPC(json.dumps(query))
|
||||||
result = json.loads(result)
|
result = json.loads(result)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue