From 354a428a83b3d2c5ed9955021b5325d1e5507f7d Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Sun, 29 Sep 2024 05:33:18 +1000 Subject: [PATCH] Fix incorrect logging resulting from 4702545 --- .../youtube/helper/url_to_item_converter.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/resources/lib/youtube_plugin/youtube/helper/url_to_item_converter.py b/resources/lib/youtube_plugin/youtube/helper/url_to_item_converter.py index c74c509b..11acef66 100644 --- a/resources/lib/youtube_plugin/youtube/helper/url_to_item_converter.py +++ b/resources/lib/youtube_plugin/youtube/helper/url_to_item_converter.py @@ -83,24 +83,26 @@ def add_url(self, url, context): )) return + item = None + if 'video_ids' in new_params: for video_id in new_params['video_ids'].split(','): - video_item = VideoItem( + item = VideoItem( name='', uri=context.create_uri( (PATHS.PLAY,), dict(new_params, video_id=video_id), ) ) - self._video_id_dict[video_id] = video_item + self._video_id_dict[video_id] = item elif 'video_id' in new_params: video_id = new_params['video_id'] - video_item = VideoItem( + item = VideoItem( '', context.create_uri((PATHS.PLAY,), new_params) ) - self._video_id_dict[video_id] = video_item + self._video_id_dict[video_id] = item if 'playlist_id' in new_params: playlist_id = new_params['playlist_id'] @@ -109,10 +111,10 @@ def add_url(self, url, context): self._playlist_ids.append(playlist_id) return - playlist_item = DirectoryItem( + item = DirectoryItem( '', context.create_uri(('playlist', playlist_id,), new_params), ) - self._playlist_id_dict[playlist_id] = playlist_item + self._playlist_id_dict[playlist_id] = item if 'channel_id' in new_params: channel_id = new_params['channel_id'] @@ -122,14 +124,14 @@ def add_url(self, url, context): self._channel_ids.append(channel_id) return - channel_item = VideoItem( + item = VideoItem( '', context.create_uri((PATHS.PLAY,), new_params) ) if live else DirectoryItem( '', context.create_uri(('channel', channel_id,), new_params) ) - self._channel_id_dict[channel_id] = channel_item + self._channel_id_dict[channel_id] = item - else: + if not item: context.log_debug('No items found in url "{0}"'.format(url)) def add_urls(self, urls, context):