From 6295f78eb871522ff0fab6936999369ab94ff0a5 Mon Sep 17 00:00:00 2001 From: jbannon Date: Fri, 20 May 2022 19:35:33 +0000 Subject: [PATCH] docker looking good now --- docker/docker-compose.yml | 16 +++++ docker/root/defaults/config.yaml | 91 +++++++++---------------- docker/root/defaults/subscriptions.yaml | 20 ++---- examples/kodi_music_videos_config.yaml | 36 ++++++---- setup.py | 2 +- src/ytdl_sub/main.py | 5 +- 6 files changed, 80 insertions(+), 90 deletions(-) create mode 100644 docker/docker-compose.yml diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..a305aeed --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,16 @@ +version: "2.1" +services: + ytdl-sub: + image: ytdl-sub:latest + container_name: ytdl-sub + environment: + - PUID=1000 + - PGID=1000 + - TZ=America/Los_Angeles + volumes: + - :/config + - :/tv_shows # optional + - :/movies # optional + - :/music_videos # optional + - :/music # optional + restart: unless-stopped diff --git a/docker/root/defaults/config.yaml b/docker/root/defaults/config.yaml index 13823876..4b3a4135 100644 --- a/docker/root/defaults/config.yaml +++ b/docker/root/defaults/config.yaml @@ -2,79 +2,52 @@ configuration: working_directory: '/tmp/ytdl-sub-downloads' # All example presets are included in this default config.yaml, -# feel free to change it as you see fit. +# feel free to change it as you see fit. For a detailed explanation +# of the examples, see https://ytdl-sub.readthedocs.io/en/latest/examples.html presets: - yt_music_video_playlist: - youtube: - download_strategy: "playlist" - ytdl_options: - ignoreerrors: True - output_options: - output_directory: "{music_video_directory}" - file_name: "{music_video_name}.{ext}" - thumbnail_name: "{music_video_name}.jpg" - maintain_download_archive: True - convert_thumbnail: - to: "jpg" - nfo_tags: - nfo_name: "{music_video_name}.nfo" - nfo_root: "musicvideo" - tags: - artist: "{artist}" - title: "{title}" - album: "Music Videos" - year: "{upload_year}" - overrides: - music_video_directory: "path/to/Music Videos" - music_video_name: "{sanitized_artist} - {sanitized_title}" - yt_music_video: - preset: "yt_music_video_playlist" - youtube: - download_strategy: "video" - - yt_channel_as_tv: + ############################################################################# + # Downloads single videos and stores them as Kodi/Jellyfin/Emby music videos, + # which all live in a single directory. + yt_music_video: youtube: - download_strategy: "channel" - channel_avatar_path: "poster.jpg" - channel_banner_path: "fanart.jpg" + download_strategy: "video" + ytdl_options: ignoreerrors: True + output_options: - output_directory: "{youtube_tv_shows_directory}/{sanitized_tv_show_name}" - file_name: "{episode_name}.{ext}" - thumbnail_name: "{episode_name}.jpg" - maintain_download_archive: True + output_directory: "{music_video_directory}" + file_name: "{music_video_name}.{ext}" + thumbnail_name: "{music_video_name}.jpg" + convert_thumbnail: to: "jpg" + nfo_tags: - nfo_name: "{episode_name}.nfo" - nfo_root: "episodedetails" + nfo_name: "{music_video_name}.nfo" + nfo_root: "musicvideo" tags: + artist: "{artist}" title: "{title}" - season: "{upload_year}" - episode: "{upload_month}{upload_day_padded}" - plot: "{description}" + album: "Music Videos" year: "{upload_year}" - aired: "{upload_date_standardized}" - output_directory_nfo_tags: - nfo_name: "tvshow.nfo" - nfo_root: "tvshow" - tags: - title: "{tv_show_name}" + overrides: - youtube_tv_shows_directory: "/path/to/youtube_tv_shows" - episode_name: "Season {upload_year}/s{upload_year}.e{upload_month_padded}{upload_day_padded} - {sanitized_title}" + music_video_directory: "/music_videos" + music_video_name: "{sanitized_artist} - {sanitized_title}" + # artist: # FILL THIS OUT IN THE SUBSCRIPTION - yt_channel_as_tv__recent: - preset: "yt_channel_as_tv" + ############################################################################# + # Downloads playlists and stores all videos as Kodi/Jellyfin/Emby music + # videos, which all live in a single directory. + yt_music_video_playlist: + preset: "yt_music_video" youtube: - after: "today-2weeks" - ytdl_options: - break_on_reject: True - break_on_existing: True + download_strategy: "playlist" - yt_channel_as_tv__only_recent: - preset: "yt_channel_as_tv__recent" output_options: - keep_files_after: "today-2weeks" \ No newline at end of file + maintain_download_archive: True + + ytdl_options: + break_on_existing: True diff --git a/docker/root/defaults/subscriptions.yaml b/docker/root/defaults/subscriptions.yaml index 54a6ad5e..b6012c5c 100644 --- a/docker/root/defaults/subscriptions.yaml +++ b/docker/root/defaults/subscriptions.yaml @@ -1,13 +1,7 @@ -#recent_channel_test: -# preset: "yt_channel" -# ytdl_options: -# break_on_reject: True -# youtube: -# channel_id: "UCsvn_Po0SmunchJYOWpOxMg" -# after: today-13days -# output_options: -# output_directory: "/tmp/dunkey" -# keep_files: -# after: today-3days -# overrides: -# tv_show_name: "Youtube: Dunkey" \ No newline at end of file +rammstein_music_videos: + preset: "yt_music_video_playlist" + youtube: + playlist_id: "PLVTLbc6i-h_iuhdwUfuPDLFLXG2QQnz-x" + overrides: + artist: "Rammstein" + diff --git a/examples/kodi_music_videos_config.yaml b/examples/kodi_music_videos_config.yaml index 6eb7aac8..ece44f76 100644 --- a/examples/kodi_music_videos_config.yaml +++ b/examples/kodi_music_videos_config.yaml @@ -16,12 +16,12 @@ configuration: working_directory: '.ytdl-sub-downloads' presets: - yt_music_video_playlist: - # Youtube playlists are our source/download strategy. However, this - # can be overwritten to download music videos from a 'channel' or a - # single 'video' + yt_music_video: + # A single YouTube video is our source/download strategy. However, this + # can be overwritten to download music videos from a "playlist", as we + # will see in a preset below youtube: - download_strategy: "playlist" + download_strategy: "video" # For advanced YTDL users only. # It is wise to leave ignoreerrors=True to avoid errors for things @@ -32,16 +32,10 @@ presets: # For each video downloaded, set the file and thumbnail name here. # We set both with {music_video_name}, which is a variable we define in # the overrides section further below to represent consistent naming format. - # - # Another field worth mentioning is maintain_download_archive=True. This - # is generally a good thing to enable with playlists because it will - # store previously downloaded video ids to tell YTDL not to re-download - # them on a successive invocation. output_options: - output_directory: "{music_video_directory}" + output_directory: "{music_video_directory}/{sanitized_artist}" file_name: "{music_video_name}.{ext}" thumbnail_name: "{music_video_name}.jpg" - maintain_download_archive: True # Always convert the video thumbnail to jpg # TODO: always convert all thumbnails to jpg in code @@ -70,7 +64,19 @@ presets: # It is not always ideal to download all of an artist's music videos. # Maybe you only like one song of theirs. We can reuse our preset above # to download a single video instead. - yt_music_video: - preset: "yt_music_video_playlist" + yt_music_video_playlist: + preset: "yt_music_video" youtube: - download_strategy: "video" + download_strategy: "playlist" + + # Setting maintain_download_archive=True is generally a good thing to enable + # with playlists and channels because it will store previously downloaded + # video ids to tell YTDL not to re-download them on a successive invocation. + output_options: + maintain_download_archive: True + + # Setting break_on_existing=True is also a good thing anytime you are using + # a download archive, because it will tell the downloader to stop trying + # to download videos that have already been downloaded. + ytdl_options: + break_on_existing: True diff --git a/setup.py b/setup.py index 6b40b52b..7f1a1763 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ from setuptools import setup -if __name__ == '__main__': +if __name__ == "__main__": setup() diff --git a/src/ytdl_sub/main.py b/src/ytdl_sub/main.py index 248befe9..9b346432 100644 --- a/src/ytdl_sub/main.py +++ b/src/ytdl_sub/main.py @@ -59,8 +59,9 @@ def _download_subscription_from_cli(config: ConfigFile, extra_args: List[str]) - def main(): - """Entrypoint for ytdl-subscribe""" - + """ + Entrypoint for ytdl-subscribe + """ # If no args are provided, print help and exit if len(sys.argv) < 2: parser.print_help()