Add subfolders for dynamic movies

This commit is contained in:
angelblue05 2018-09-22 03:28:39 -05:00
parent 776d7b39c5
commit 7b2ee9d4ba
4 changed files with 29 additions and 17 deletions

View file

@ -839,7 +839,7 @@ msgid "Unwatched"
msgstr ""
msgctxt "#33171"
msgid "A-Z"
msgid "By first letter"
msgstr ""
msgctxt "#33172"
@ -847,5 +847,5 @@ msgid "You have {number} updates pending. This may take a little while before se
msgstr ""
msgctxt "#33173"
msgid "Forget about the previous sync?"
msgid "Forget about the previous sync? This is not recommended."
msgstr ""

View file

@ -78,8 +78,8 @@ def get_single_item(parent_id, media):
'IncludeItemTypes': media
})
def get_filtered_section(parent_id, media=None, limit=None, recursive=None, sort=None, sort_order=None,
filters=None, server_id=None):
def get_filtered_section(parent_id=None, media=None, limit=None, recursive=None, sort=None, sort_order=None,
filters=None, extra=None, server_id=None):
''' Get dynamic listings.
'''
@ -110,6 +110,9 @@ def get_filtered_section(parent_id, media=None, limit=None, recursive=None, sort
if media and 'Photo' in media:
params['Fields'] += ",Width,Height"
if extra is not None:
params.update(extra)
return _get("Users/{UserId}/Items", params, server_id)
def get_movies_by_boxset(boxset_id):

View file

@ -231,7 +231,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
folder = folder.lower() if folder else None
if folder is None and media in ('homevideos'):
if folder is None and media in ('homevideos', 'movies'):
return browse_subfolders(media, view_id, server_id)
if folder and folder == 'firstletter':
@ -263,12 +263,13 @@ def browse(media, view_id=None, folder=None, server_id=None):
elif folder == 'inprogress':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Filters': ['IsResumable']}).get()
elif folder == 'boxsets':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Recursive': True}).get()
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type('boxsets'), 'Recursive': True}).get()
elif folder == 'random':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type),
'Sort': "Random", 'Limit': 25, 'Recursive': True}).get()
elif (folder or "").startswith('firstletter'):
listing = TheVoid('NameStartsWith', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Filters': folder.split('-')[1]}).get()
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Sort': "Random", 'Limit': 25, 'Recursive': True}).get()
elif (folder or "").startswith('firstletter-'):
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Params': {'NameStartsWith': folder.split('-')[1]}}).get()
elif (folder or "").startswith('genres-'):
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Params': {'GenreIds': folder.split('genres-')[1]}}).get()
elif folder == 'favepisodes':
listing = TheVoid('Browse', {'Media': get_media_type(content_type), 'ServerId': server_id, 'Limit': 25, 'Filters': ['IsFavorite']}).get()
elif media == 'homevideos':
@ -324,6 +325,19 @@ def browse(media, view_id=None, folder=None, server_id=None):
li.addContextMenuItems(context)
list_li.append((path, li, True))
elif item['Type'] == 'Genre':
params = {
'id': view_id or item['Id'],
'mode': "browse",
'type': get_folder_type(item) or media,
'folder': 'genres-%s' % item['Id'],
'server': server_id
}
path = "%s?%s" % ("plugin://plugin.video.emby/", urllib.urlencode(params))
list_li.append((path, li, True))
else:
if item['Type'] not in ('Photo', 'PhotoAlbum'):
params = {

View file

@ -56,7 +56,7 @@ class Monitor(xbmc.Monitor):
'PlayPlaylist', 'Play', 'GetIntros', 'GetAdditionalParts', 'RefreshItem', 'Genres',
'FavoriteItem', 'DeleteItem', 'AddUser', 'GetSession', 'GetUsers', 'GetThemes',
'GetTheme', 'Playstate', 'GeneralCommand', 'GetTranscodeOptions', 'RecentlyAdded',
'NameStartsWith', 'BrowseSeason'):
'BrowseSeason'):
return
data = json.loads(data)[0]
@ -160,7 +160,7 @@ class Monitor(xbmc.Monitor):
result = downloader.get_filtered_section(data.get('Id'), data.get('Media'), data.get('Limit'),
data.get('Recursive'), data.get('Sort'), data.get('SortOrder'),
data.get('Filters'), data.get('ServerId'))
data.get('Filters'), data.get('Params'), data.get('ServerId'))
self.void_responder(data, result)
elif method == 'BrowseSeason':
@ -178,11 +178,6 @@ class Monitor(xbmc.Monitor):
result = server['api'].get_genres(data.get('Id'))
self.void_responder(data, result)
elif method == 'NameStartsWith':
result = server['api'].get_items_by_letter(data.get('Id'), data.get('Media'), data.get('Filters'))
self.void_responder(data, result)
elif method == 'Recommended':
result = server['api'].get_recommendation(data.get('Id'), data.get('Limit'))