Normalize auto-generated collection titles

master
Felix Stupp 3 years ago
parent d0b3795484
commit 1bca3104bd
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -84,7 +84,7 @@ class YouTubeCollectionExtractor(CollectionExtractor[Dict]):
def _update_object_raw(self, object: MediaCollection, data: Dict):
info = data["info"]
is_channel = self.__is_channel_id(info["id"])
object.title = f"Channel: {info['channel']['name']} (YouTube)" if is_channel else f"{info['title']} ({info['channel']['name']})"
object.title = f"[channel] [{self.name}] {info['channel']['name']}" if is_channel else f"{info['title']} ({info['channel']['name']})"
object.add_uris((info["link"],))
video_list = data["videos"]
if object.watch_in_order_auto:

@ -59,8 +59,8 @@ class MediaExtractor(GeneralExtractor[MediaElement, T]):
collection = self.__lookup_author_collection(author_data)
if collection is None:
collection = self.__create_author_collection(author_data)
if not collection.title or collection.title.startswith(f"(author:{author_data.extractor_name}) "):
collection.title = f"(author:{author_data.extractor_name}) {author_data.author_name}"
if not collection.title or collection.title.startswith("[author] "):
collection.title = f"[author] [{author_data.extractor_name}] {author_data.author_name}"
return collection
def __add_to_author_collection(self, element: MediaElement, data: Dict):

@ -27,7 +27,7 @@ class YtdlMediaExtractor(MediaExtractor[Dict]):
object_uri = data.get("channel_url") or data.get("uploader_url"),
extractor_name = self.name,
object_key = f"author:{video_extractor_key}:{author_key}" if author_key else None,
author_name = f"{video_extractor_key}: {author_name}" if author_name else None,
author_name = f"[{video_extractor_key.lower()}] {author_name}" if author_name else None,
)
def _extract_online(self, uri: str) -> ExtractedData[Dict]:

Loading…
Cancel
Save