From 30c77565bc9d8750eec60143416c099cb2daf4e0 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Fri, 13 Jan 2023 10:47:43 -0800 Subject: [PATCH] [BACKEND] Add playlist_uploader_sanitized var (#414) --- src/ytdl_sub/entries/variables/entry_variables.py | 10 ++++++++++ tests/unit/entries/conftest.py | 1 + 2 files changed, 11 insertions(+) diff --git a/src/ytdl_sub/entries/variables/entry_variables.py b/src/ytdl_sub/entries/variables/entry_variables.py index 61bcf0ae..91762245 100644 --- a/src/ytdl_sub/entries/variables/entry_variables.py +++ b/src/ytdl_sub/entries/variables/entry_variables.py @@ -300,6 +300,16 @@ class EntryVariables(BaseEntryVariables): """ return self.kwargs_get(PLAYLIST_UPLOADER, self.uploader) + @property + def playlist_uploader_sanitized(self: Self) -> str: + """ + Returns + ------- + str + The playlist uploader, sanitized. + """ + return sanitize_filename(self.playlist_uploader) + @property def playlist_uploader_url(self: Self) -> str: """ diff --git a/tests/unit/entries/conftest.py b/tests/unit/entries/conftest.py index e3ccaedc..6f003ebe 100644 --- a/tests/unit/entries/conftest.py +++ b/tests/unit/entries/conftest.py @@ -116,6 +116,7 @@ def mock_entry_to_dict( "playlist_webpage_url": "https://yourname.here", "playlist_uid": "abc123", "playlist_uploader": "abc123", + "playlist_uploader_sanitized": "abc123", "playlist_uploader_id": "abc123", "playlist_uploader_url": "https://yourname.here", "source_count": 1,