2018-05-08 04:29:21 +00:00
|
|
|
# coding=utf-8
|
2017-04-09 01:31:03 +00:00
|
|
|
# Gnu General Public License - see LICENSE.TXT
|
2020-09-05 21:29:38 +00:00
|
|
|
from __future__ import division, absolute_import, print_function, unicode_literals
|
2017-04-09 01:31:03 +00:00
|
|
|
|
|
|
|
import sys
|
2021-03-05 00:02:24 +00:00
|
|
|
from six import ensure_binary, ensure_text
|
2021-01-27 03:34:51 +00:00
|
|
|
from six.moves.urllib.parse import quote
|
2019-12-09 05:40:55 +00:00
|
|
|
import base64
|
2020-09-05 20:11:15 +00:00
|
|
|
import string
|
2017-04-09 01:31:03 +00:00
|
|
|
|
|
|
|
import xbmcplugin
|
|
|
|
import xbmcaddon
|
|
|
|
|
2022-03-09 20:25:35 +00:00
|
|
|
from .jellyfin import api
|
2020-06-21 01:27:09 +00:00
|
|
|
from .kodi_utils import add_menu_directory_item, HomeWindow
|
2022-03-09 21:27:18 +00:00
|
|
|
from .lazylogger import LazyLogger
|
2022-05-21 03:40:13 +00:00
|
|
|
from .utils import get_jellyfin_url, translate_string, get_art_url, get_default_filters, get_current_user_id
|
2021-12-29 21:54:05 +00:00
|
|
|
from .item_functions import get_art
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2020-07-25 05:01:30 +00:00
|
|
|
log = LazyLogger(__name__)
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2018-03-15 23:18:08 +00:00
|
|
|
__addon__ = xbmcaddon.Addon()
|
2022-02-28 03:15:54 +00:00
|
|
|
settings = xbmcaddon.Addon()
|
2017-05-29 10:19:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
|
|
|
|
def show_movie_tags(menu_params):
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("show_movie_tags: {0}".format(menu_params))
|
2020-06-10 05:51:13 +00:00
|
|
|
parent_id = menu_params.get("parent_id")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
url_params = {
|
|
|
|
"UserId": user_id,
|
|
|
|
"SortBy": "SortName",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"CollapseBoxSetItems": False,
|
|
|
|
"GroupItemsIntoCollections": False,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"EnableTotalRecordCount": False,
|
|
|
|
"EnableUserData": False,
|
|
|
|
"IncludeItemTypes": "Movie"
|
|
|
|
}
|
2019-11-15 23:12:42 +00:00
|
|
|
|
|
|
|
if parent_id:
|
|
|
|
url_params["ParentId"] = parent_id
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
url = get_jellyfin_url("/Tags", url_params)
|
2022-03-08 00:25:44 +00:00
|
|
|
result = api.get(url)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
|
|
|
if not result:
|
|
|
|
return
|
|
|
|
|
2022-03-11 01:51:49 +00:00
|
|
|
tags = result.get("Items", [])
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("Tags : {0}".format(result))
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
url_params = {
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"CollapseBoxSetItems": False,
|
|
|
|
"GroupItemsIntoCollections": False,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-06-05 14:19:01 +00:00
|
|
|
|
2019-11-15 23:12:42 +00:00
|
|
|
for tag in tags:
|
|
|
|
name = tag["Name"]
|
|
|
|
tag_id = tag["Id"]
|
|
|
|
|
|
|
|
url_params["TagIds"] = tag_id
|
|
|
|
|
|
|
|
if parent_id:
|
2020-06-10 05:51:13 +00:00
|
|
|
menu_params["ParentId"] = parent_id
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
item_url = get_jellyfin_url("/Users/{userid}/Items", url_params)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2021-03-05 00:02:24 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(item_url))))}
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2021-01-27 03:34:51 +00:00
|
|
|
content_url = quote(item_url)
|
2019-11-15 23:12:42 +00:00
|
|
|
url = sys.argv[0] + ("?url=" +
|
|
|
|
content_url +
|
|
|
|
"&mode=GET_CONTENT" +
|
|
|
|
"&media_type=movies")
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("addMenuDirectoryItem: {0} - {1}".format(name, url))
|
2020-06-21 01:27:09 +00:00
|
|
|
add_menu_directory_item(name, url, art=art)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def show_movie_years(menu_params):
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("show_movie_years: {0}".format(menu_params))
|
2020-06-10 05:51:13 +00:00
|
|
|
parent_id = menu_params.get("parent_id")
|
|
|
|
group_into_decades = menu_params.get("group") == "true"
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
url_params = {
|
|
|
|
"UserId": user_id,
|
|
|
|
"SortBy": "SortName",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"CollapseBoxSetItems": False,
|
|
|
|
"GroupItemsIntoCollections": False,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"EnableTotalRecordCount": False,
|
|
|
|
"EnableUserData": False,
|
|
|
|
"IncludeItemTypes": "Movie"
|
|
|
|
}
|
2019-11-15 23:12:42 +00:00
|
|
|
|
|
|
|
if parent_id:
|
|
|
|
url_params["ParentId"] = parent_id
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
url = get_jellyfin_url("/Years", url_params)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2022-03-08 00:25:44 +00:00
|
|
|
result = api.get(url)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
|
|
|
if not result:
|
|
|
|
return
|
|
|
|
|
2022-03-11 01:51:49 +00:00
|
|
|
years_list = result.get("Items", [])
|
2019-11-15 23:12:42 +00:00
|
|
|
result_names = {}
|
|
|
|
for year in years_list:
|
|
|
|
name = year.get("Name")
|
|
|
|
if group_into_decades:
|
|
|
|
year_int = int(name)
|
|
|
|
decade = str(year_int - year_int % 10)
|
|
|
|
decade_end = str((year_int - year_int % 10) + 9)
|
|
|
|
decade_name = decade + "-" + decade_end
|
|
|
|
result_names[decade_name] = year_int - year_int % 10
|
|
|
|
else:
|
|
|
|
result_names[name] = [name]
|
|
|
|
|
|
|
|
keys = list(result_names.keys())
|
|
|
|
keys.sort()
|
|
|
|
|
|
|
|
if group_into_decades:
|
|
|
|
for decade_key in keys:
|
|
|
|
year_list = []
|
|
|
|
decade_start = result_names[decade_key]
|
|
|
|
for include_year in range(decade_start, decade_start + 10):
|
|
|
|
year_list.append(str(include_year))
|
|
|
|
result_names[decade_key] = year_list
|
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"CollapseBoxSetItems": False,
|
|
|
|
"GroupItemsIntoCollections": False,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-06-05 14:19:01 +00:00
|
|
|
|
2019-11-15 23:12:42 +00:00
|
|
|
for year in keys:
|
|
|
|
name = year
|
|
|
|
value = ",".join(result_names[year])
|
|
|
|
|
|
|
|
params["Years"] = value
|
|
|
|
|
|
|
|
if parent_id:
|
|
|
|
params["ParentId"] = parent_id
|
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
item_url = get_jellyfin_url("/Users/{userid}/Items", params)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2021-03-05 00:02:24 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(item_url))))}
|
2019-12-09 05:40:55 +00:00
|
|
|
|
2021-01-27 03:34:51 +00:00
|
|
|
content_url = quote(item_url)
|
2019-11-15 23:12:42 +00:00
|
|
|
url = sys.argv[0] + ("?url=" +
|
|
|
|
content_url +
|
|
|
|
"&mode=GET_CONTENT" +
|
|
|
|
"&media_type=movies")
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("addMenuDirectoryItem: {0} - {1}".format(name, url))
|
2020-06-21 01:27:09 +00:00
|
|
|
add_menu_directory_item(name, url, art=art)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def show_movie_pages(menu_params):
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("showMoviePages: {0}".format(menu_params))
|
2018-05-10 05:27:42 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
parent_id = menu_params.get("parent_id")
|
2018-09-18 04:29:54 +00:00
|
|
|
group_movies = settings.getSetting('group_movies') == "true"
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2018-05-10 05:27:42 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"CollapseBoxSetItems": group_movies,
|
|
|
|
"GroupItemsIntoCollections": group_movies,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"ImageTypeLimit": 0
|
|
|
|
}
|
2018-05-10 05:27:42 +00:00
|
|
|
|
|
|
|
if parent_id:
|
2019-11-06 05:04:41 +00:00
|
|
|
params["ParentId"] = parent_id
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
url = get_jellyfin_url("/Users/{}/Items".format(user_id), params)
|
2018-05-10 05:27:42 +00:00
|
|
|
|
2022-03-08 00:25:44 +00:00
|
|
|
result = api.get(url)
|
2018-05-10 05:27:42 +00:00
|
|
|
|
|
|
|
if result is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
total_results = result.get("TotalRecordCount", 0)
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("showMoviePages TotalRecordCount {0}".format(total_results))
|
2018-05-10 05:27:42 +00:00
|
|
|
|
|
|
|
if result == 0:
|
|
|
|
return
|
|
|
|
|
|
|
|
page_limit = int(settings.getSetting('moviePageSize'))
|
|
|
|
if page_limit == 0:
|
|
|
|
page_limit = 20
|
|
|
|
|
|
|
|
start_index = 0
|
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"CollapseBoxSetItems": group_movies,
|
|
|
|
"GroupItemsIntoCollections": group_movies,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-06-05 14:19:01 +00:00
|
|
|
|
2018-05-10 05:27:42 +00:00
|
|
|
while start_index < total_results:
|
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
params["StartIndex"] = start_index
|
|
|
|
params["Limit"] = page_limit
|
2018-05-10 05:27:42 +00:00
|
|
|
|
|
|
|
if parent_id:
|
2019-11-06 05:04:41 +00:00
|
|
|
params["ParentId"] = parent_id
|
2018-05-10 05:27:42 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
item_url = get_jellyfin_url("/Users/{userid}/Items", params)
|
2018-05-10 05:27:42 +00:00
|
|
|
|
|
|
|
page_upper = start_index + page_limit
|
|
|
|
if page_upper > total_results:
|
|
|
|
page_upper = total_results
|
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(item_url))))}
|
|
|
|
title = 'Page ({} - {})'.format(start_index + 1, page_upper)
|
2019-12-09 05:40:55 +00:00
|
|
|
|
2018-05-10 05:27:42 +00:00
|
|
|
start_index = start_index + page_limit
|
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
content_url = quote(item_url)
|
2018-05-10 05:27:42 +00:00
|
|
|
url = sys.argv[0] + ("?url=" + content_url +
|
|
|
|
"&mode=GET_CONTENT" +
|
2022-06-05 14:05:17 +00:00
|
|
|
"&media_type=movies")
|
|
|
|
log.debug("addMenuDirectoryItem: {0} - {1} - {2}".format(title, url, art))
|
|
|
|
add_menu_directory_item(title, url, art=art)
|
2018-05-10 05:27:42 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def show_genre_list(menu_params):
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("showGenreList: {0}".format(menu_params))
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
server = settings.getSetting('server_address')
|
2017-06-18 02:04:20 +00:00
|
|
|
if server is None:
|
2017-05-20 00:14:14 +00:00
|
|
|
return
|
2017-06-18 02:04:20 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
parent_id = menu_params.get("parent_id")
|
|
|
|
item_type = menu_params.get("item_type")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2018-02-24 23:26:11 +00:00
|
|
|
|
2022-06-05 02:10:54 +00:00
|
|
|
jellyfin_type = ''
|
|
|
|
kodi_type = ''
|
2022-06-05 14:05:17 +00:00
|
|
|
if item_type == 'movie':
|
2022-06-05 01:56:40 +00:00
|
|
|
jellyfin_type = "Movie"
|
|
|
|
kodi_type = 'Movies'
|
|
|
|
elif item_type == 'tvshow':
|
|
|
|
jellyfin_type = 'Series'
|
|
|
|
kodi_type = 'tvshows'
|
|
|
|
elif item_type == 'MusicAlbum':
|
|
|
|
jellyfin_type = 'MusicAlbum'
|
|
|
|
kodi_type = 'albums'
|
2022-10-02 02:15:44 +00:00
|
|
|
elif item_type == 'mixed':
|
|
|
|
jellyfin_type = 'Movie,Series'
|
|
|
|
kodi_type = 'videos'
|
2017-09-03 12:16:45 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"IncludeItemTypes": jellyfin_type,
|
|
|
|
"UserId": user_id,
|
|
|
|
"Recursive": True,
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2018-02-24 23:26:11 +00:00
|
|
|
|
|
|
|
if parent_id is not None:
|
2019-11-06 05:04:41 +00:00
|
|
|
params["ParentId"] = parent_id
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
url = get_jellyfin_url("/Genres", params)
|
2017-12-22 00:40:49 +00:00
|
|
|
|
2022-03-08 00:25:44 +00:00
|
|
|
result = api.get(url)
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2017-12-22 00:40:49 +00:00
|
|
|
if result is not None:
|
|
|
|
result = result.get("Items")
|
|
|
|
else:
|
|
|
|
result = []
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2018-09-18 04:29:54 +00:00
|
|
|
group_movies = settings.getSetting('group_movies') == "true"
|
|
|
|
|
2018-02-26 07:16:19 +00:00
|
|
|
xbmcplugin.setContent(int(sys.argv[1]), 'genres')
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"Recursive": True,
|
|
|
|
"CollapseBoxSetItems": group_movies,
|
|
|
|
"GroupItemsIntoCollections": group_movies,
|
|
|
|
"IncludeItemTypes": jellyfin_type,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-06-05 14:19:01 +00:00
|
|
|
|
2017-04-09 01:31:03 +00:00
|
|
|
for genre in result:
|
2022-06-05 14:05:17 +00:00
|
|
|
title = genre.get('Name', translate_string(30250))
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
params["GenreIds"] = genre.get("Id")
|
2018-02-24 23:26:11 +00:00
|
|
|
|
|
|
|
if parent_id is not None:
|
2019-11-06 05:04:41 +00:00
|
|
|
params["ParentId"] = parent_id
|
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2018-02-24 23:26:11 +00:00
|
|
|
|
2022-06-05 14:19:01 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(path))))}
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-06-05 14:19:01 +00:00
|
|
|
url = sys.argv[0] + ("?url=" + quote(path) +
|
2017-05-20 05:12:38 +00:00
|
|
|
"&mode=GET_CONTENT" +
|
2022-06-05 14:05:17 +00:00
|
|
|
"&media_type=" + kodi_type)
|
|
|
|
log.debug("addMenuDirectoryItem: {0} - {1} - {2}".format(title, url, art))
|
|
|
|
add_menu_directory_item(title, url, art=art)
|
2017-04-09 01:31:03 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def show_movie_alpha_list(menu_params):
|
2017-07-08 00:34:30 +00:00
|
|
|
log.debug("== ENTER: showMovieAlphaList() ==")
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2019-12-10 05:13:54 +00:00
|
|
|
xbmcplugin.setContent(int(sys.argv[1]), 'movies')
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
server = settings.getSetting('server_address')
|
2017-06-18 02:04:20 +00:00
|
|
|
if server is None:
|
2017-05-20 00:14:14 +00:00
|
|
|
return
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
group_movies = settings.getSetting('group_movies') == "true"
|
2020-06-10 05:51:13 +00:00
|
|
|
parent_id = menu_params.get("parent_id")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
url_params = {
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"Recursive": True,
|
|
|
|
"GroupItemsIntoCollections": group_movies,
|
|
|
|
"UserId": user_id,
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending"
|
|
|
|
}
|
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
if parent_id is not None:
|
2020-03-14 00:40:40 +00:00
|
|
|
url_params["ParentId"] = parent_id
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2020-09-05 20:11:15 +00:00
|
|
|
prefixes = '#' + string.ascii_uppercase
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"CollapseBoxSetItems": group_movies,
|
|
|
|
"GroupItemsIntoCollections": group_movies,
|
|
|
|
"Recursive": True,
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-06-05 14:19:01 +00:00
|
|
|
for alpha_name in prefixes:
|
2019-11-06 05:04:41 +00:00
|
|
|
if parent_id is not None:
|
|
|
|
params["ParentId"] = parent_id
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2020-09-05 20:11:15 +00:00
|
|
|
if alpha_name == "#":
|
2019-12-10 05:13:54 +00:00
|
|
|
params["NameLessThan"] = "A"
|
2022-06-05 14:19:01 +00:00
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameStartsWith' in params:
|
|
|
|
params.pop('NameStartsWith')
|
2019-12-10 05:13:54 +00:00
|
|
|
else:
|
2020-09-05 20:11:15 +00:00
|
|
|
params["NameStartsWith"] = alpha_name
|
2022-06-05 14:19:01 +00:00
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameLessThan' in params:
|
|
|
|
params.pop('NameLessThan')
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(path))))}
|
2017-04-09 01:31:03 +00:00
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
url = (sys.argv[0] + "?url=" + quote(path) +
|
|
|
|
"&mode=GET_CONTENT&media_type=Movies")
|
|
|
|
log.debug("addMenuDirectoryItem: {0} ({1})".format(alpha_name, url))
|
|
|
|
add_menu_directory_item(alpha_name, url, art=art)
|
2017-04-09 01:31:03 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
2017-05-29 10:19:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def show_tvshow_alpha_list(menu_params):
|
2019-02-08 23:17:43 +00:00
|
|
|
log.debug("== ENTER: showTvShowAlphaList() ==")
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
server = settings.getSetting('server_address')
|
2019-02-08 23:17:43 +00:00
|
|
|
if server is None:
|
|
|
|
return
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
parent_id = menu_params.get("parent_id")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2020-09-05 20:11:15 +00:00
|
|
|
prefixes = '#' + string.ascii_uppercase
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "Series",
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False
|
|
|
|
}
|
2022-06-05 14:19:01 +00:00
|
|
|
|
|
|
|
for alpha_name in prefixes:
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
if parent_id is not None:
|
|
|
|
params["ParentId"] = parent_id
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2020-06-21 01:27:09 +00:00
|
|
|
if alpha_name == "#":
|
2019-12-10 05:13:54 +00:00
|
|
|
params["NameLessThan"] = "A"
|
2022-06-05 14:19:01 +00:00
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameStartsWith' in params:
|
|
|
|
params.pop('NameStartsWith')
|
2019-12-10 05:13:54 +00:00
|
|
|
else:
|
2020-06-21 01:27:09 +00:00
|
|
|
params["NameStartsWith"] = alpha_name
|
2022-06-05 14:19:01 +00:00
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameLessThan' in params:
|
|
|
|
params.pop('NameLessThan')
|
2019-12-10 05:13:54 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2021-03-05 00:02:24 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(path))))}
|
2019-02-08 23:17:43 +00:00
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
url = (sys.argv[0] + "?url=" + quote(path) +
|
|
|
|
"&mode=GET_CONTENT&media_type=tvshows")
|
|
|
|
log.debug("addMenuDirectoryItem: {0} ({1})".format(alpha_name, url))
|
|
|
|
add_menu_directory_item(alpha_name, url, art=art)
|
2019-02-08 23:17:43 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
|
|
|
|
2022-10-02 02:15:44 +00:00
|
|
|
def show_mixed_alpha_list(menu_params):
|
|
|
|
log.debug("== ENTER: showTvShowAlphaList() ==")
|
|
|
|
|
|
|
|
server = settings.getSetting('server_address')
|
|
|
|
if server is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
parent_id = menu_params.get("parent_id")
|
|
|
|
user_id = get_current_user_id()
|
|
|
|
|
|
|
|
prefixes = '#' + string.ascii_uppercase
|
|
|
|
|
|
|
|
params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "Series,Movie",
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False
|
|
|
|
}
|
|
|
|
|
|
|
|
for alpha_name in prefixes:
|
|
|
|
|
|
|
|
if parent_id is not None:
|
|
|
|
params["ParentId"] = parent_id
|
|
|
|
|
|
|
|
if alpha_name == "#":
|
|
|
|
params["NameLessThan"] = "A"
|
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameStartsWith' in params:
|
|
|
|
params.pop('NameStartsWith')
|
|
|
|
else:
|
|
|
|
params["NameStartsWith"] = alpha_name
|
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameLessThan' in params:
|
|
|
|
params.pop('NameLessThan')
|
|
|
|
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
|
|
|
|
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(path))))}
|
|
|
|
|
|
|
|
url = (sys.argv[0] + "?url=" + quote(path) +
|
|
|
|
"&mode=GET_CONTENT&media_type=mixed")
|
|
|
|
log.debug("addMenuDirectoryItem: {0} ({1})".format(alpha_name, url))
|
|
|
|
add_menu_directory_item(alpha_name, url, art=art)
|
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
|
|
|
|
2022-06-05 01:56:40 +00:00
|
|
|
def show_artist_alpha_list(menu_params):
|
|
|
|
log.debug("== ENTER: showArtistAlphaList() ==")
|
|
|
|
|
|
|
|
xbmcplugin.setContent(int(sys.argv[1]), 'artists')
|
|
|
|
|
|
|
|
server = settings.getSetting('server_address')
|
|
|
|
if server is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
parent_id = menu_params.get("parent_id")
|
|
|
|
user_id = get_current_user_id()
|
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
url_params = {
|
|
|
|
"IncludeItemTypes": "MusicArtist",
|
|
|
|
"Recursive": True,
|
|
|
|
"UserId": user_id,
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending"
|
|
|
|
}
|
|
|
|
|
2022-06-05 01:56:40 +00:00
|
|
|
if parent_id is not None:
|
|
|
|
url_params["ParentId"] = parent_id
|
|
|
|
|
|
|
|
prefixes = '#' + string.ascii_uppercase
|
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"Recursive": True,
|
|
|
|
"IncludeItemTypes": "MusicArtist",
|
|
|
|
"SortBy": "Name",
|
|
|
|
"SortOrder": "Ascending",
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2022-06-05 01:56:40 +00:00
|
|
|
|
2022-06-05 14:19:01 +00:00
|
|
|
for alpha_name in prefixes:
|
2022-06-05 01:56:40 +00:00
|
|
|
|
|
|
|
if parent_id is not None:
|
|
|
|
params["ParentId"] = parent_id
|
|
|
|
|
|
|
|
if alpha_name == "#":
|
|
|
|
params["NameLessThan"] = "A"
|
2022-06-05 14:19:01 +00:00
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameStartsWith' in params:
|
|
|
|
params.pop('NameStartsWith')
|
2022-06-05 01:56:40 +00:00
|
|
|
else:
|
|
|
|
params["NameStartsWith"] = alpha_name
|
2022-06-05 14:19:01 +00:00
|
|
|
# Ensure we don't try to search both at once
|
|
|
|
if 'NameLessThan' in params:
|
|
|
|
params.pop('NameLessThan')
|
2022-06-05 01:56:40 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2022-06-05 01:56:40 +00:00
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
art = {"thumb": "http://localhost:24276/{}".format(ensure_text(base64.b64encode(ensure_binary(path))))}
|
2022-06-05 01:56:40 +00:00
|
|
|
|
2022-06-05 14:05:17 +00:00
|
|
|
url = (sys.argv[0] + "?url=" + quote(path) +
|
|
|
|
"&mode=GET_CONTENT&media_type=Artists")
|
|
|
|
log.debug("addMenuDirectoryItem: {0} ({1})".format(alpha_name, url))
|
|
|
|
add_menu_directory_item(alpha_name, url, art=art)
|
2022-06-05 01:56:40 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
|
|
|
|
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
def display_main_menu():
|
|
|
|
handle = int(sys.argv[1])
|
|
|
|
xbmcplugin.setContent(handle, 'files')
|
|
|
|
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30406),
|
2020-07-04 17:26:21 +00:00
|
|
|
"plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=library")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30407),
|
2020-07-04 17:26:21 +00:00
|
|
|
"plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=show_global_types")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30408),
|
2020-07-04 17:26:21 +00:00
|
|
|
"plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=show_custom_widgets")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30409),
|
2020-07-04 17:26:21 +00:00
|
|
|
"plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=addon_items")
|
2019-11-05 20:14:33 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
|
|
|
def display_menu(params):
|
|
|
|
menu_type = params.get("type")
|
|
|
|
if menu_type == "library":
|
|
|
|
display_library_views(params)
|
|
|
|
elif menu_type == "library_item":
|
|
|
|
display_library_view(params)
|
2019-11-06 05:04:41 +00:00
|
|
|
elif menu_type == "show_global_types":
|
|
|
|
show_global_types(params)
|
|
|
|
elif menu_type == "global_list_movies":
|
2019-11-08 05:13:34 +00:00
|
|
|
display_movies_type(params, None)
|
2019-11-06 05:04:41 +00:00
|
|
|
elif menu_type == "global_list_tvshows":
|
2019-11-08 05:13:34 +00:00
|
|
|
display_tvshow_type(params, None)
|
2019-11-05 20:14:33 +00:00
|
|
|
elif menu_type == "show_custom_widgets":
|
|
|
|
show_widgets()
|
|
|
|
elif menu_type == "addon_items":
|
|
|
|
display_addon_menu(params)
|
2019-11-15 23:12:42 +00:00
|
|
|
elif menu_type == "show_movie_years":
|
|
|
|
show_movie_years(params)
|
|
|
|
elif menu_type == "show_movie_tags":
|
|
|
|
show_movie_tags(params)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
def show_global_types(params):
|
|
|
|
handle = int(sys.argv[1])
|
2022-07-25 18:17:24 +00:00
|
|
|
|
2022-07-25 18:09:44 +00:00
|
|
|
user_id = get_current_user_id()
|
|
|
|
|
|
|
|
continue_watching_url_params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
continue_watching_url = get_jellyfin_url("/Users/{userid}/Items/Resume", continue_watching_url_params)
|
2022-07-25 18:09:44 +00:00
|
|
|
add_menu_directory_item(translate_string(30445),
|
|
|
|
"plugin://plugin.video.jellycon/?mode=GET_CONTENT&url=" + quote(continue_watching_url) +
|
|
|
|
"&media_type=movies" +
|
|
|
|
"&name_format="+quote("Episode|episode_name_format"))
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30256),
|
2020-07-04 17:26:21 +00:00
|
|
|
"plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=global_list_movies")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30261),
|
2020-07-04 17:26:21 +00:00
|
|
|
"plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=global_list_tvshows")
|
2022-07-25 18:17:24 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def display_homevideos_type(menu_params, view):
|
2019-11-05 20:14:33 +00:00
|
|
|
handle = int(sys.argv[1])
|
|
|
|
view_name = view.get("Name")
|
2022-02-28 03:15:54 +00:00
|
|
|
item_limit = settings.getSetting("show_x_filtered_items")
|
2020-06-10 05:51:13 +00:00
|
|
|
hide_watched = settings.getSetting("hide_watched") == "true"
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-06 05:04:41 +00:00
|
|
|
|
|
|
|
# All Home Movies
|
2022-06-10 00:12:48 +00:00
|
|
|
base_params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"Recursive": False,
|
|
|
|
"IsMissing": False,
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", base_params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=homevideos"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30405), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# In progress home movies
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2019-11-06 05:04:41 +00:00
|
|
|
params["Filters"] = "IsResumable"
|
|
|
|
params["Recursive"] = True
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=homevideos"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30267) + " (" + item_limit + ")", url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Recently added
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Recursive"] = True
|
2019-11-06 05:04:41 +00:00
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
2020-06-10 05:51:13 +00:00
|
|
|
params["Filters"] = "IsNotFolder"
|
|
|
|
if hide_watched:
|
|
|
|
params["IsPlayed"] = False
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=homevideos"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30268) + " (" + item_limit + ")", url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
|
|
|
def display_addon_menu(params):
|
|
|
|
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30246), "plugin://plugin.video.jellycon/?mode=SEARCH")
|
|
|
|
add_menu_directory_item(translate_string(30017), "plugin://plugin.video.jellycon/?mode=SHOW_SERVER_SESSIONS")
|
|
|
|
add_menu_directory_item(translate_string(30012), "plugin://plugin.video.jellycon/?mode=CHANGE_USER")
|
|
|
|
add_menu_directory_item(translate_string(30011), "plugin://plugin.video.jellycon/?mode=DETECT_SERVER_USER")
|
|
|
|
add_menu_directory_item(translate_string(30435), "plugin://plugin.video.jellycon/?mode=DETECT_CONNECTION_SPEED")
|
|
|
|
add_menu_directory_item(translate_string(30254), "plugin://plugin.video.jellycon/?mode=SHOW_SETTINGS")
|
|
|
|
add_menu_directory_item(translate_string(30395), "plugin://plugin.video.jellycon/?mode=CLEAR_CACHE")
|
|
|
|
add_menu_directory_item(translate_string(30293), "plugin://plugin.video.jellycon/?mode=CACHE_ARTWORK")
|
2020-07-04 17:26:21 +00:00
|
|
|
add_menu_directory_item("Clone default skin", "plugin://plugin.video.jellycon/?mode=CLONE_SKIN")
|
2019-11-05 20:14:33 +00:00
|
|
|
|
|
|
|
handle = int(sys.argv[1])
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def display_tvshow_type(menu_params, view):
|
2019-11-05 20:14:33 +00:00
|
|
|
handle = int(sys.argv[1])
|
2019-11-08 05:13:34 +00:00
|
|
|
|
2021-12-30 22:05:10 +00:00
|
|
|
view_name = translate_string(30261)
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
view_name = view.get("Name")
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
item_limit = settings.getSetting("show_x_filtered_items")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
# All TV Shows
|
2022-06-10 00:12:48 +00:00
|
|
|
base_params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IsMissing": False,
|
|
|
|
"IncludeItemTypes": "Series",
|
|
|
|
"Recursive": True
|
|
|
|
}
|
2020-06-10 05:51:13 +00:00
|
|
|
if view is not None:
|
|
|
|
base_params["ParentId"] = view.get("Id")
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", base_params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=tvshows"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30405), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2019-11-21 21:39:56 +00:00
|
|
|
# Favorite TV Shows
|
2020-06-10 05:51:13 +00:00
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Filters"] = "IsFavorite"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=tvshows"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30414), url)
|
2019-11-21 21:39:56 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
# Tv Shows with unplayed
|
2020-06-10 05:51:13 +00:00
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["IsPlayed"] = False
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=tvshows"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30285), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# In progress episodes
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2019-11-06 05:04:41 +00:00
|
|
|
params["SortBy"] = "DatePlayed"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["Filters"] = "IsResumable"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=Episodes&sort=none"
|
|
|
|
url += "&name_format=" + quote('Episode|episode_name_format')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30267) + " (" + item_limit + ")", url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Latest Episodes
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2019-11-06 05:04:41 +00:00
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
2020-06-10 05:51:13 +00:00
|
|
|
params["IncludeItemTypes"] = "Episode"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items/Latest", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=tvshows&sort=none"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30288) + " (" + item_limit + ")", url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
# Recently Added
|
2020-06-10 05:51:13 +00:00
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2020-06-10 05:51:13 +00:00
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["Filters"] = "IsNotFolder"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=Episodes&sort=none"
|
|
|
|
url += "&name_format=" + quote('Episode|episode_name_format')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30268) + " (" + item_limit + ")", url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2019-11-06 05:04:41 +00:00
|
|
|
# Next Up Episodes
|
2020-06-10 05:51:13 +00:00
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2022-09-18 22:34:30 +00:00
|
|
|
params["Userid"] = '{userid}'
|
2020-06-10 05:51:13 +00:00
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["Filters"] = "IsNotFolder"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
2022-02-28 03:15:54 +00:00
|
|
|
path = get_jellyfin_url("/Shows/NextUp", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=Episodes&sort=none"
|
|
|
|
url += "&name_format=" + quote('Episode|episode_name_format')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30278) + " (" + item_limit + ")", url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# TV Show Genres
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=GENRES&item_type=tvshow"
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30325), path)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# TV Show Alpha picker
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=TVSHOW_ALPHA"
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30404), path)
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def display_music_type(menu_params, view):
|
2019-11-07 05:05:29 +00:00
|
|
|
handle = int(sys.argv[1])
|
|
|
|
view_name = view.get("Name")
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
item_limit = settings.getSetting("show_x_filtered_items")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# all albums
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"Recursive": True,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "MusicAlbum"
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=MusicAlbums"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30320), url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# recently added
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "Audio",
|
|
|
|
"Limit": item_limit
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items/Latest", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=MusicAlbums"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30268) + " (" + item_limit + ")", url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# recently played
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"Recursive": True,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "Audio",
|
|
|
|
"Limit": item_limit,
|
|
|
|
"IsPlayed": True,
|
|
|
|
"SortBy": "DatePlayed",
|
|
|
|
"SortOrder": "Descending"
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=MusicAlbum"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30349) + " (" + item_limit + ")", url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# most played
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"Recursive": True,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "Audio",
|
|
|
|
"Limit": item_limit,
|
|
|
|
"IsPlayed": True,
|
|
|
|
"SortBy": "PlayCount",
|
|
|
|
"SortOrder": "Descending"
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=MusicAlbum"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30353) + " (" + item_limit + ")", url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# artists
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"Recursive": True,
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2022-02-28 03:15:54 +00:00
|
|
|
path = get_jellyfin_url("/Artists/AlbumArtists", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=MusicArtists"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30321), url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2022-06-05 01:56:40 +00:00
|
|
|
# genres
|
|
|
|
path = "plugin://plugin.video.jellycon/?mode=GENRES&item_type=MusicAlbum"
|
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
|
|
|
add_menu_directory_item(view_name + translate_string(30325), path)
|
|
|
|
|
|
|
|
# Artist Alpha picker
|
|
|
|
path = "plugin://plugin.video.jellycon/?mode=ARTIST_ALPHA"
|
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
|
|
|
add_menu_directory_item('{} - {}{}'.format(
|
|
|
|
view_name, translate_string(30323), translate_string(30404)), path)
|
|
|
|
|
2019-11-07 05:05:29 +00:00
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
|
|
|
def display_musicvideos_type(params, view):
|
|
|
|
handle = int(sys.argv[1])
|
|
|
|
xbmcplugin.setContent(handle, 'files')
|
|
|
|
|
|
|
|
view_name = view.get("Name")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# artists
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"Recursive": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IsMissing": False,
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=musicvideos"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30405), url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def display_livetv_type(menu_params, view):
|
2019-11-07 05:05:29 +00:00
|
|
|
handle = int(sys.argv[1])
|
|
|
|
xbmcplugin.setContent(handle, 'files')
|
|
|
|
|
|
|
|
view_name = view.get("Name")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# channels
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
2022-09-18 22:34:30 +00:00
|
|
|
"UserId": '{userid}',
|
2022-06-10 00:12:48 +00:00
|
|
|
"Recursive": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-02-28 03:15:54 +00:00
|
|
|
path = get_jellyfin_url("/LiveTv/Channels", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=livetv"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30360), url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# programs
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
2022-09-18 22:34:30 +00:00
|
|
|
"UserId": '{userid}',
|
2022-06-10 00:12:48 +00:00
|
|
|
"IsAiring": True,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"Fields": get_default_filters() + ",ChannelInfo",
|
|
|
|
"EnableTotalRecordCount": False
|
|
|
|
}
|
2022-02-28 03:15:54 +00:00
|
|
|
path = get_jellyfin_url("/LiveTv/Programs/Recommended", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=livetv"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30361), url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# recordings
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
2022-09-18 22:34:30 +00:00
|
|
|
"UserId": '{userid}',
|
2022-06-10 00:12:48 +00:00
|
|
|
"Recursive": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"EnableTotalRecordCount": False
|
|
|
|
}
|
2022-02-28 03:15:54 +00:00
|
|
|
path = get_jellyfin_url("/LiveTv/Recordings", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=livetv"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(view_name + translate_string(30362), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
def display_movies_type(menu_params, view):
|
2019-11-08 05:13:34 +00:00
|
|
|
handle = int(sys.argv[1])
|
|
|
|
xbmcplugin.setContent(handle, 'files')
|
|
|
|
|
2021-12-30 22:05:10 +00:00
|
|
|
view_name = translate_string(30256)
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
view_name = view.get("Name")
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
item_limit = settings.getSetting("show_x_filtered_items")
|
2019-11-06 05:04:41 +00:00
|
|
|
group_movies = settings.getSetting('group_movies') == "true"
|
2020-06-10 05:51:13 +00:00
|
|
|
hide_watched = settings.getSetting("hide_watched") == "true"
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2022-06-10 00:12:48 +00:00
|
|
|
base_params = {
|
|
|
|
"IncludeItemTypes": "Movie",
|
|
|
|
"CollapseBoxSetItems": group_movies,
|
|
|
|
"GroupItemsIntoCollections": group_movies,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False,
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
2020-06-10 05:51:13 +00:00
|
|
|
base_params["ParentId"] = view.get("Id")
|
2019-11-06 05:04:41 +00:00
|
|
|
|
|
|
|
# All Movies
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", base_params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=movies"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30405)), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Favorite Movies
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2019-12-08 20:48:41 +00:00
|
|
|
params["CollapseBoxSetItems"] = False
|
|
|
|
params["GroupItemsIntoCollections"] = False
|
2019-11-21 21:39:56 +00:00
|
|
|
params["Filters"] = "IsFavorite"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=movies"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30414)), url)
|
2019-11-21 21:39:56 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Unwatched Movies
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2019-11-06 05:04:41 +00:00
|
|
|
params["CollapseBoxSetItems"] = False
|
|
|
|
params["GroupItemsIntoCollections"] = False
|
2020-06-10 05:51:13 +00:00
|
|
|
params["IsPlayed"] = False
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=movies"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30285)), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Recently Watched Movies
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2020-03-28 02:51:24 +00:00
|
|
|
params["IsPlayed"] = True
|
|
|
|
params["SortBy"] = "DatePlayed"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["CollapseBoxSetItems"] = False
|
|
|
|
params["GroupItemsIntoCollections"] = False
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=movies&sort=none"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item('{}{} ({})'.format(view_name, translate_string(30349), item_limit), url)
|
2020-03-28 02:51:24 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Resumable Movies
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
2019-11-10 01:16:15 +00:00
|
|
|
params["Filters"] = "IsResumable"
|
2019-11-06 05:04:41 +00:00
|
|
|
params["SortBy"] = "DatePlayed"
|
|
|
|
params["SortOrder"] = "Descending"
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Limit"] = item_limit
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=movies&sort=none"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item('{}{} ({})'.format(view_name, translate_string(30267), item_limit), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Recently Added Movies
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
if hide_watched:
|
|
|
|
params["IsPlayed"] = False
|
2019-11-06 05:04:41 +00:00
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
2020-06-10 05:51:13 +00:00
|
|
|
params["Filters"] = "IsNotFolder"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=movies&sort=none"
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item('{}{} ({})'.format(view_name, translate_string(30268), item_limit), url)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Collections
|
2019-11-16 03:19:59 +00:00
|
|
|
params = {}
|
|
|
|
if view is not None:
|
|
|
|
params["ParentId"] = view.get("Id")
|
2022-02-28 03:15:54 +00:00
|
|
|
params["Fields"] = get_default_filters()
|
2019-11-16 03:19:59 +00:00
|
|
|
params["ImageTypeLimit"] = 1
|
|
|
|
params["IncludeItemTypes"] = "Boxset"
|
|
|
|
params["Recursive"] = True
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=boxsets"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30410)), url)
|
2019-11-16 03:19:59 +00:00
|
|
|
|
2020-01-10 00:54:49 +00:00
|
|
|
# Favorite Collections
|
|
|
|
params["Filters"] = "IsFavorite"
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=boxsets"
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30415)), url)
|
2020-01-10 00:54:49 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Genres
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=GENRES&item_type=movie"
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30325)), path)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Pages
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=MOVIE_PAGES"
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30397)), path)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Alpha Picker
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=MOVIE_ALPHA"
|
2019-11-08 05:13:34 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30404)), path)
|
2019-11-06 05:04:41 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Years
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=show_movie_years"
|
2019-11-15 23:12:42 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30411)), path)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Decades
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=show_movie_years&group=true"
|
2019-11-15 23:12:42 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30412)), path)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
# Tags
|
2020-07-04 17:26:21 +00:00
|
|
|
path = "plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=show_movie_tags"
|
2019-11-15 23:12:42 +00:00
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item('{}{}'.format(view_name, translate_string(30413)), path)
|
2019-11-15 23:12:42 +00:00
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2022-10-02 02:15:44 +00:00
|
|
|
def display_mixed_type(params, view):
|
|
|
|
handle = int(sys.argv[1])
|
|
|
|
|
|
|
|
view_name = translate_string(30261)
|
|
|
|
if view is not None:
|
|
|
|
view_name = view.get("Name")
|
|
|
|
|
|
|
|
item_limit = settings.getSetting("show_x_filtered_items")
|
|
|
|
user_id = get_current_user_id()
|
|
|
|
|
|
|
|
# All Mixed content
|
|
|
|
base_params = {
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IsMissing": False,
|
|
|
|
"IncludeItemTypes": "Series,Movie",
|
|
|
|
"Recursive": True
|
|
|
|
}
|
|
|
|
if view is not None:
|
|
|
|
base_params["ParentId"] = view.get("Id")
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", base_params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=mixed"
|
|
|
|
add_menu_directory_item(view_name + translate_string(30405), url)
|
|
|
|
|
|
|
|
# Favorite Mixed
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Filters"] = "IsFavorite"
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=mixed"
|
|
|
|
add_menu_directory_item(view_name + translate_string(30414), url)
|
|
|
|
|
|
|
|
# Unplayed Mixed
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["IsPlayed"] = False
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=mixed"
|
|
|
|
add_menu_directory_item(view_name + translate_string(30285), url)
|
|
|
|
|
|
|
|
# In progress mixed
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Limit"] = item_limit
|
|
|
|
params["SortBy"] = "DatePlayed"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["Filters"] = "IsResumable"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=mixed&sort=none"
|
|
|
|
url += "&name_format=" + quote('Episode|episode_name_format')
|
|
|
|
add_menu_directory_item(view_name + translate_string(30267) + " (" + item_limit + ")", url)
|
|
|
|
|
|
|
|
# Latest mixed
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Limit"] = item_limit
|
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items/Latest", params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=mixed&sort=none"
|
|
|
|
add_menu_directory_item(view_name + translate_string(30288) + " (" + item_limit + ")", url)
|
|
|
|
|
|
|
|
# Recently Added
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Limit"] = item_limit
|
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["Filters"] = "IsNotFolder"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=mixed&sort=none"
|
|
|
|
url += "&name_format=" + quote('Episode|episode_name_format')
|
|
|
|
add_menu_directory_item(view_name + translate_string(30268) + " (" + item_limit + ")", url)
|
|
|
|
|
|
|
|
# Next Up Episodes
|
|
|
|
params = {}
|
|
|
|
params.update(base_params)
|
|
|
|
params["Limit"] = item_limit
|
|
|
|
params["Userid"] = '{userid}'
|
|
|
|
params["SortBy"] = "DateCreated"
|
|
|
|
params["SortOrder"] = "Descending"
|
|
|
|
params["Filters"] = "IsNotFolder"
|
|
|
|
params["IncludeItemTypes"] = "Episode"
|
|
|
|
path = get_jellyfin_url("/Shows/NextUp", params)
|
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=Episodes&sort=none"
|
|
|
|
url += "&name_format=" + quote('Episode|episode_name_format')
|
|
|
|
add_menu_directory_item(view_name + translate_string(30278) + " (" + item_limit + ")", url)
|
|
|
|
|
|
|
|
# Mixed Genres
|
|
|
|
path = "plugin://plugin.video.jellycon/?mode=GENRES&item_type=mixed"
|
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
|
|
|
add_menu_directory_item(view_name + translate_string(30325), path)
|
|
|
|
|
|
|
|
# Mixed Alpha picker
|
|
|
|
path = "plugin://plugin.video.jellycon/?mode=TVSHOW_ALPHA"
|
|
|
|
if view is not None:
|
|
|
|
path += "&parent_id=" + view.get("Id")
|
|
|
|
add_menu_directory_item(view_name + translate_string(30404), path)
|
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
def display_library_views(params):
|
|
|
|
handle = int(sys.argv[1])
|
|
|
|
xbmcplugin.setContent(handle, 'files')
|
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
server = settings.getSetting('server_address')
|
2019-11-05 20:14:33 +00:00
|
|
|
if server is None:
|
|
|
|
return
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
views_url = "/Users/{}/Views?format=json".format(user_id)
|
2022-03-08 00:25:44 +00:00
|
|
|
views = api.get(views_url)
|
2019-11-05 20:14:33 +00:00
|
|
|
if not views:
|
|
|
|
return []
|
2022-03-11 01:51:49 +00:00
|
|
|
views = views.get("Items", [])
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2022-10-02 02:15:44 +00:00
|
|
|
view_types = ["movies", "tvshows", "homevideos", "boxsets", "playlists", "music", "musicvideos", "livetv", "Channel", "mixed"]
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
for view in views:
|
2022-10-02 02:15:44 +00:00
|
|
|
collection_type = view.get('CollectionType', 'mixed')
|
2019-11-20 07:03:05 +00:00
|
|
|
item_type = view.get('Type', None)
|
|
|
|
if collection_type in view_types or item_type == "Channel":
|
2019-11-05 20:14:33 +00:00
|
|
|
view_name = view.get("Name")
|
2020-06-21 01:27:09 +00:00
|
|
|
art = get_art(item=view, server=server)
|
2022-02-28 03:15:54 +00:00
|
|
|
art['landscape'] = get_art_url(view, "Primary", server=server)
|
2019-11-20 22:33:46 +00:00
|
|
|
|
2020-07-04 17:26:21 +00:00
|
|
|
plugin_path = "plugin://plugin.video.jellycon/?mode=SHOW_ADDON_MENU&type=library_item&view_id=" + view.get("Id")
|
2019-11-20 22:33:46 +00:00
|
|
|
|
|
|
|
if collection_type == "playlists":
|
|
|
|
plugin_path = get_playlist_path(view)
|
|
|
|
elif collection_type == "boxsets":
|
|
|
|
plugin_path = get_collection_path(view)
|
2019-11-21 04:44:16 +00:00
|
|
|
elif collection_type is None and view.get('Type', None) == "Channel":
|
|
|
|
plugin_path = get_channel_path(view)
|
2019-11-20 22:33:46 +00:00
|
|
|
|
2020-06-21 01:27:09 +00:00
|
|
|
add_menu_directory_item(view_name, plugin_path, art=art)
|
2019-11-05 20:14:33 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(handle)
|
|
|
|
|
|
|
|
|
2019-11-20 22:33:46 +00:00
|
|
|
def get_playlist_path(view_info):
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view_info.get("Id"),
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1
|
|
|
|
}
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-20 22:33:46 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=playlists"
|
2019-11-20 22:33:46 +00:00
|
|
|
return url
|
|
|
|
|
|
|
|
|
|
|
|
def get_collection_path(view_info):
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view_info.get("Id"),
|
|
|
|
"Fields": get_default_filters(),
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"IncludeItemTypes": "Boxset",
|
|
|
|
"CollapseBoxSetItems": True,
|
|
|
|
"GroupItemsIntoCollections": True,
|
|
|
|
"Recursive": True,
|
|
|
|
"IsMissing": False
|
|
|
|
}
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-20 22:33:46 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=boxsets"
|
2019-11-20 22:33:46 +00:00
|
|
|
return url
|
|
|
|
|
|
|
|
|
2019-11-21 04:44:16 +00:00
|
|
|
def get_channel_path(view):
|
2022-06-10 00:12:48 +00:00
|
|
|
params = {
|
|
|
|
"ParentId": view.get("Id"),
|
|
|
|
"IsMissing": False,
|
|
|
|
"ImageTypeLimit": 1,
|
|
|
|
"Fields": get_default_filters()
|
|
|
|
}
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-21 04:44:16 +00:00
|
|
|
|
2022-09-18 22:34:30 +00:00
|
|
|
path = get_jellyfin_url("/Users/{userid}/Items", params)
|
2021-01-27 03:34:51 +00:00
|
|
|
url = sys.argv[0] + "?url=" + quote(path) + "&mode=GET_CONTENT&media_type=files"
|
2019-11-21 04:44:16 +00:00
|
|
|
return url
|
|
|
|
|
2020-06-10 05:51:13 +00:00
|
|
|
|
2019-11-07 05:05:29 +00:00
|
|
|
def display_library_view(params):
|
|
|
|
node_id = params.get("view_id")
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
view_info_url = "/Users/{}/Items/".format(user_id) + node_id
|
2022-03-08 00:25:44 +00:00
|
|
|
view_info = api.get(view_info_url)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("VIEW_INFO : {0}".format(view_info))
|
2019-11-07 05:05:29 +00:00
|
|
|
|
2022-10-02 02:15:44 +00:00
|
|
|
collection_type = view_info.get("CollectionType", "mixed")
|
2019-11-07 05:05:29 +00:00
|
|
|
|
|
|
|
if collection_type == "movies":
|
|
|
|
display_movies_type(params, view_info)
|
|
|
|
elif collection_type == "tvshows":
|
|
|
|
display_tvshow_type(params, view_info)
|
|
|
|
elif collection_type == "homevideos":
|
|
|
|
display_homevideos_type(params, view_info)
|
|
|
|
elif collection_type == "music":
|
|
|
|
display_music_type(params, view_info)
|
|
|
|
elif collection_type == "musicvideos":
|
|
|
|
display_musicvideos_type(params, view_info)
|
|
|
|
elif collection_type == "livetv":
|
|
|
|
display_livetv_type(params, view_info)
|
2022-10-02 02:15:44 +00:00
|
|
|
elif collection_type == "mixed":
|
|
|
|
display_mixed_type(params, view_info)
|
2019-11-07 05:05:29 +00:00
|
|
|
|
|
|
|
|
2019-11-05 20:14:33 +00:00
|
|
|
def show_widgets():
|
2022-02-28 03:15:54 +00:00
|
|
|
item_limit = settings.getSetting("show_x_filtered_items")
|
2019-11-05 20:14:33 +00:00
|
|
|
|
2020-06-21 01:27:09 +00:00
|
|
|
add_menu_directory_item("All Movies",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/library/movies')
|
2020-06-21 01:27:09 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30257) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=recent_movies')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30258) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=inprogress_movies')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30269) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=random_movies')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30403) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=movie_recommendations')
|
2020-06-21 01:27:09 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30287) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=recent_tvshows')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30263) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=recent_episodes')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30264) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=inprogress_episodes')
|
2022-02-28 03:15:54 +00:00
|
|
|
add_menu_directory_item(translate_string(30265) + " (" + item_limit + ")",
|
2020-07-04 17:26:21 +00:00
|
|
|
'plugin://plugin.video.jellycon/?mode=WIDGET_CONTENT&type=nextup_episodes')
|
2017-05-28 05:55:17 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
2017-06-13 20:56:35 +00:00
|
|
|
|
|
|
|
|
2018-07-11 02:22:41 +00:00
|
|
|
def show_search():
|
2021-12-30 22:05:10 +00:00
|
|
|
add_menu_directory_item(translate_string(30231), 'plugin://plugin.video.jellycon/?mode=NEW_SEARCH&item_type=Movie')
|
|
|
|
add_menu_directory_item(translate_string(30229), 'plugin://plugin.video.jellycon/?mode=NEW_SEARCH&item_type=Series')
|
|
|
|
add_menu_directory_item(translate_string(30235), 'plugin://plugin.video.jellycon/?mode=NEW_SEARCH&item_type=Episode')
|
|
|
|
add_menu_directory_item(translate_string(30337), 'plugin://plugin.video.jellycon/?mode=NEW_SEARCH&item_type=Audio')
|
|
|
|
add_menu_directory_item(translate_string(30338), 'plugin://plugin.video.jellycon/?mode=NEW_SEARCH&item_type=MusicAlbum')
|
|
|
|
add_menu_directory_item(translate_string(30339), 'plugin://plugin.video.jellycon/?mode=NEW_SEARCH&item_type=Person')
|
2017-06-13 20:56:35 +00:00
|
|
|
|
|
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1]))
|
2018-02-24 00:23:02 +00:00
|
|
|
|
|
|
|
|
2018-12-19 02:24:41 +00:00
|
|
|
def set_library_window_values(force=False):
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("set_library_window_values Called forced={0}".format(force))
|
2018-03-02 04:30:46 +00:00
|
|
|
home_window = HomeWindow()
|
2018-02-24 00:23:02 +00:00
|
|
|
|
2020-06-21 01:27:09 +00:00
|
|
|
already_set = home_window.get_property("view_item.0.name")
|
2018-12-19 02:24:41 +00:00
|
|
|
if not force and already_set:
|
2018-03-02 04:30:46 +00:00
|
|
|
return
|
2022-05-21 03:40:13 +00:00
|
|
|
user_id = get_current_user_id()
|
2018-02-24 00:23:02 +00:00
|
|
|
|
2018-10-25 04:44:35 +00:00
|
|
|
for index in range(0, 20):
|
2020-06-21 01:27:09 +00:00
|
|
|
home_window.clear_property("view_item.%i.name" % index)
|
|
|
|
home_window.clear_property("view_item.%i.id" % index)
|
|
|
|
home_window.clear_property("view_item.%i.type" % index)
|
|
|
|
home_window.clear_property("view_item.%i.thumb" % index)
|
2018-10-25 04:44:35 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
url = "/Users/{}/Views".format(user_id)
|
2022-03-08 00:25:44 +00:00
|
|
|
result = api.get(url)
|
2018-02-24 00:23:02 +00:00
|
|
|
|
2018-03-02 04:30:46 +00:00
|
|
|
if result is None:
|
|
|
|
return
|
|
|
|
|
2022-03-11 01:51:49 +00:00
|
|
|
result = result.get("Items", [])
|
2022-02-28 03:15:54 +00:00
|
|
|
server = settings.getSetting('server_address')
|
2018-02-24 00:23:02 +00:00
|
|
|
|
|
|
|
index = 0
|
|
|
|
for item in result:
|
|
|
|
|
2022-10-02 02:15:44 +00:00
|
|
|
collection_type = item.get("CollectionType", "mixed")
|
|
|
|
if collection_type in ["movies", "boxsets", "music", "tvshows", "mixed"]:
|
2018-02-24 00:23:02 +00:00
|
|
|
name = item.get("Name")
|
2020-06-21 01:27:09 +00:00
|
|
|
item_id = item.get("Id")
|
2018-02-24 00:23:02 +00:00
|
|
|
|
2020-07-04 17:26:21 +00:00
|
|
|
# plugin.video.jellycon-
|
2018-02-24 00:23:02 +00:00
|
|
|
prop_name = "view_item.%i.name" % index
|
2020-06-21 01:27:09 +00:00
|
|
|
home_window.set_property(prop_name, name)
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("set_library_window_values: plugin.video.jellycon-{0}={1}".format(prop_name, name))
|
2018-02-24 00:23:02 +00:00
|
|
|
|
|
|
|
prop_name = "view_item.%i.id" % index
|
2020-06-21 01:27:09 +00:00
|
|
|
home_window.set_property(prop_name, item_id)
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("set_library_window_values: plugin.video.jellycon-{0}={1}".format(prop_name, item_id))
|
2018-02-24 00:23:02 +00:00
|
|
|
|
|
|
|
prop_name = "view_item.%i.type" % index
|
2020-06-21 01:27:09 +00:00
|
|
|
home_window.set_property(prop_name, collection_type)
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("set_library_window_values: plugin.video.jellycon-{0}={1}".format(prop_name, collection_type))
|
2018-02-24 00:23:02 +00:00
|
|
|
|
2022-02-28 03:15:54 +00:00
|
|
|
thumb = get_art_url(item, "Primary", server=server)
|
2018-02-24 00:23:02 +00:00
|
|
|
prop_name = "view_item.%i.thumb" % index
|
2020-06-21 01:27:09 +00:00
|
|
|
home_window.set_property(prop_name, thumb)
|
2020-07-25 05:01:30 +00:00
|
|
|
log.debug("set_library_window_values: plugin.video.jellycon-{0}={1}".format(prop_name, thumb))
|
2018-02-24 00:23:02 +00:00
|
|
|
|
|
|
|
index += 1
|