From eb0b55d21e1b38286596bc9f4ff29932add5ff1b Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Sat, 28 Oct 2023 00:07:32 -0700 Subject: [PATCH] move advanced usage into subfolder --- examples/README.md | 16 ++- examples/advanced/tv_show_config.yaml | 105 +++++++++++++++++ examples/advanced/tv_show_subscriptions.yaml | 26 ++++ examples/tv_show_config.yaml | 118 ------------------- examples/tv_show_subscriptions.yaml | 48 +++++--- 5 files changed, 175 insertions(+), 138 deletions(-) create mode 100644 examples/advanced/tv_show_config.yaml create mode 100644 examples/advanced/tv_show_subscriptions.yaml delete mode 100644 examples/tv_show_config.yaml diff --git a/examples/README.md b/examples/README.md index b74a4d44..8b5ace4d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,7 +1,13 @@ # Example Configurations -This directory shows how you can use ytdl-sub for various use cases. These -are the configs I personally use and have incorporated as part of the e2e tests. +This directory shows how use ytdl-sub's built-in presets to start downloading immediately with no +configuration required. Simply run: -Each example has a `config.yaml` and `subscription.yaml`. The config defines -_how_ you format your media, whereas the subscription defines _what_ you -download plus some additional configuring if needed. \ No newline at end of file +### Unix +```commandline +ytdl-sub sub tv_show_subscriptions.yaml +``` + +### Windows +```commandline +./ytdl-sub.exe sub tv_show_subscriptions.yaml +``` \ No newline at end of file diff --git a/examples/advanced/tv_show_config.yaml b/examples/advanced/tv_show_config.yaml new file mode 100644 index 00000000..cd90d478 --- /dev/null +++ b/examples/advanced/tv_show_config.yaml @@ -0,0 +1,105 @@ +############################################################################### +# Top-level configurations to apply umask and persist error logs +configuration: + umask: "002" + persist_logs: + logs_directory: './logs' + keep_successful_logs: False + +presets: + + ############################################################################### + # Filter out any YouTube shorts + no_shorts: + match_filters: + filters: + - "original_url!*=/shorts/" + + ############################################################################### + # Remove all the following sponsorblock sections + sponsorblock: + chapters: + sponsorblock_categories: + - "outro" + - "selfpromo" + - "preview" + - "interaction" + - "sponsor" + - "music_offtopic" + - "intro" + remove_sponsorblock_categories: "all" + force_key_frames: False + + ############################################################################### + # Wait 2 days before downloading in hopes to get more accurate sponsorblock + sponsorblock_wait: + # Import the sponsorblock preset defined above + presets: + - "sponsorblock" + + date_range: + before: "today-2days" + + + ############################################################################### + # base preset to use on all TV Show-based subscriptions + base: + preset: + - "Kodi TV Show by Date" # Set intended player + - "best_video_quality" # prebuilt preset to get best quality + + # Embed chapters into video files + chapters: + embed_chapters: True + + # Embed English subtitles into video files (supports more) + subtitles: + embed_subtitles: True + languages: + - "en" + allow_auto_generated_subtitles: True + + # ytdl_options lets you pass any arg into yt-dlp's Python API + ytdl_options: + # Set the cookie file + cookiefile: "/config/youtube_cookies.txt" + + # For YouTube, get English metadata if multiple languages are present + extractor_args: + youtube: + lang: + - "en" + + # Set tv_show_directory in the preset + # instead of in the subscriptions file + overrides: + tv_show_directory: "/youtube" + + ############################################################################### + # Custom preset to archive an entire channel + TV Show Full Archive: + preset: + - "base" + - "sponsorblock_wait" # wait for sponsorblock when full-archiving + + ############################################################################### + # Custom preset to only fetch and keep recent videos. + # Format the videos in reverse order, so the first video is the most recent + TV Show Only Recent: + preset: + - "base" + - "sponsorblock" + - "no_shorts" + - "season_by_year__episode_by_month_day_reversed" + + # Only fetch videos after today minus date_range + date_range: + after: "today-{date_range}" + + # Only keep files uploaded after date_range + output_options: + keep_files_after: "today-{date_range}" + + # Set the default date_range to 2 months + overrides: + date_range: "2months" diff --git a/examples/advanced/tv_show_subscriptions.yaml b/examples/advanced/tv_show_subscriptions.yaml new file mode 100644 index 00000000..80212190 --- /dev/null +++ b/examples/advanced/tv_show_subscriptions.yaml @@ -0,0 +1,26 @@ +# Subscriptions using custom presets made in `tv_show_config.yaml` + +TV Show Full Archive: + = Documentaries | TV-PG: + "NOVA PBS": "https://www.youtube.com/@novapbs" + "National Geographic": "https://www.youtube.com/@NatGeo" + "Cosmos - What If": "https://www.youtube.com/playlist?list=PLZdXRHYAVxTJno6oFF9nLGuwXNGYHmE8U" + + = Kids | TV-Y: + "Jake Trains": "https://www.youtube.com/@JakeTrains" + "Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel" + + = Gardening | TV-Y: + "Gardening with Ciscoe": + # Can define a subscription using 'preset' syntax. Needed for adding multiple urls + overrides: + url: "https://www.youtube.com/@gardeningwithciscoe4430" + url2: "https://www.youtube.com/playlist?list=PLi8V8UemxeG6lo5if5H5g5EbsteELcb0_" + url3: "https://www.youtube.com/playlist?list=PLsJlQSR-KjmaQqqJ9jq18cF6XXXAR4kyn" + url4: "https://www.youtube.com/watch?v=2vq-vPubS5I" + +TV Show Only Recent: + = News | TV-14: + "BBC": "https://www.youtube.com/@BBCNews" + "Frontline PBS": "https://www.youtube.com/@frontline" + "Whitehouse": "https://www.bitchute.com/channel/zWsYVmCOu4JA/" # Supports non-YT sites \ No newline at end of file diff --git a/examples/tv_show_config.yaml b/examples/tv_show_config.yaml deleted file mode 100644 index 3843f2c8..00000000 --- a/examples/tv_show_config.yaml +++ /dev/null @@ -1,118 +0,0 @@ -# This config uses prebuilt presets included with ytdl-sub to download and format -# channels from YouTube or other sites supported by yt-dlp into a TV show for -# your favorite player. The directory format will look something like -# -# /tv_shows -# /Season 2021 -# s2021.e0317 - Pattys Day Video-thumb.jpg -# s2021.e0317 - Pattys Day Video.mp4 -# s2021.e0317 - Pattys Day Video.nfo -# /Season 2022 -# s2022.e1225 - Merry Christmas-thumb.jpg -# s2022.e1225 - Merry Christmas.mp4 -# s2022.e1225 - Merry Christmas.nfo -# poster.jpg -# fanart.jpg -# tvshow.nfo -# -# The idea is to use dates as numerics to represent season and episode numbers. -configuration: - working_directory: '.ytdl-sub-downloads' - -presets: - - # Your main TV show preset - all your tv show subscriptions will use this. - "TV Show Full Archive": - preset: - # Choose one of the following player types: - # - "kodi_tv_show_by_date" - # - "jellyfin_tv_show_by_date" - # - "plex_tv_show_by_date" - - - "kodi_tv_show_by_date" # replace with desired player type - - # Choose one of the following season/episode formats: - # - "season_by_year__episode_by_month_day" - # - "season_by_year_month__episode_by_day" - # - "season_by_year__episode_by_month_day_reversed" - # - "season_by_year__episode_by_download_index" - - - "season_by_year__episode_by_month_day" # replace with desired season/episode format - - # Include any of the presets listed below in your 'main preset' if you want - # it applied to every TV show. Or, use them on the individual subscriptions. - # - "add_subtitles" - # - "sponsorblock" - - # To download age-restricted videos, you will need to uncomment and set your cookie - # file here as a ytdl parameter. For more info, see - # https://ytdl-sub.readthedocs.io/en/latest/faq.html#download-age-restricted-youtube-videos - # - # ytdl_options: - # cookiefile: "/config/cookie_file.txt" # replace with actual cookie file path - - overrides: - tv_show_directory: "/tv_shows" # replace with path to tv show directory - # Fields in the prebuilt preset that can be changed: - # - # episode_title: "{upload_date_standardized} - {title}" - # episode_plot: "{webpage_url}" # source variable for the video description is {description} - -#################################################################################################### - - # A secondary TV Show preset that only keeps recent videos - "TV Show Only Recent": - - # Inherit the `TV Show Full Archive` preset - preset: - - "TV Show Full Archive" - - # Only download videos within the download_range - date_range: - after: "today-{download_range}" - - # Deletes any videos older than download_range. WARNING: do not use - # "season_by_year__episode_by_download_index" if you plan to delete older videos - output_options: - keep_files_after: "today-{download_range}" - - # Set the duration of download_range, defaults to 2 months - overrides: - download_range: "2months" - -#################################################################################################### - - # Preset to download subtitles (either by file or embedded) - add_subtitles: - subtitles: - # Embed subtitles into the video - embed_subtitles: True - # And/or download them as a file. Uncomment to download as file: - # subtitles_name: "{episode_file_path}.{lang}.{subtitles_ext}" - # subtitles_type: "srt" - - languages: - - "en" - allow_auto_generated_subtitles: True # allow auto subtitles - -#################################################################################################### - - # Preset to cut sponsor segments from videos - sponsorblock: - # If you download using cron, it is wise to add a delay before downloading ad-filled content to - # give folks time to submit sponsor segments. Uncomment to wait 2 days before download a video. - # date_range: - # before: "today-2days" - - chapters: - # Remove all of these sponsorblock categories - sponsorblock_categories: - - "intro" - - "outro" - - "selfpromo" - - "preview" - - "interaction" - - "sponsor" - - "music_offtopic" - remove_sponsorblock_categories: "all" - force_key_frames: False diff --git a/examples/tv_show_subscriptions.yaml b/examples/tv_show_subscriptions.yaml index 5c287227..5ab07362 100644 --- a/examples/tv_show_subscriptions.yaml +++ b/examples/tv_show_subscriptions.yaml @@ -1,24 +1,42 @@ -# Global overrides for all subscriptions. Can either be set here or in your config.yaml +# This example downloads the entirety of a channel (not limited to YouTube). +# Files will be stored in the form of: +# +# /tv_shows +# /Season 2021 +# s2021.e031701 - Pattys Day Video-thumb.jpg +# s2021.e031701 - Pattys Day Video.mp4 +# s2021.e031701 - Pattys Day Video.nfo +# s2021.e031702 - Second Pattys Day Video-thumb.jpg +# s2021.e031702 - Second Pattys Day Video.mp4 +# s2021.e031702 - Second Pattys Day Video.nfo +# /Season 2022 +# s2022.e122501 - Merry Christmas-thumb.jpg +# s2022.e122501 - Merry Christmas.mp4 +# s2022.e122501 - Merry Christmas.nfo +# poster.jpg +# fanart.jpg +# tvshow.nfo +# +# The idea is to use dates as numerics to represent season and episode numbers. + +# Overrides to the prebuilt presets __preset__: overrides: - tv_show_directory: "/tv_shows" # Root folder of ytdl-sub TV Shows - download_range: "2months" # Range to keep for only recent + tv_show_directory: "/tv_shows" # Root folder of all ytdl-sub TV Shows +# Choose the player you intend to use +# Jellyfin TV Show by Date: +# Kodi TV Show by Date: +Plex TV Show by Date: -# All subscriptions under this will use the `TV Show Full Archive` preset -TV Show Full Archive: - # Sets "Music" for genre - = Music: - "Rick A": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw" - "Opeth": "https://www.youtube.com/channel/UCmQSJTFZaXN85gYk6W3XbdQ" + # Sets genre tag to "Documentaries" + = Documentaries: + "NOVA PBS": "https://www.youtube.com/@novapbs" + "National Geographic": "https://www.youtube.com/@NatGeo" + "Cosmos - What If": "https://www.youtube.com/playlist?list=PLZdXRHYAVxTJno6oFF9nLGuwXNGYHmE8U" - # Sets "Kids" for genre, "TV-Y" for content rating + # Sets genre and content rating tag to "Kids" and "TV-Y" = Kids | TV-Y: "Jake Trains": "https://www.youtube.com/@JakeTrains" "Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel" - -# All subscriptions under this will use the `TV Show Only Recent` preset -TV Show Only Recent: - = News | TV-14: - "BBC": "https://www.youtube.com/@BBCNews"