diff --git a/config.yaml b/config.yaml index a75e7d95..19f57796 100644 --- a/config.yaml +++ b/config.yaml @@ -29,7 +29,6 @@ presets: music_videos: youtube: ytdl_options: - format: 'best' ignoreerrors: True output_options: file_name: "{sanitized_artist} - {sanitized_title}.{ext}" @@ -51,7 +50,6 @@ presets: channel_avatar_path: "poster.jpg" channel_banner_path: "fanart.jpg" ytdl_options: - format: 'best' ignoreerrors: True output_options: file_name: "{output_file_name}.{ext}" diff --git a/examples/kodi_tv_shows_config.yaml b/examples/kodi_tv_shows_config.yaml new file mode 100644 index 00000000..54244838 --- /dev/null +++ b/examples/kodi_tv_shows_config.yaml @@ -0,0 +1,80 @@ +# This example shows how to download and format an entire Youtube channel +# to display in Kodi as a TV show. The directory format will look like +# +# /path/to/youtube_tv_shows/My Favorite Youtube Channel +# /Season 2021 +# s2021.e0317 - St Pattys Day Video.jpg +# s2021.e0317 - St Pattys Day Video.mp4 +# s2021.e0317 - St Pattys Day Video.nfo +# /Season 2022 +# s2022.e1225 - Merry Christmas.jpg +# s2022.e1225 - Merry Christmas.mp4 +# s2022.e1225 - Merry Christmas.nfo +# poster.jpg +# fanart.jpg +# tvshow.nfo +# +# The idea is to use dates as the numeric to represent season and episode +# numbers. Once downloaded, it can immediately be recognized by Kodi. +presets: + yt_channel_as_tv: + # Youtube channels are our source/download strategy + # Use the channel avatar and banner images for Kodi + youtube: + download_strategy: "channel" + channel_avatar_path: "poster.jpg" + channel_banner_path: "fanart.jpg" + + # For advanced YTDL users only. + # It is wise to leave ignoreerrors=True to avoid errors for things + # like age-restricted videos in case you have not set your cookie. + ytdl_options: + ignoreerrors: True + + # For each video downloaded, set the file and thumbnail name here. + # We set both with {episode_name}, which is a variable we define in + # the overrides section further below to represent our date-like episode + # naming convention. Using override variables helps reduce copy-paste. + # + # Another field worth mentioning is maintain_download_archive=True. This + # is generally a good thing to enable with channels because it will + # store previously downloaded video ids to tell YTDL not to re-download + # them on a successive invocation. + output_options: + output_directory: "/path/to/youtube_tv_shows/{sanitized_tv_show_name}" + file_name: "{episode_name}.{ext}" + thumbnail_name: "{episode_name}.jpg" + maintain_download_archive: True + + # Always convert the video thumbnail to jpg + # TODO: always convert all thumbnails to jpg in code + convert_thumbnail: + to: "jpg" + + # For each video downloaded, add an episode NFO file for it. We give it + # the same date-like episode name using our {episode_name} variable, and + # populate the NFO with available video metadata that Kodi will recognize. + nfo_tags: + nfo_name: "{episode_name}.nfo" + nfo_root: "episodedetails" + tags: + title: "{title}" + season: "{upload_year}" + episode: "{upload_month}{upload_day_padded}" + plot: "{description}" + year: "{upload_year}" + aired: "{upload_date_standardized}" + + # In the output directory, create a tvshow.nfo file. Kodi looks for this + # in the root of the TV show directory to get the TV show (title) name. + output_directory_nfo_tags: + nfo_name: "tvshow.nfo" + nfo_root: "tvshow" + tags: + title: "{tv_show_name}" + + # Overrides is a section where we can define our own variables, and use them in + # any other section. We define our episode file name here, which gets reused above + # for the video, thumbnail, and NFO file. + overrides: + episode_name: "Season {upload_year}/s{upload_year}.e{upload_month_padded}{upload_day_padded} - {sanitized_title}" diff --git a/examples/kodi_tv_shows_subscriptions.yaml b/examples/kodi_tv_shows_subscriptions.yaml new file mode 100644 index 00000000..8ce5e819 --- /dev/null +++ b/examples/kodi_tv_shows_subscriptions.yaml @@ -0,0 +1,81 @@ +# This example shows how we can use the `kodi_tv_shows_config.yaml` preset +# to download channels in a few different ways. We will use made-up channels +# in each example. + +############################################################################### +# LEVEL 1 - FULL ARCHIVE + +# Subscription names are defined by you. We will call this one +# john_smith_archive because it will download every single video in +# john_smith's channel. +john_smith_archive: + # We must define a preset to use from our config. We named the one in the + # config example "yt_channel_as_tv", so set that here. + preset: "yt_channel_as_tv" + + # Our download strategy was Youtube channels. Define the channel id here + # in our subscription. + youtube: + channel_id: "UCsvn_Po0SmunchJYtttWpOxMg" + + # Overrides can be defined per-subscription. If you noticed, we used + # {tv_show_name} and {sanitized_tv_show_name} in our "yt_channel_as_tv" + # preset. We intended to reserve that variable to be defined for each + # individual subscription. Each override defined here will create a + # 'sanitized_' version that is safe for file systems. + overrides: + tv_show_name: "John /\ Smith" + +############################################################################### +# LEVEL 2 - RECENT ARCHIVE + +# It is not always ideal to go full datahoarder on a channel's videos. +# This example shows how you can only download the last 14 days-worth +# of videos on each download invocation. +# +# The only difference between this example and the one above is +# - youtube.after +# This is saying 'only download videos in the last 14 days' +# - ytdl_options.break_on_reject +# This is getting into YTDL voodoo. By default, YTDL will try to +# download all channel videos beginning with the most recent one. +# By setting break_on_reject, we will break this full-download on +# the first video that gets rejected. Since we have youtube.after +# defined, all videos after today-14days will be rejected. Therefore, +# the first video that is out of range that it tries to download, it +# will stop there, and save a significant amount of time. +john_smith_recent_archive: + preset: "yt_channel_as_tv" + youtube: + channel_id: "UCsvn_Po0SmunchJYtttWpOxMg" + after: today-14days + overrides: + tv_show_name: "John /\ Smith" + ytdl_options: + break_on_reject: True + +############################################################################### +# LEVEL 3 - ROLLING ARCHIVE + +# If you put the recent archive example in a cron job, then in a year or so +# you will basically be datahoarding that channel unless you manually delete +# old videos. We automate because we are lazy. This example shows how to +# only keep the last 14-days worth of videos, and delete the rest. +# +# The only difference between this example and the one above is +# - output_options.keep_files.after +# This is saying "only keep files if they were uploaded in the last 14 days". +# All other files that this subscription had previously downloaded will be +# deleted. +john_smith_rolling_archive: + preset: "yt_channel_as_tv" + youtube: + channel_id: "UCsvn_Po0SmunchJYtttWpOxMg" + after: today-14days + overrides: + tv_show_name: "John /\ Smith" + ytdl_options: + break_on_reject: True + output_options: + keep_files: + after: today-14days \ No newline at end of file