diff --git a/plugin.video.external.library/libs/actions.py b/plugin.video.external.library/libs/actions.py index 03b94d4..cfb6c5a 100644 --- a/plugin.video.external.library/libs/actions.py +++ b/plugin.video.external.library/libs/actions.py @@ -27,6 +27,8 @@ SeasonsHandler, EpisodesHandler, RecentEpisodesHandler, + MusicVideosHandler, + RecentMusicVideosHandler, ) from libs.exceptions import NoDataError, RemoteKodiError from libs.kodi_service import ADDON, ADDON_ID, GettextEmulator, get_plugin_url @@ -49,6 +51,8 @@ 'seasons': SeasonsHandler, 'episodes': EpisodesHandler, 'recent_episodes': RecentEpisodesHandler, + 'music_videos': MusicVideosHandler, + 'recent_music_videos': RecentMusicVideosHandler, } @@ -79,6 +83,18 @@ def root(): 'thumb': 'DefaultRecentlyAddedEpisodes.png'}) url = get_plugin_url(content_type='recent_episodes') xbmcplugin.addDirectoryItem(HANDLE, url, list_item, isFolder=True) + if ADDON.getSettingBool('show_music_videos'): + list_item = ListItem(f'[{_("Music videos")}]') + list_item.setArt({'icon': 'DefaultMusicVideos.png', 'thumb': 'DefaultMusicVideos.png'}) + url = get_plugin_url(content_type='music_videos') + xbmcplugin.addDirectoryItem(HANDLE, url, list_item, isFolder=True) + if ADDON.getSettingBool('show_recent_music_videos'): + list_item = ListItem(f'[{_("Recently added music video")}]') + list_item.setArt({'icon': 'DefaultRecentlyAddedMusicVideos.png', + 'thumb': 'DefaultRecentlyAddedMusicVideos.png'}) + url = get_plugin_url(content_type='recent_music_videos') + xbmcplugin.addDirectoryItem(HANDLE, url, list_item, isFolder=True) + xbmcplugin.endOfDirectory(HANDLE) def show_media_items(content_type, tvshowid=None, season=None, parent_category=None): @@ -128,6 +144,7 @@ def show_media_items(content_type, tvshowid=None, season=None, parent_category=N for sort_method in content_type_handler.get_sort_methods(): xbmcplugin.addSortMethod(HANDLE, sort_method) logger.debug('Finished creating a list of %s items.', content_type) + xbmcplugin.endOfDirectory(HANDLE) def router(paramstring): @@ -135,11 +152,10 @@ def router(paramstring): logger.debug('Called addon with params: %s', str(sys.argv)) if 'content_type' not in params: root() - else: - if (tvshowid := params.get('tvshowid')) is not None: - tvshowid = int(tvshowid) - if (season := params.get('season')) is not None: - season = int(season) - parent_category = params.get('parent_category') - show_media_items(params['content_type'], tvshowid, season, parent_category) - xbmcplugin.endOfDirectory(HANDLE) + return + if (tvshowid := params.get('tvshowid')) is not None: + tvshowid = int(tvshowid) + if (season := params.get('season')) is not None: + season = int(season) + parent_category = params.get('parent_category') + show_media_items(params['content_type'], tvshowid, season, parent_category) diff --git a/plugin.video.external.library/libs/media_info_service.py b/plugin.video.external.library/libs/media_info_service.py index 40e5ca9..29cebf8 100644 --- a/plugin.video.external.library/libs/media_info_service.py +++ b/plugin.video.external.library/libs/media_info_service.py @@ -196,6 +196,9 @@ def get_method_args(self) -> Iterable[Any]: ('productioncode', 'setProductionCode', SimpleMediaPropertySetter), ('specialsortseason', 'setSortSeason', NonNegativeValueSetter), ('specialsortepisode', 'setSortEpisode', NonNegativeValueSetter), + ('album', 'setAlbum', SimpleMediaPropertySetter), + ('artist', 'setArtists', SimpleMediaPropertySetter), + ('track', 'setTrack', NonNegativeValueSetter), ] diff --git a/plugin.video.external.library/resources/settings.xml b/plugin.video.external.library/resources/settings.xml index 1effed7..8e48198 100644 --- a/plugin.video.external.library/resources/settings.xml +++ b/plugin.video.external.library/resources/settings.xml @@ -86,6 +86,19 @@ true + + 0 + true + + + + 0 + true + + + true + +