From d6eda27371bd5278cb82cd81b822320e80795fb0 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Tue, 27 Jan 2026 10:15:32 -0800 Subject: [PATCH] [BACKEND] Less string casting behind the scenes (#1425) Simplifies internal scripts by not casting things to String when unnecessary. --- src/ytdl_sub/utils/script.py | 5 ++-- .../music/inspect_full_overrides.json | 4 ++-- .../music/inspect_full_variables.json | 14 +++++------ .../music/inspect_overrides.json | 4 ++-- .../music/inspect_variables.json | 14 +++++------ .../music_video/inspect_full_variables.json | 4 ++-- .../music_video/inspect_variables.json | 4 ++-- .../tv_show/inspect_full_overrides.json | 8 +++---- .../tv_show/inspect_full_variables.json | 24 +++++++++---------- .../tv_show/inspect_overrides.json | 6 ++--- .../tv_show/inspect_variables.json | 22 ++++++++--------- tests/unit/utils/test_script_utils.py | 6 ++--- .../test_string_formatter_validator.py | 8 +++---- 13 files changed, 61 insertions(+), 62 deletions(-) diff --git a/src/ytdl_sub/utils/script.py b/src/ytdl_sub/utils/script.py index 90cb3aa3..7252d7c4 100644 --- a/src/ytdl_sub/utils/script.py +++ b/src/ytdl_sub/utils/script.py @@ -87,9 +87,8 @@ class ScriptUtils: ast = parse(text=value).ast if len(ast) == 1: return ast[0] - return BuiltInFunction( - name="concat", args=[BuiltInFunction(name="string", args=[arg]) for arg in ast] - ) + + return BuiltInFunction(name="concat", args=ast) if isinstance(value, bool): return Boolean(value) if isinstance(value, int): diff --git a/tests/resources/expected_json/music/inspect_full_overrides.json b/tests/resources/expected_json/music/inspect_full_overrides.json index ac17630f..b4fcae9c 100644 --- a/tests/resources/expected_json/music/inspect_full_overrides.json +++ b/tests/resources/expected_json/music/inspect_full_overrides.json @@ -1,5 +1,5 @@ { - "album_cover_path": "Lester Young/{ %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }/folder.jpg", + "album_cover_path": "Lester Young/{ %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }/folder.{ thumbnail_ext }", "album_dir": "[{ %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) }] { %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) }", "artist_dir": "Lester Young", "avatar_uncropped_thumbnail_file_name": "", @@ -24,7 +24,7 @@ "track_artist": "Lester Young", "track_date": "{ %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) }", "track_file_name": "{ %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ) } - { %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }.{ ext }", - "track_full_path": "Lester Young/{ %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }/{ %concat( %string( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ) ), \" - \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ), \".\", %string( ext ) ) }", + "track_full_path": "{ artist_dir }/{ %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }/{ %concat( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ), \" - \", %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ), \".\", ext ) }", "track_genre": "Jazz", "track_genre_default": "Unset", "track_number": "{ %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ) }", diff --git a/tests/resources/expected_json/music/inspect_full_variables.json b/tests/resources/expected_json/music/inspect_full_variables.json index ca5513bf..25c2274a 100644 --- a/tests/resources/expected_json/music/inspect_full_variables.json +++ b/tests/resources/expected_json/music/inspect_full_variables.json @@ -1,8 +1,8 @@ { - "album_cover_path": "Lester Young/{ %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }/folder.jpg", - "album_cover_path_sanitized": "{ %sanitize( %concat( \"Lester Young\", \"/\", %string( %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ), \"/folder.\", \"jpg\" ) ) }", + "album_cover_path": "Lester Young/{ %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }/folder.{ thumbnail_ext }", + "album_cover_path_sanitized": "{ %sanitize( %concat( \"Lester Young\", \"/\", %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ), \"/folder.\", thumbnail_ext ) ) }", "album_dir": "[{ %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) }] { %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) }", - "album_dir_sanitized": "{ %sanitize( %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ) }", + "album_dir_sanitized": "{ %sanitize( %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }", "artist_dir": "Lester Young", "artist_dir_sanitized": "Lester Young", "avatar_uncropped_thumbnail_file_name": "", @@ -140,7 +140,7 @@ "resolution_assert_print_sanitized": "true", "resolution_assert_sanitized": "{ %sanitize( %if( %and( enable_resolution_assert, %ne( height, 0 ), %not( resolution_assert_is_ignored ) ), %assert( %gte( height, resolution_assert_height_gte ), %concat( \"Entry \", title, \" downloaded at a low resolution (\", resolution_readable, \"), you've probably been throttled. \", \"Stopping further downloads, wait a few hours and try again. \", \"Disable using the override variable `enable_resolution_assert: False`.\" ) ), \"false is no-op\" ) ) }", "resolution_readable": "{ %map_get_non_empty( entry_metadata, \"width\", 0 ) }x{ %map_get_non_empty( entry_metadata, \"height\", 0 ) }", - "resolution_readable_sanitized": "{ %sanitize( %concat( %string( %map_get_non_empty( entry_metadata, \"width\", 0 ) ), \"x\", %string( %map_get_non_empty( entry_metadata, \"height\", 0 ) ) ) ) }", + "resolution_readable_sanitized": "{ %sanitize( %concat( %map_get_non_empty( entry_metadata, \"width\", 0 ), \"x\", %map_get_non_empty( entry_metadata, \"height\", 0 ) ) ) }", "sibling_metadata": "{ %map_get_non_empty( entry_metadata, \"sibling_metadata\", [ ] ) }", "sibling_metadata_sanitized": "{ %sanitize( sibling_metadata ) }", "source_count": "{ %map_get_non_empty( %map_get_non_empty( entry_metadata, \"playlist_metadata\", { } ), \"playlist_count\", 1 ) }", @@ -194,9 +194,9 @@ "track_date": "{ %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) }", "track_date_sanitized": "{ %sanitize( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) ) }", "track_file_name": "{ %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ) } - { %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }.{ ext }", - "track_file_name_sanitized": "{ %sanitize( %concat( %string( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ) ), \" - \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ), \".\", %string( ext ) ) ) }", - "track_full_path": "Lester Young/{ %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }/{ %concat( %string( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ) ), \" - \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ), \".\", %string( ext ) ) }", - "track_full_path_sanitized": "{ %sanitize( %concat( \"Lester Young\", \"/\", %string( %concat( \"[\", %string( %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ) ), \"] \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ), \"/\", %string( %concat( %string( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ) ), \" - \", %string( %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ), \".\", %string( ext ) ) ) ) ) }", + "track_file_name_sanitized": "{ %sanitize( %concat( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ), \" - \", %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ), \".\", ext ) ) }", + "track_full_path": "{ artist_dir }/{ %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }/{ %concat( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ), \" - \", %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ), \".\", ext ) }", + "track_full_path_sanitized": "{ %sanitize( %concat( artist_dir, \"/\", %concat( \"[\", %int( %map_get( %to_date_metadata( %array_reduce( %if_passthrough( %extract_field_from_siblings( \"upload_date\" ), [ upload_date ] ), %max ) ), \"year\" ) ), \"] \", %sanitize( %map_get_non_empty( entry_metadata, \"playlist_title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ), \"/\", %concat( %pad_zero( %map_get_non_empty( entry_metadata, \"playlist_index\", 1 ), 2 ), \" - \", %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ), \".\", ext ) ) ) }", "track_genre": "Jazz", "track_genre_default": "Unset", "track_genre_default_sanitized": "Unset", diff --git a/tests/resources/expected_json/music/inspect_overrides.json b/tests/resources/expected_json/music/inspect_overrides.json index 19490f00..69ef99c4 100644 --- a/tests/resources/expected_json/music/inspect_overrides.json +++ b/tests/resources/expected_json/music/inspect_overrides.json @@ -1,5 +1,5 @@ { - "album_cover_path": "Lester Young/{ %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) }/folder.{ thumbnail_ext }", + "album_cover_path": "Lester Young/{ %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ) }/folder.{ thumbnail_ext }", "album_dir": "[{ playlist_max_upload_year }] { %sanitize( playlist_title ) }", "artist_dir": "Lester Young", "avatar_uncropped_thumbnail_file_name": "", @@ -24,7 +24,7 @@ "track_artist": "Lester Young", "track_date": "{ upload_date_standardized }", "track_file_name": "{ playlist_index_padded } - { %sanitize( title ) }.{ ext }", - "track_full_path": "Lester Young/{ %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) }/{ %concat( %string( playlist_index_padded ), \" - \", %string( %sanitize( title ) ), \".\", %string( ext ) ) }", + "track_full_path": "{ artist_dir }/{ %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ) }/{ %concat( playlist_index_padded, \" - \", %sanitize( title ), \".\", ext ) }", "track_genre": "Jazz", "track_genre_default": "Unset", "track_number": "{ playlist_index }", diff --git a/tests/resources/expected_json/music/inspect_variables.json b/tests/resources/expected_json/music/inspect_variables.json index 131629d8..1fee2525 100644 --- a/tests/resources/expected_json/music/inspect_variables.json +++ b/tests/resources/expected_json/music/inspect_variables.json @@ -1,8 +1,8 @@ { - "album_cover_path": "Lester Young/{ %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) }/folder.{ thumbnail_ext }", - "album_cover_path_sanitized": "{ %sanitize( %concat( \"Lester Young\", \"/\", %string( %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) ), \"/folder.\", %string( thumbnail_ext ) ) ) }", + "album_cover_path": "Lester Young/{ %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ) }/folder.{ thumbnail_ext }", + "album_cover_path_sanitized": "{ %sanitize( %concat( \"Lester Young\", \"/\", %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ), \"/folder.\", thumbnail_ext ) ) }", "album_dir": "[{ playlist_max_upload_year }] { %sanitize( playlist_title ) }", - "album_dir_sanitized": "{ %sanitize( %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) ) }", + "album_dir_sanitized": "{ %sanitize( %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ) ) }", "artist_dir": "Lester Young", "artist_dir_sanitized": "Lester Young", "avatar_uncropped_thumbnail_file_name": "", @@ -140,7 +140,7 @@ "resolution_assert_print_sanitized": "true", "resolution_assert_sanitized": "{ %sanitize( %if( %and( enable_resolution_assert, %ne( height, 0 ), %not( resolution_assert_is_ignored ) ), %assert( %gte( height, resolution_assert_height_gte ), %concat( \"Entry \", title, \" downloaded at a low resolution (\", resolution_readable, \"), you've probably been throttled. \", \"Stopping further downloads, wait a few hours and try again. \", \"Disable using the override variable `enable_resolution_assert: False`.\" ) ), \"false is no-op\" ) ) }", "resolution_readable": "{ width }x{ height }", - "resolution_readable_sanitized": "{ %sanitize( %concat( %string( width ), \"x\", %string( height ) ) ) }", + "resolution_readable_sanitized": "{ %sanitize( %concat( width, \"x\", height ) ) }", "sibling_metadata": "{ %map_get_non_empty( entry_metadata, \"sibling_metadata\", [ ] ) }", "sibling_metadata_sanitized": "{ %sanitize( sibling_metadata ) }", "source_count": "{ %map_get_non_empty( playlist_metadata, \"playlist_count\", 1 ) }", @@ -194,9 +194,9 @@ "track_date": "{ upload_date_standardized }", "track_date_sanitized": "{ %sanitize( upload_date_standardized ) }", "track_file_name": "{ playlist_index_padded } - { %sanitize( title ) }.{ ext }", - "track_file_name_sanitized": "{ %sanitize( %concat( %string( playlist_index_padded ), \" - \", %string( %sanitize( title ) ), \".\", %string( ext ) ) ) }", - "track_full_path": "Lester Young/{ %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) }/{ %concat( %string( playlist_index_padded ), \" - \", %string( %sanitize( title ) ), \".\", %string( ext ) ) }", - "track_full_path_sanitized": "{ %sanitize( %concat( \"Lester Young\", \"/\", %string( %concat( \"[\", %string( playlist_max_upload_year ), \"] \", %string( %sanitize( playlist_title ) ) ) ), \"/\", %string( %concat( %string( playlist_index_padded ), \" - \", %string( %sanitize( title ) ), \".\", %string( ext ) ) ) ) ) }", + "track_file_name_sanitized": "{ %sanitize( %concat( playlist_index_padded, \" - \", %sanitize( title ), \".\", ext ) ) }", + "track_full_path": "{ artist_dir }/{ %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ) }/{ %concat( playlist_index_padded, \" - \", %sanitize( title ), \".\", ext ) }", + "track_full_path_sanitized": "{ %sanitize( %concat( artist_dir, \"/\", %concat( \"[\", playlist_max_upload_year, \"] \", %sanitize( playlist_title ) ), \"/\", %concat( playlist_index_padded, \" - \", %sanitize( title ), \".\", ext ) ) ) }", "track_genre": "Jazz", "track_genre_default": "Unset", "track_genre_default_sanitized": "Unset", diff --git a/tests/resources/expected_json/music_video/inspect_full_variables.json b/tests/resources/expected_json/music_video/inspect_full_variables.json index 34dc4392..d1231e9d 100644 --- a/tests/resources/expected_json/music_video/inspect_full_variables.json +++ b/tests/resources/expected_json/music_video/inspect_full_variables.json @@ -70,7 +70,7 @@ "music_video_directory": "tv_show_directory_path", "music_video_directory_sanitized": "tv_show_directory_path", "music_video_file_name": "Rick Astley/{ %sanitize( %get_url_field( \"title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) }", - "music_video_file_name_sanitized": "{ %sanitize( %concat( \"Rick Astley\", \"/\", %string( %sanitize( %get_url_field( \"title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ), '' ) ) }", + "music_video_file_name_sanitized": "{ %sanitize( %concat( \"Rick Astley\", \"/\", %sanitize( %get_url_field( \"title\", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ), '' ) ) }", "music_video_file_name_suffix": "", "music_video_file_name_suffix_sanitized": "", "music_video_genre": "Pop", @@ -164,7 +164,7 @@ "resolution_assert_print_sanitized": "true", "resolution_assert_sanitized": "{ %sanitize( %if( %and( enable_resolution_assert, %ne( height, 0 ), %not( resolution_assert_is_ignored ) ), %assert( %gte( height, resolution_assert_height_gte ), %concat( \"Entry \", title, \" downloaded at a low resolution (\", resolution_readable, \"), you've probably been throttled. \", \"Stopping further downloads, wait a few hours and try again. \", \"Disable using the override variable `enable_resolution_assert: False`.\" ) ), \"false is no-op\" ) ) }", "resolution_readable": "{ %map_get_non_empty( entry_metadata, \"width\", 0 ) }x{ %map_get_non_empty( entry_metadata, \"height\", 0 ) }", - "resolution_readable_sanitized": "{ %sanitize( %concat( %string( %map_get_non_empty( entry_metadata, \"width\", 0 ) ), \"x\", %string( %map_get_non_empty( entry_metadata, \"height\", 0 ) ) ) ) }", + "resolution_readable_sanitized": "{ %sanitize( %concat( %map_get_non_empty( entry_metadata, \"width\", 0 ), \"x\", %map_get_non_empty( entry_metadata, \"height\", 0 ) ) ) }", "sibling_metadata": "{ %map_get_non_empty( entry_metadata, \"sibling_metadata\", [ ] ) }", "sibling_metadata_sanitized": "{ %sanitize( sibling_metadata ) }", "source_count": "{ %map_get_non_empty( %map_get_non_empty( entry_metadata, \"playlist_metadata\", { } ), \"playlist_count\", 1 ) }", diff --git a/tests/resources/expected_json/music_video/inspect_variables.json b/tests/resources/expected_json/music_video/inspect_variables.json index 41606b71..7e4bc383 100644 --- a/tests/resources/expected_json/music_video/inspect_variables.json +++ b/tests/resources/expected_json/music_video/inspect_variables.json @@ -70,7 +70,7 @@ "music_video_directory": "tv_show_directory_path", "music_video_directory_sanitized": "tv_show_directory_path", "music_video_file_name": "Rick Astley/{ %sanitize( %get_url_field( \"title\", title ) ) }", - "music_video_file_name_sanitized": "{ %sanitize( %concat( \"Rick Astley\", \"/\", %string( %sanitize( %get_url_field( \"title\", title ) ) ), '' ) ) }", + "music_video_file_name_sanitized": "{ %sanitize( %concat( \"Rick Astley\", \"/\", %sanitize( %get_url_field( \"title\", title ) ), '' ) ) }", "music_video_file_name_suffix": "", "music_video_file_name_suffix_sanitized": "", "music_video_genre": "Pop", @@ -164,7 +164,7 @@ "resolution_assert_print_sanitized": "true", "resolution_assert_sanitized": "{ %sanitize( %if( %and( enable_resolution_assert, %ne( height, 0 ), %not( resolution_assert_is_ignored ) ), %assert( %gte( height, resolution_assert_height_gte ), %concat( \"Entry \", title, \" downloaded at a low resolution (\", resolution_readable, \"), you've probably been throttled. \", \"Stopping further downloads, wait a few hours and try again. \", \"Disable using the override variable `enable_resolution_assert: False`.\" ) ), \"false is no-op\" ) ) }", "resolution_readable": "{ width }x{ height }", - "resolution_readable_sanitized": "{ %sanitize( %concat( %string( width ), \"x\", %string( height ) ) ) }", + "resolution_readable_sanitized": "{ %sanitize( %concat( width, \"x\", height ) ) }", "sibling_metadata": "{ %map_get_non_empty( entry_metadata, \"sibling_metadata\", [ ] ) }", "sibling_metadata_sanitized": "{ %sanitize( sibling_metadata ) }", "source_count": "{ %map_get_non_empty( playlist_metadata, \"playlist_count\", 1 ) }", diff --git a/tests/resources/expected_json/tv_show/inspect_full_overrides.json b/tests/resources/expected_json/tv_show/inspect_full_overrides.json index 179d4e11..4d17acd4 100644 --- a/tests/resources/expected_json/tv_show/inspect_full_overrides.json +++ b/tests/resources/expected_json/tv_show/inspect_full_overrides.json @@ -8,12 +8,12 @@ "episode_content_rating": "TV-14", "episode_date_standardized": "{ %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) }", "episode_file_name": "s{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }.e{ %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) } - { %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }", - "episode_file_path": "{ %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) }/{ %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }", + "episode_file_path": "{ %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) }/{ %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }", "episode_number": "{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ) }{ %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) }{ upload_date_index_padded }", "episode_number_and_padded_": "{ [ %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ), 6 ] }", "episode_number_padded": "{ %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) }", "episode_plot": "{ %map_get( entry_metadata, \"webpage_url\" ) }\n\n{ %map_get_non_empty( entry_metadata, \"description\", '' ) }", - "episode_title": "{ %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) } - { %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) }", + "episode_title": "{ %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) } - { %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) }", "episode_year": "{ %slice( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ), 0, 4 ) }", "file_title": "{ %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }", "file_uid": "{ %sanitize_plex_episode( %map_get( entry_metadata, \"id\" ) ) }", @@ -32,13 +32,13 @@ "season_directory_name": "Season { %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }", "season_number": "{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }", "season_number_padded": "{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }", - "season_poster_file_name": "{ %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) }/Season{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }.jpg", + "season_poster_file_name": "{ %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) }/Season{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }.jpg", "subscription_array": "{ [ \"https://www.youtube.com/@novapbs\" ] }", "subscription_indent_1": "Documentaries", "subscription_indent_2": "TV-14", "subscription_value": "https://www.youtube.com/@novapbs", "subscription_value_1": "https://www.youtube.com/@novapbs", - "thumbnail_file_name": "{ %concat( %string( %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ) ) }-thumb.jpg", + "thumbnail_file_name": "{ %concat( %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ), \"/\", %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }-thumb.jpg", "tv_show_by_date_episode_ordering": "upload-month-day", "tv_show_by_date_ordering_pair_validation_": "{ [ %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ), 6 ] }", "tv_show_by_date_season_ordering": "upload-year", diff --git a/tests/resources/expected_json/tv_show/inspect_full_variables.json b/tests/resources/expected_json/tv_show/inspect_full_variables.json index bfb834bf..4e22fa86 100644 --- a/tests/resources/expected_json/tv_show/inspect_full_variables.json +++ b/tests/resources/expected_json/tv_show/inspect_full_variables.json @@ -36,9 +36,9 @@ "episode_date_standardized": "{ %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) }", "episode_date_standardized_sanitized": "{ %sanitize( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) ) }", "episode_file_name": "s{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }.e{ %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) } - { %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }", - "episode_file_name_sanitized": "{ %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }", - "episode_file_path": "{ %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) }/{ %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }", - "episode_file_path_sanitized": "{ %sanitize( %concat( %string( %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ) ) ) }", + "episode_file_name_sanitized": "{ %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }", + "episode_file_path": "{ %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) }/{ %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }", + "episode_file_path_sanitized": "{ %sanitize( %concat( %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ), \"/\", %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ) }", "episode_number": "{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ) }{ %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) }{ upload_date_index_padded }", "episode_number_and_padded_": "{ [ %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ), 6 ] }", "episode_number_and_padded__sanitized": "{ %sanitize( [ %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ), 6 ] ) }", @@ -46,9 +46,9 @@ "episode_number_padded_sanitized": "{ %sanitize( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ) }", "episode_number_sanitized": "{ %sanitize( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ) }", "episode_plot": "{ %map_get( entry_metadata, \"webpage_url\" ) }\n\n{ %map_get_non_empty( entry_metadata, \"description\", '' ) }", - "episode_plot_sanitized": "{ %sanitize( %concat( %string( %map_get( entry_metadata, \"webpage_url\" ) ), \"\n\n\", %string( %map_get_non_empty( entry_metadata, \"description\", '' ) ) ) ) }", - "episode_title": "{ %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) } - { %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) }", - "episode_title_sanitized": "{ %sanitize( %concat( %string( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ) ), \" - \", %string( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) }", + "episode_plot_sanitized": "{ %sanitize( %concat( %map_get( entry_metadata, \"webpage_url\" ), \"\n\n\", %map_get_non_empty( entry_metadata, \"description\", '' ) ) ) }", + "episode_title": "{ %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) } - { %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) }", + "episode_title_sanitized": "{ %sanitize( %concat( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ), \" - \", %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) }", "episode_year": "{ %slice( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ), 0, 4 ) }", "episode_year_sanitized": "{ %sanitize( %slice( %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"date_standardized\" ) ), 0, 4 ) ) }", "epoch": "{ %map_get( entry_metadata, \"epoch\" ) }", @@ -164,19 +164,19 @@ "resolution_assert_print_sanitized": "true", "resolution_assert_sanitized": "{ %sanitize( %if( %and( enable_resolution_assert, %ne( height, 0 ), %not( resolution_assert_is_ignored ) ), %assert( %gte( height, resolution_assert_height_gte ), %concat( \"Entry \", title, \" downloaded at a low resolution (\", resolution_readable, \"), you've probably been throttled. \", \"Stopping further downloads, wait a few hours and try again. \", \"Disable using the override variable `enable_resolution_assert: False`.\" ) ), \"false is no-op\" ) ) }", "resolution_readable": "{ %map_get_non_empty( entry_metadata, \"width\", 0 ) }x{ %map_get_non_empty( entry_metadata, \"height\", 0 ) }", - "resolution_readable_sanitized": "{ %sanitize( %concat( %string( %map_get_non_empty( entry_metadata, \"width\", 0 ) ), \"x\", %string( %map_get_non_empty( entry_metadata, \"height\", 0 ) ) ) ) }", + "resolution_readable_sanitized": "{ %sanitize( %concat( %map_get_non_empty( entry_metadata, \"width\", 0 ), \"x\", %map_get_non_empty( entry_metadata, \"height\", 0 ) ) ) }", "s01_name": "", "s01_name_sanitized": "", "s01_url": "", "s01_url_sanitized": "", "season_directory_name": "Season { %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }", - "season_directory_name_sanitized": "{ %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) }", + "season_directory_name_sanitized": "{ %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) }", "season_number": "{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }", "season_number_padded": "{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }", "season_number_padded_sanitized": "{ %sanitize( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) }", "season_number_sanitized": "{ %sanitize( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) }", - "season_poster_file_name": "{ %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) }/Season{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }.jpg", - "season_poster_file_name_sanitized": "{ %sanitize( %concat( %string( %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) ), \"/Season\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".jpg\" ) ) }", + "season_poster_file_name": "{ %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) }/Season{ %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) }.jpg", + "season_poster_file_name_sanitized": "{ %sanitize( %concat( %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ), \"/Season\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".jpg\" ) ) }", "sibling_metadata": "{ %map_get_non_empty( entry_metadata, \"sibling_metadata\", [ ] ) }", "sibling_metadata_sanitized": "{ %sanitize( sibling_metadata ) }", "source_count": "{ %map_get_non_empty( %map_get_non_empty( entry_metadata, \"playlist_metadata\", { } ), \"playlist_count\", 1 ) }", @@ -219,8 +219,8 @@ "subscription_value_sanitized": "https\uff1a\u29f8\u29f8www.youtube.com\u29f8@novapbs", "thumbnail_ext": "jpg", "thumbnail_ext_sanitized": "jpg", - "thumbnail_file_name": "{ %concat( %string( %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ) ) }-thumb.jpg", - "thumbnail_file_name_sanitized": "{ %sanitize( %concat( %string( %concat( %string( %sanitize( %concat( \"Season \", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ), \".e\", %string( %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ) ), \" - \", %string( %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) ) ) ), \"-thumb.jpg\" ) ) }", + "thumbnail_file_name": "{ %concat( %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ), \"/\", %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ) }-thumb.jpg", + "thumbnail_file_name_sanitized": "{ %sanitize( %concat( %concat( %sanitize( %concat( \"Season \", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ) ) ), \"/\", %sanitize( %concat( \"s\", %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"year\" ) ), \".e\", %pad_zero( %int( %concat( %int( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"month\" ) ), %string( %map_get( %to_date_metadata( %map_get_non_empty( entry_metadata, \"upload_date\", %datetime_strftime( %map_get( entry_metadata, \"epoch\" ), \"%Y%m%d\" ) ) ), \"day_padded\" ) ), upload_date_index_padded ) ), 6 ), \" - \", %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) ) ) ), \"-thumb.jpg\" ) ) }", "title": "{ %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) }", "title_sanitized": "{ %sanitize( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }", "title_sanitized_plex": "{ %sanitize_plex_episode( %map_get_non_empty( entry_metadata, \"title\", %map_get( entry_metadata, \"id\" ) ) ) }", diff --git a/tests/resources/expected_json/tv_show/inspect_overrides.json b/tests/resources/expected_json/tv_show/inspect_overrides.json index faf71281..93916b4d 100644 --- a/tests/resources/expected_json/tv_show/inspect_overrides.json +++ b/tests/resources/expected_json/tv_show/inspect_overrides.json @@ -8,7 +8,7 @@ "episode_content_rating": "TV-14", "episode_date_standardized": "{ upload_date_standardized }", "episode_file_name": "s{ upload_year }.e{ %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) } - { title_sanitized_plex }", - "episode_file_path": "{ %sanitize( %concat( \"Season \", %string( upload_year ) ) ) }/{ %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) }", + "episode_file_path": "{ %sanitize( %concat( \"Season \", upload_year ) ) }/{ %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) }", "episode_number": "{ upload_month }{ upload_day_padded }{ upload_date_index_padded }", "episode_number_and_padded_": "{ [ %concat( upload_month, upload_day_padded, upload_date_index_padded ), 6 ] }", "episode_number_padded": "{ %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) }", @@ -32,13 +32,13 @@ "season_directory_name": "Season { upload_year }", "season_number": "{ upload_year }", "season_number_padded": "{ upload_year }", - "season_poster_file_name": "{ %sanitize( %concat( \"Season \", %string( upload_year ) ) ) }/Season{ upload_year }.jpg", + "season_poster_file_name": "{ %sanitize( %concat( \"Season \", upload_year ) ) }/Season{ upload_year }.jpg", "subscription_array": "{ [ \"https://www.youtube.com/@novapbs\" ] }", "subscription_indent_1": "Documentaries", "subscription_indent_2": "TV-14", "subscription_value": "https://www.youtube.com/@novapbs", "subscription_value_1": "https://www.youtube.com/@novapbs", - "thumbnail_file_name": "{ %concat( %string( %sanitize( %concat( \"Season \", %string( upload_year ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) ) ) }-thumb.jpg", + "thumbnail_file_name": "{ %concat( %sanitize( %concat( \"Season \", upload_year ) ), \"/\", %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) ) }-thumb.jpg", "tv_show_by_date_episode_ordering": "upload-month-day", "tv_show_by_date_ordering_pair_validation_": "{ [ %concat( upload_month, upload_day_padded, upload_date_index_padded ), 6 ] }", "tv_show_by_date_season_ordering": "upload-year", diff --git a/tests/resources/expected_json/tv_show/inspect_variables.json b/tests/resources/expected_json/tv_show/inspect_variables.json index 77659a4b..f3159ff9 100644 --- a/tests/resources/expected_json/tv_show/inspect_variables.json +++ b/tests/resources/expected_json/tv_show/inspect_variables.json @@ -36,9 +36,9 @@ "episode_date_standardized": "{ upload_date_standardized }", "episode_date_standardized_sanitized": "{ %sanitize( upload_date_standardized ) }", "episode_file_name": "s{ upload_year }.e{ %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) } - { title_sanitized_plex }", - "episode_file_name_sanitized": "{ %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) }", - "episode_file_path": "{ %sanitize( %concat( \"Season \", %string( upload_year ) ) ) }/{ %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) }", - "episode_file_path_sanitized": "{ %sanitize( %concat( %string( %sanitize( %concat( \"Season \", %string( upload_year ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) ) ) ) }", + "episode_file_name_sanitized": "{ %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) }", + "episode_file_path": "{ %sanitize( %concat( \"Season \", upload_year ) ) }/{ %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) }", + "episode_file_path_sanitized": "{ %sanitize( %concat( %sanitize( %concat( \"Season \", upload_year ) ), \"/\", %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) ) ) }", "episode_number": "{ upload_month }{ upload_day_padded }{ upload_date_index_padded }", "episode_number_and_padded_": "{ [ %concat( upload_month, upload_day_padded, upload_date_index_padded ), 6 ] }", "episode_number_and_padded__sanitized": "{ %sanitize( [ %concat( upload_month, upload_day_padded, upload_date_index_padded ), 6 ] ) }", @@ -46,9 +46,9 @@ "episode_number_padded_sanitized": "{ %sanitize( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ) }", "episode_number_sanitized": "{ %sanitize( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ) }", "episode_plot": "{ webpage_url }\n\n{ description }", - "episode_plot_sanitized": "{ %sanitize( %concat( %string( webpage_url ), \"\n\n\", %string( description ) ) ) }", + "episode_plot_sanitized": "{ %sanitize( %concat( webpage_url, \"\n\n\", description ) ) }", "episode_title": "{ upload_date_standardized } - { title }", - "episode_title_sanitized": "{ %sanitize( %concat( %string( upload_date_standardized ), \" - \", %string( title ) ) ) }", + "episode_title_sanitized": "{ %sanitize( %concat( upload_date_standardized, \" - \", title ) ) }", "episode_year": "{ %slice( upload_date_standardized, 0, 4 ) }", "episode_year_sanitized": "{ %sanitize( %slice( upload_date_standardized, 0, 4 ) ) }", "epoch": "{ %map_get( entry_metadata, \"epoch\" ) }", @@ -164,19 +164,19 @@ "resolution_assert_print_sanitized": "true", "resolution_assert_sanitized": "{ %sanitize( %if( %and( enable_resolution_assert, %ne( height, 0 ), %not( resolution_assert_is_ignored ) ), %assert( %gte( height, resolution_assert_height_gte ), %concat( \"Entry \", title, \" downloaded at a low resolution (\", resolution_readable, \"), you've probably been throttled. \", \"Stopping further downloads, wait a few hours and try again. \", \"Disable using the override variable `enable_resolution_assert: False`.\" ) ), \"false is no-op\" ) ) }", "resolution_readable": "{ width }x{ height }", - "resolution_readable_sanitized": "{ %sanitize( %concat( %string( width ), \"x\", %string( height ) ) ) }", + "resolution_readable_sanitized": "{ %sanitize( %concat( width, \"x\", height ) ) }", "s01_name": "", "s01_name_sanitized": "", "s01_url": "", "s01_url_sanitized": "", "season_directory_name": "Season { upload_year }", - "season_directory_name_sanitized": "{ %sanitize( %concat( \"Season \", %string( upload_year ) ) ) }", + "season_directory_name_sanitized": "{ %sanitize( %concat( \"Season \", upload_year ) ) }", "season_number": "{ upload_year }", "season_number_padded": "{ upload_year }", "season_number_padded_sanitized": "{ %sanitize( upload_year ) }", "season_number_sanitized": "{ %sanitize( upload_year ) }", - "season_poster_file_name": "{ %sanitize( %concat( \"Season \", %string( upload_year ) ) ) }/Season{ upload_year }.jpg", - "season_poster_file_name_sanitized": "{ %sanitize( %concat( %string( %sanitize( %concat( \"Season \", %string( upload_year ) ) ) ), \"/Season\", %string( upload_year ), \".jpg\" ) ) }", + "season_poster_file_name": "{ %sanitize( %concat( \"Season \", upload_year ) ) }/Season{ upload_year }.jpg", + "season_poster_file_name_sanitized": "{ %sanitize( %concat( %sanitize( %concat( \"Season \", upload_year ) ), \"/Season\", upload_year, \".jpg\" ) ) }", "sibling_metadata": "{ %map_get_non_empty( entry_metadata, \"sibling_metadata\", [ ] ) }", "sibling_metadata_sanitized": "{ %sanitize( sibling_metadata ) }", "source_count": "{ %map_get_non_empty( playlist_metadata, \"playlist_count\", 1 ) }", @@ -219,8 +219,8 @@ "subscription_value_sanitized": "https\uff1a\u29f8\u29f8www.youtube.com\u29f8@novapbs", "thumbnail_ext": "jpg", "thumbnail_ext_sanitized": "jpg", - "thumbnail_file_name": "{ %concat( %string( %sanitize( %concat( \"Season \", %string( upload_year ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) ) ) }-thumb.jpg", - "thumbnail_file_name_sanitized": "{ %sanitize( %concat( %string( %concat( %string( %sanitize( %concat( \"Season \", %string( upload_year ) ) ) ), \"/\", %string( %sanitize( %concat( \"s\", %string( upload_year ), \".e\", %string( %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ) ), \" - \", %string( title_sanitized_plex ) ) ) ) ) ), \"-thumb.jpg\" ) ) }", + "thumbnail_file_name": "{ %concat( %sanitize( %concat( \"Season \", upload_year ) ), \"/\", %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) ) }-thumb.jpg", + "thumbnail_file_name_sanitized": "{ %sanitize( %concat( %concat( %sanitize( %concat( \"Season \", upload_year ) ), \"/\", %sanitize( %concat( \"s\", upload_year, \".e\", %pad_zero( %int( %concat( upload_month, upload_day_padded, upload_date_index_padded ) ), 6 ), \" - \", title_sanitized_plex ) ) ), \"-thumb.jpg\" ) ) }", "title": "{ %map_get_non_empty( entry_metadata, \"title\", uid ) }", "title_sanitized": "{ %sanitize( title ) }", "title_sanitized_plex": "{ %sanitize_plex_episode( title ) }", diff --git a/tests/unit/utils/test_script_utils.py b/tests/unit/utils/test_script_utils.py index 608066b5..792020ba 100644 --- a/tests/unit/utils/test_script_utils.py +++ b/tests/unit/utils/test_script_utils.py @@ -81,9 +81,9 @@ class TestScriptUtils: String(value="static_a"): BuiltInFunction( name="concat", args=[ - BuiltInFunction(name="string", args=[String(value="string with ")]), - BuiltInFunction(name="string", args=[Variable(name="var_c")]), - BuiltInFunction(name="string", args=[String(value=" in it")]), + String(value="string with "), + Variable(name="var_c"), + String(value=" in it"), ], ), String(value="quotes"): String(value="has '' and \"\""), diff --git a/tests/unit/validators/test_string_formatter_validator.py b/tests/unit/validators/test_string_formatter_validator.py index 9bb4d1e0..888dc58d 100644 --- a/tests/unit/validators/test_string_formatter_validator.py +++ b/tests/unit/validators/test_string_formatter_validator.py @@ -115,12 +115,12 @@ class TestUnstructuredDictFormatterValidator(object): assert len(validator.dict) == 8 assert all(isinstance(val, expected_formatter_class) for val in validator.dict.values()) assert validator.dict_with_format_strings == { - "key1": '{ %concat( %string( "string with " ), %string( variable ) ) }', + "key1": '{ %concat( "string with ", variable ) }', "key2": "no variables", "key3": "{ %int(3) }", "key4": "{ %float(4.132) }", "key5": "{ %bool(True) }", - "key6": '{ { %concat( %string( variable ), %string( "_key" ) ): "value", "static_key": %concat( %string( variable ), %string( "_value" ) ) } }', - "key7": '{ [ "list_1", %concat( %string( "list_" ), %string( variable_2 ) ) ] }', - "key8": '{ %concat( %string( "string " ), %string( variable1 ), %string( " with multiple " ), %string( variable2 ) ) }', + "key6": '{ { %concat( variable, "_key" ): "value", "static_key": %concat( variable, "_value" ) } }', + "key7": '{ [ "list_1", %concat( "list_", variable_2 ) ] }', + "key8": '{ %concat( "string ", variable1, " with multiple ", variable2 ) }', }