From bc839936a6bd5d975d1db0eafcd3321559f97da5 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Wed, 28 Sep 2022 19:08:35 -0700 Subject: [PATCH] [WIP] Prebuilt presets --- src/ytdl_sub/prebuilt_presets/__init__.py | 0 .../prebuilt_presets/helpers/kodi-safe.yaml | 5 + .../helpers/video_players.yaml | 14 ++ .../music_videos/jellyfin-music-videos.yaml | 6 + .../music_videos/kodi-music-videos.yaml | 30 +++ .../tv_show/download_strategy.yaml | 38 +++ .../prebuilt_presets/tv_show/episode.yaml | 71 ++++++ .../tv_show/jellyfin-tv-show.yaml | 220 ++++++++++++++++++ 8 files changed, 384 insertions(+) create mode 100644 src/ytdl_sub/prebuilt_presets/__init__.py create mode 100644 src/ytdl_sub/prebuilt_presets/helpers/kodi-safe.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/helpers/video_players.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music_videos/jellyfin-music-videos.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/music_videos/kodi-music-videos.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/tv_show/download_strategy.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml create mode 100644 src/ytdl_sub/prebuilt_presets/tv_show/jellyfin-tv-show.yaml diff --git a/src/ytdl_sub/prebuilt_presets/__init__.py b/src/ytdl_sub/prebuilt_presets/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/ytdl_sub/prebuilt_presets/helpers/kodi-safe.yaml b/src/ytdl_sub/prebuilt_presets/helpers/kodi-safe.yaml new file mode 100644 index 00000000..eb0801f7 --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/helpers/kodi-safe.yaml @@ -0,0 +1,5 @@ +presets: + + kodi-safe: + nfo_tags: + kodi_safe: True diff --git a/src/ytdl_sub/prebuilt_presets/helpers/video_players.yaml b/src/ytdl_sub/prebuilt_presets/helpers/video_players.yaml new file mode 100644 index 00000000..ab59d69b --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/helpers/video_players.yaml @@ -0,0 +1,14 @@ +presets: + + plex: + overrides: + season_poster_prefix: "" + + jellyfin: + overrides: + poster_file_name: "poster" + season_poster_prefix: "-poster" + + kodi: + presets: + - "jellyfin" diff --git a/src/ytdl_sub/prebuilt_presets/music_videos/jellyfin-music-videos.yaml b/src/ytdl_sub/prebuilt_presets/music_videos/jellyfin-music-videos.yaml new file mode 100644 index 00000000..a15000f0 --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music_videos/jellyfin-music-videos.yaml @@ -0,0 +1,6 @@ +presets: + + kodi-music-videos: + presets: + - "jellyfin-music-videos" + - "kodi-safe" diff --git a/src/ytdl_sub/prebuilt_presets/music_videos/kodi-music-videos.yaml b/src/ytdl_sub/prebuilt_presets/music_videos/kodi-music-videos.yaml new file mode 100644 index 00000000..84623470 --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/music_videos/kodi-music-videos.yaml @@ -0,0 +1,30 @@ +presets: + + kodi_music_video: + generic: + download_strategy: "source" + music_video_url: "{music_video_url}" + + output_options: + output_directory: "{music_video_directory}" + file_name: "{music_video_file_name}.{ext}" + thumbnail_name: "{music_video_file_name}-thumb.jpg" + + nfo_tags: + nfo_name: "{music_video_name}.nfo" + nfo_root: "musicvideo" + kodi_safe: True + tags: + artist: "{music_video_artist}" + title: "{music_video_title}" + album: "{music_video_album}" + year: "{music_video_year}" + + overrides: +# MUST DEFINE: +# music_video_artist +# music_video_directory + music_video_title: "{title}" + music_video_album: "Music Videos" + music_video_year: "{upload_year}" + music_video_file_name: "{artist_sanitized}/{music_video_year} - {music_video_title_sanitized}" diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/download_strategy.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/download_strategy.yaml new file mode 100644 index 00000000..622409ad --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/tv_show/download_strategy.yaml @@ -0,0 +1,38 @@ +presets: + + tv-show-url: + generic: + download_strategy: "source" + url: "{url}" + playlist_thumbnails: + - name: "{poster_file_name}" + uid: "latest_entry" + +#################################################################################################### + + tv-show-youtube-channel: + generic: + download_strategy: "source" + url: "{url}" + playlist_thumbnails: + - name: "{poster_file_name}" + uid: "avatar_uncropped" + - name: "{fanart_file_name}" + uid: "banner_uncropped" + +#################################################################################################### + + tv-show-collection-youtube-channel-season: + generic: + download_strategy: "collection" + urls: + - url: "{youtube_channel_url}" + playlist_thumbnails: + - name: "{season_number_padded}{season_poster_prefix}.jpg" + uid: "latest_entry" + - name: "{poster_file_name}" + uid: "avatar_uncropped" + - name: "{fanart_file_name}" + uid: "banner_uncropped" + + overrides: \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml new file mode 100644 index 00000000..2232a8bc --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/tv_show/episode.yaml @@ -0,0 +1,71 @@ +presets: + +#################################################################################################### + + episode-base: + output_options: + output_directory: "{tv_show_directory}/{tv_show_name_sanitized}" + file_name: "{episode_file_path}.{ext}" + thumbnail_name: "{episode_file_path}-thumb.jpg" + maintain_download_archive: True + + chapters: + embed_chapters: True + + overrides: +# MUST DEFINE: +# tv_show_directory +# tv_show_name +# season_number +# season_number_padded +# episode_number +# episode_number_padded + season_title: "{season_number_padded}" + episode_title: "{upload_date_standardized} - {title}" + episode_file_name: "s{season_number_padded}.e{episode_number_padded} - {uid_sanitized}" + episode_file_path: "Season {season_number_padded}/{episode_file_name}" + +#################################################################################################### + + episode-nfo: + presets: + - "episode-base" + + nfo_tags: + nfo_name: "{episode_file_path}.nfo" + nfo_root: "episodedetails" + tags: + season: "{season_number}" + episode: "{episode_number}" + title: "{episode_title}" + plot: "{episode_plot}" + year: "{episode_year}" + aired: "{episode_air_date_standardized}" + + output_directory_nfo_tags: + nfo_name: "tvshow.nfo" + nfo_root: "tvshow" + tags: + title: "{tv_show_name}" + + overrides: + episode_plot: "{webpage_url}" + episode_year: "{upload_year}" + episode_air_date_standardized: "{upload_date_standardized}" + +#################################################################################################### + + season-by-year: + overrides: + season_number: "{upload_year}" + season_number_padded: "{upload_year}" + + episode-by-day: + overrides: + episode_number: "{upload_month}{upload_day_padded}" + episode_number_padded: "{upload_month_padded}{upload_day_padded}" + + episode-by-day-reversed: + overrides: + episode_number: "{upload_day_of_year_reversed}" + episode_number_padded: "{upload_day_of_year_reversed_padded}" \ No newline at end of file diff --git a/src/ytdl_sub/prebuilt_presets/tv_show/jellyfin-tv-show.yaml b/src/ytdl_sub/prebuilt_presets/tv_show/jellyfin-tv-show.yaml new file mode 100644 index 00000000..52c9358b --- /dev/null +++ b/src/ytdl_sub/prebuilt_presets/tv_show/jellyfin-tv-show.yaml @@ -0,0 +1,220 @@ +presets: + + ############################################################################### + # Single video as an episode + jellyfin-episode: + output_options: + output_directory: "{tv_shows_directory}/{tv_show_name_sanitized}" + file_name: "{episode_file_path}.{ext}" + thumbnail_name: "{episode_file_path}-thumb.jpg" + info_json_name: "{episode_file_path}.{info_json_ext}" + maintain_download_archive: True + + nfo_tags: + nfo_name: "{episode_file_path}.nfo" + nfo_root: "episodedetails" + kodi_safe: True + tags: + season: "{season_number}" + episode: "{episode_number}" + title: "{episode_title}" + year: "{episode_year}" + plot: "{episode_plot}" + aired: "{episode_air_date_standardized}" + + chapters: + embed_chapters: True + + overrides: +# MUST DEFINE: +# tv_shows_directory +# tv_show_name +# season_number +# season_number_padded +# episode_number +# episode_number_padded + season_title: "{season_number_padded}" + episode_title: "{upload_date_standardized} - {title}" + episode_file_name: "s{season_number_padded}.e{episode_number_padded} - {uid_sanitized}" + episode_file_path: "Season {season_number_padded}/{episode_file_name}" + + + ############################################################################### + # Create a TV show from a youtube playlist or channel + yt_show: + preset: "yt_episode" + output_directory_nfo_tags: + nfo_name: "tvshow.nfo" + nfo_root: "tvshow" + kodi_safe: True + tags: + title: "{show_name}" + namedseason: + - tag: "{season_name}" + attributes: + number: "{season}" + genre: "{genre}" + + ############################################################################### + # Entire channel as a TV show + yt_channel: + preset: "yt_show" + youtube: + download_strategy: "channel" + channel_avatar_path: "poster.jpg" + channel_banner_path: "fanart.jpg" + + ############################################################################### + # Playlist as a TV show + yt_playlist: + preset: "yt_show" + youtube: + download_strategy: "playlist" + + + ############################################################################### + # Entire channel as a TV show + + ############################################################################### + # Only store recent videos in the last {time_to_live} timespan. + # Defaults to 2 months + only_recent: + ytdl_options: + break_on_reject: True + output_options: + keep_files_after: "today-{time_to_live}" + date_range: + after: "today-{time_to_live}" + overrides: + time_to_live: "2months" + + ############################################################################### + # For channels/playlists/etc with known sponsor content. + # Wait 2 days after upload for sponsorblock submissions, then cut it out. + sponsor_block: + date_range: + before: "today-2days" + + chapters: + sponsorblock_categories: + - "outro" + - "selfpromo" + - "preview" + - "interaction" + - "sponsor" + - "music_offtopic" + - "intro" + remove_sponsorblock_categories: "all" + force_key_frames: False + + ############################################################################### + # Genres + genre_music: + overrides: + genre: "Music" + genre_news: + overrides: + genre: "News" + genre_finance: + overrides: + genre: "Finance" + genre_podcast: + overrides: + genre: "Podcast" + genre_cooking: + overrides: + genre: "Cooking" + genre_gaming: + overrides: + genre: "Gaming" + + ############################################################################### + # Other + include_description: + nfo_tags: + tags: + plot: "{webpage_url}\n\n{description}" + + ############################################################################### + # Other + yt_collection: + preset: "yt_show" + generic: + download_strategy: "collection" + urls: + - url: "{channel_url}" + variables: + url_season_name: "{channel_season_name}" + url_season_index: "{channel_season_index}" + playlist_thumbnails: + - name: "season{channel_season_index}-poster.jpg" + uid: "latest_entry" + - name: "poster.jpg" + uid: "avatar_uncropped" + - name: "fanart.jpg" + uid: "banner_uncropped" + + output_directory_nfo_tags: + nfo_name: "tvshow.nfo" + nfo_root: "tvshow" + kodi_safe: True + tags: + namedseason: + - tag: "{channel_season_name}" + attributes: + number: "{channel_season_index}" + + overrides: + # Need to fill out channel_url + channel_season_name: "Videos" + channel_season_index: "1" + season: "{url_season_index}" + season_name: "{url_season_name}" + + yt_collection_p1: + preset: "yt_collection" + generic: + download_strategy: "collection" + urls: + - url: "{playlist1_url}" + variables: + url_season_name: "{playlist1_season_name}" + url_season_index: "{playlist1_season_index}" + playlist_thumbnails: + - name: "season{playlist1_season_index}-poster.jpg" + uid: "latest_entry" + + output_directory_nfo_tags: + tags: + namedseason: + - tag: "{playlist1_season_name}" + attributes: + number: "{playlist1_season_index}" + + overrides: + # Need channel_url, playlist1_url, playlist1_season_name + playlist1_season_index: "2" + + yt_collection_p2: + preset: "yt_collection_p1" + generic: + download_strategy: "collection" + urls: + - url: "{playlist2_url}" + variables: + url_season_name: "{playlist2_season_name}" + url_season_index: "{playlist2_season_index}" + playlist_thumbnails: + - name: "season{playlist2_season_index}-poster.jpg" + uid: "latest_entry" + + output_directory_nfo_tags: + tags: + namedseason: + - tag: "{playlist2_season_name}" + attributes: + number: "{playlist2_season_index}" + + overrides: + # Need channel_url, playlist1_url, playlist1_season_name, playlist2_url, playlist2_season_name + playlist2_season_index: "3"