From 41293eb58c855dae4dece31a42e80679534f1daf Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 27 Sep 2022 08:45:06 -0700 Subject: [PATCH] nuke artist --- .../entries/variables/youtube_variables.py | 45 ------------------- .../youtube/test_playlist.json | 8 ++-- .../youtube/test_playlist.txt | 6 +-- tests/e2e/youtube/test_channel.py | 6 +-- tests/e2e/youtube/test_playlist.py | 6 +-- tests/unit/entries/test_youtube_entries.py | 24 +--------- 6 files changed, 13 insertions(+), 82 deletions(-) diff --git a/src/ytdl_sub/entries/variables/youtube_variables.py b/src/ytdl_sub/entries/variables/youtube_variables.py index 7446e1dc..8507ef88 100644 --- a/src/ytdl_sub/entries/variables/youtube_variables.py +++ b/src/ytdl_sub/entries/variables/youtube_variables.py @@ -28,51 +28,6 @@ class YoutubeVideoVariables(EntryVariables): """ return sanitize_filename(self.channel) - @property - def track_title(self: BaseEntry) -> str: - """ - Returns - ------- - str - The track title of a music video if it is available, otherwise it falls back to the - title. NOTE: Even if a video has music metadata, this variable does not always get - pulled via yt-dlp. Use with caution. - """ - # Try to get the track, fall back on title - return self.kwargs_get("track", super().title) - - @property - def track_title_sanitized(self) -> str: - """ - Returns - ------- - str - The sanitized track title. - """ - return sanitize_filename(self.track_title) - - @property - def artist(self: BaseEntry) -> str: - """ - Returns - ------- - str - The artist of a music video if it is available, otherwise it falls back to the channel. - NOTE: Even if a video has music metadata, this variable does not always get pulled via - yt-dlp. Use with caution. - """ - return self.kwargs_get("artist", self.kwargs("channel")) - - @property - def artist_sanitized(self) -> str: - """ - Returns - ------- - str - The sanitized artist name. - """ - return sanitize_filename(self.artist) - @property def playlist_index(self) -> int: """ diff --git a/tests/e2e/resources/expected_downloads_summaries/youtube/test_playlist.json b/tests/e2e/resources/expected_downloads_summaries/youtube/test_playlist.json index fa44bf04..f73b538e 100644 --- a/tests/e2e/resources/expected_downloads_summaries/youtube/test_playlist.json +++ b/tests/e2e/resources/expected_downloads_summaries/youtube/test_playlist.json @@ -1,16 +1,16 @@ { ".ytdl-sub-music_video_playlist_test-download-archive.json": "25b8e44961343116436584e341c7fe9b", "JMC - Jesse's Minecraft Server [Trailer - Feb.1]-thumb.jpg": "b232d253df621aa770b780c1301d364d", - "JMC - Jesse's Minecraft Server [Trailer - Feb.1].info.json": "a1763e5afb49be0935d932334336f62f", + "JMC - Jesse's Minecraft Server [Trailer - Feb.1].info.json": "4a190d0ebb6d9b622a729c974be73632", "JMC - Jesse's Minecraft Server [Trailer - Feb.1].mp4": "e66287b9832277b6a4d1554e29d9fdcc", "JMC - Jesse's Minecraft Server [Trailer - Feb.1].nfo": "f8fd72bb97ed03938487494ad9094ca0", "JMC - Jesse's Minecraft Server [Trailer - Feb.27]-thumb.jpg": "d17c379ea8b362f5b97c6b213b0342cb", - "JMC - Jesse's Minecraft Server [Trailer - Feb.27].info.json": "2d3b4299450776edd822514d071671a4", + "JMC - Jesse's Minecraft Server [Trailer - Feb.27].info.json": "595dfc58b7ba1eb212b778d6b28c35c6", "JMC - Jesse's Minecraft Server [Trailer - Feb.27].mp4": "04ab5cb3cc12325d0c96a7cd04a8b91d", "JMC - Jesse's Minecraft Server [Trailer - Feb.27].nfo": "6de4d997cfb300356072b4ebb09cbe38", "JMC - Jesse's Minecraft Server [Trailer - Mar.21]-thumb.jpg": "e7830aa8a64b0cde65ba3f7e5fc56530", - "JMC - Jesse's Minecraft Server [Trailer - Mar.21].info.json": "17a942919cb951d7cfd0dcc502bf4499", + "JMC - Jesse's Minecraft Server [Trailer - Mar.21].info.json": "5075f5806bddb88e6df6ae26f6800805", "JMC - Jesse's Minecraft Server [Trailer - Mar.21].mp4": "025de6099a5c98e6397153c7a62d517d", "JMC - Jesse's Minecraft Server [Trailer - Mar.21].nfo": "f000a6ed8caacb62a134a6ca81e3f308", - "tvshow.nfo": "792b0594defdfd6642086b76fcc6a91b" + "tvshow.nfo": "e4123860532466ed5e0ebf2c9e44eb18" } \ No newline at end of file diff --git a/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt b/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt index 14e1f17f..65b90853 100644 --- a/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt +++ b/tests/e2e/resources/transaction_log_summaries/youtube/test_playlist.txt @@ -34,6 +34,6 @@ JMC - Jesse's Minecraft Server [Trailer - Mar.21].nfo tvshow.nfo NFO tags: test: - source_description: Trailers, Updates, etc - source_title: Jesse's Minecraft Server - source_uploader: Project Zombie \ No newline at end of file + playlist_description: Trailers, Updates, etc + playlist_title: Jesse's Minecraft Server + playlist_uploader: Project Zombie \ No newline at end of file diff --git a/tests/e2e/youtube/test_channel.py b/tests/e2e/youtube/test_channel.py index e355c0d6..c9113782 100644 --- a/tests/e2e/youtube/test_channel.py +++ b/tests/e2e/youtube/test_channel.py @@ -1,12 +1,8 @@ -from unittest.mock import patch - import pytest -from conftest import assert_debug_log from e2e.expected_download import assert_expected_downloads from e2e.expected_transaction_log import assert_transaction_log_matches from ytdl_sub.subscriptions.subscription import Subscription -from ytdl_sub.utils.retry import logger as retry_logger @pytest.fixture @@ -28,7 +24,7 @@ def channel_preset_dict(output_directory): }, "output_directory_nfo_tags": { "tags": { - "source_uploader": "{source_uploader}", + "source_uploader": "{playlist_uploader}", } }, "overrides": {"tv_show_name": "Project / Zombie"}, diff --git a/tests/e2e/youtube/test_playlist.py b/tests/e2e/youtube/test_playlist.py index 2f98df38..92db8a76 100644 --- a/tests/e2e/youtube/test_playlist.py +++ b/tests/e2e/youtube/test_playlist.py @@ -23,9 +23,9 @@ def playlist_preset_dict(output_directory): "nfo_name": "tvshow.nfo", "nfo_root": "test", "tags": { - "source_title": "{source_title}", - "source_uploader": "{source_uploader}", - "source_description": "{source_description}", + "playlist_title": "{playlist_title}", + "playlist_uploader": "{playlist_uploader}", + "playlist_description": "{playlist_description}", }, }, "subtitles": { diff --git a/tests/unit/entries/test_youtube_entries.py b/tests/unit/entries/test_youtube_entries.py index 67f7ea79..4935ce13 100644 --- a/tests/unit/entries/test_youtube_entries.py +++ b/tests/unit/entries/test_youtube_entries.py @@ -20,19 +20,7 @@ def channel(): @pytest.fixture -def track_title(): - return "not the title!" - - -@pytest.fixture -def artist(): - return "not the channel" - - -@pytest.fixture -def mock_youtube_video_to_dict( - mock_entry_to_dict, playlist_index, playlist_size, channel, track_title, artist -): +def mock_youtube_video_to_dict(mock_entry_to_dict, playlist_index, playlist_size, channel): return dict( mock_entry_to_dict, **{ @@ -40,26 +28,18 @@ def mock_youtube_video_to_dict( "playlist_size": playlist_size, "channel": channel, "channel_sanitized": channel, - "track_title": track_title, - "track_title_sanitized": track_title, - "artist": artist, - "artist_sanitized": artist, } ) @pytest.fixture -def mock_youtube_video_kwargs( - mock_entry_kwargs, playlist_index, playlist_size, channel, track_title, artist -): +def mock_youtube_video_kwargs(mock_entry_kwargs, playlist_index, playlist_size, channel): return dict( mock_entry_kwargs, **{ "playlist_index": playlist_index, "playlist_count": playlist_size, "channel": channel, - "track": track_title, - "artist": artist, } )