[BACKEND] Use download strategy for soundcloud example (#316)

This commit is contained in:
Jesse Bannon 2022-11-12 09:59:49 -08:00 committed by GitHub
parent 10b58264ea
commit 2128e183aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 50 deletions

View file

@ -1,5 +1,5 @@
# This example shows how to download and format a Soundcloud artist's # This example shows how to download and format a Soundcloud artist's
# discography with tags and album ar. We will configure this to make # discography with tags and album art. We will configure this to make
# the output directory formatted as: # the output directory formatted as:
# #
# /path/to/music # /path/to/music
@ -18,19 +18,37 @@ configuration:
working_directory: '.ytdl-sub-downloads' working_directory: '.ytdl-sub-downloads'
presets: presets:
sc_discography: soundcloud_discography:
# A Soundcloud artist's albums and singles will be our source/download # Download using the multi_url strategy
# strategy. This will group together album tracks, and treat any track download:
# not part of an album as a single. download_strategy: "multi_url"
soundcloud: urls:
download_strategy: "albums_and_singles" # The first URL will be all the artist's tracks.
skip_premiere_tracks: True # Treat these as singles - an album with a single track
- url: "{artist_url}/tracks"
variables:
track_number: "1"
track_number_padded: "01"
track_count: "1"
album: "{title}"
album_sanitized: "{title_sanitized}"
album_year: "{upload_year}"
# Set the second URL to the artist's albums. If a track belongs both
# to an album and tracks (in the URL above), it will resolve to this
# URL and include the album metadata we set below.
- url: "{artist_url}/albums"
variables:
track_number: "{playlist_index}"
track_number_padded: "{playlist_index_padded}"
track_count: "{playlist_count}"
album: "{playlist_title}"
album_sanitized: "{playlist_title_sanitized}"
album_year: "{playlist_max_upload_year}"
# For advanced YTDL users only; any YTDL parameter can be set here. # For advanced YTDL users only; set any YTDL parameter here.
# You can set the type of format you prefer YTDL to download here. # Let us set the format to download the best mp3.
# By default, soundcloud will download the best mp3. ytdl_options:
# ytdl_options: format: 'bestaudio[ext=mp3]'
# format: 'bestaudio[ext=mp3]'
# For each song downloaded, set the file and thumbnail name here. # For each song downloaded, set the file and thumbnail name here.
# The output directory stores all artists in a shared {music_directory}. # The output directory stores all artists in a shared {music_directory}.
@ -38,15 +56,12 @@ presets:
# with the track number and title. The (thumbnail) album art is stored # with the track number and title. The (thumbnail) album art is stored
# in the album folder. # in the album folder.
# #
# Another field worth mentioning is maintain_download_archive=True. This # Set maintain_download_archive=True. This will tell YTDL not to
# is generally a good thing to enable with artists because it will # re-download them on a successive invocation.
# store previously downloaded song IDs to tell YTDL not to re-download
# them on a successive invocation.
output_options: output_options:
output_directory: "{music_directory}" output_directory: "{music_directory}"
file_name: "{album_path}/{track_file_name}.{ext}" file_name: "{album_path}/{track_file_name}.{ext}"
thumbnail_name: "{album_path}/folder.{thumbnail_ext}" thumbnail_name: "{album_path}/folder.{thumbnail_ext}"
info_json_name: "{album_path}/{track_file_name}.{info_json_ext}"
maintain_download_archive: True maintain_download_archive: True
# For each song downloaded, populate the audio file with music tags. # For each song downloaded, populate the audio file with music tags.

View file

@ -8,15 +8,16 @@ from ytdl_sub.subscriptions.subscription import Subscription
@pytest.fixture @pytest.fixture
def subscription_dict(output_directory): def subscription_dict(output_directory):
return { return {
"preset": "sc_discography", "preset": "soundcloud_discography",
"soundcloud": {"url": "https://soundcloud.com/jessebannon"},
# override the output directory with our fixture-generated dir
"output_options": {"output_directory": output_directory},
# download the worst format so it is fast # download the worst format so it is fast
"ytdl_options": { "ytdl_options": {
"format": "worst[ext=mp3]", "format": "worst[ext=mp3]",
}, },
"overrides": {"artist": "j_b"}, "overrides": {
"artist": "j_b",
"artist_url": "https://soundcloud.com/jessebannon",
"music_directory": output_directory,
},
} }

View file

@ -1,32 +1,19 @@
{ {
".ytdl-sub-jb-download-archive.json": "1114f07090dfb35eea6848efeaf9755a", ".ytdl-sub-jb-download-archive.json": "1a99156e9ece62539fb2608416a07200",
"j_b/[2021] Baby Santana's Dorian Groove/01 - Baby Santana's Dorian Groove.info.json": "b95796948d30558e057a3f2c794c650c",
"j_b/[2021] Baby Santana's Dorian Groove/01 - Baby Santana's Dorian Groove.mp3": "bffbd558e12c6a9e029dc136a88342c4", "j_b/[2021] Baby Santana's Dorian Groove/01 - Baby Santana's Dorian Groove.mp3": "bffbd558e12c6a9e029dc136a88342c4",
"j_b/[2021] Baby Santana's Dorian Groove/folder.jpg": "967892be44b8c47e1be73f055a7c6f08", "j_b/[2021] Baby Santana's Dorian Groove/folder.jpg": "967892be44b8c47e1be73f055a7c6f08",
"j_b/[2021] Purple Clouds/01 - Purple Clouds.info.json": "e4d6f7da57a8bc18f82332778ac9b1f0",
"j_b/[2021] Purple Clouds/01 - Purple Clouds.mp3": "038db58aebe2ba875b733932b42a94d6", "j_b/[2021] Purple Clouds/01 - Purple Clouds.mp3": "038db58aebe2ba875b733932b42a94d6",
"j_b/[2021] Purple Clouds/folder.jpg": "967892be44b8c47e1be73f055a7c6f08", "j_b/[2021] Purple Clouds/folder.jpg": "967892be44b8c47e1be73f055a7c6f08",
"j_b/[2022] Acoustic Treats/01 - 20160426 184214.info.json": "4294a791c9e295dcbcb536528215ab2e",
"j_b/[2022] Acoustic Treats/01 - 20160426 184214.mp3": "e145f0a2f6012768280c38655ca58065", "j_b/[2022] Acoustic Treats/01 - 20160426 184214.mp3": "e145f0a2f6012768280c38655ca58065",
"j_b/[2022] Acoustic Treats/02 - 20160502 123150.info.json": "9fcdd8984dd286b03d07900240325468",
"j_b/[2022] Acoustic Treats/02 - 20160502 123150.mp3": "60c8b8817a197a13e4bb90903af612c5", "j_b/[2022] Acoustic Treats/02 - 20160502 123150.mp3": "60c8b8817a197a13e4bb90903af612c5",
"j_b/[2022] Acoustic Treats/03 - 20160504 143832.info.json": "6a3ca21f1cb2f43227fc95355dcaf7ab",
"j_b/[2022] Acoustic Treats/03 - 20160504 143832.mp3": "8265b7e4f79878af877bc6ecd9757efe", "j_b/[2022] Acoustic Treats/03 - 20160504 143832.mp3": "8265b7e4f79878af877bc6ecd9757efe",
"j_b/[2022] Acoustic Treats/04 - 20160601 221234.info.json": "accc54dbf191095e7bf39ab954fc5fa4",
"j_b/[2022] Acoustic Treats/04 - 20160601 221234.mp3": "accf46b76891d2954b893d0f91d82816", "j_b/[2022] Acoustic Treats/04 - 20160601 221234.mp3": "accf46b76891d2954b893d0f91d82816",
"j_b/[2022] Acoustic Treats/05 - 20160601 222440.info.json": "6c3dff44838b403d67a1229879edd51a",
"j_b/[2022] Acoustic Treats/05 - 20160601 222440.mp3": "e1f584f523336160d5c1104a61de77f3", "j_b/[2022] Acoustic Treats/05 - 20160601 222440.mp3": "e1f584f523336160d5c1104a61de77f3",
"j_b/[2022] Acoustic Treats/06 - 20170604 190236.info.json": "b37323719f632e5a607e3fe93a220c9b",
"j_b/[2022] Acoustic Treats/06 - 20170604 190236.mp3": "f6885b25901177f0357649afe97328cc", "j_b/[2022] Acoustic Treats/06 - 20170604 190236.mp3": "f6885b25901177f0357649afe97328cc",
"j_b/[2022] Acoustic Treats/07 - 20170612 193646.info.json": "af3b911d3d24adfa11810676d50c055c",
"j_b/[2022] Acoustic Treats/07 - 20170612 193646.mp3": "fa057f221cbe4cf2442cd2fdb960743e", "j_b/[2022] Acoustic Treats/07 - 20170612 193646.mp3": "fa057f221cbe4cf2442cd2fdb960743e",
"j_b/[2022] Acoustic Treats/08 - 20170628 215206.info.json": "208280c591da9bcc4570b58c36452e23",
"j_b/[2022] Acoustic Treats/08 - 20170628 215206.mp3": "7794ae812c64580e2ac8fc457d5cc85f", "j_b/[2022] Acoustic Treats/08 - 20170628 215206.mp3": "7794ae812c64580e2ac8fc457d5cc85f",
"j_b/[2022] Acoustic Treats/09 - Finding Home.info.json": "23ebe28b09ceaac0a8ef64a324d86f76",
"j_b/[2022] Acoustic Treats/09 - Finding Home.mp3": "adbf02eddb2090c008eb497d13ff84b9", "j_b/[2022] Acoustic Treats/09 - Finding Home.mp3": "adbf02eddb2090c008eb497d13ff84b9",
"j_b/[2022] Acoustic Treats/10 - Shallow Water WIP.info.json": "d1c383d73b067ac6f7888dbb39393263",
"j_b/[2022] Acoustic Treats/10 - Shallow Water WIP.mp3": "65bb10c84366c71498161734f953e93d", "j_b/[2022] Acoustic Treats/10 - Shallow Water WIP.mp3": "65bb10c84366c71498161734f953e93d",
"j_b/[2022] Acoustic Treats/11 - Untold History.info.json": "edc39b25c8eb95807ab5523272d8c2d6",
"j_b/[2022] Acoustic Treats/11 - Untold History.mp3": "6904b2918e5dc38d9a9f72d967eb74bf", "j_b/[2022] Acoustic Treats/11 - Untold History.mp3": "6904b2918e5dc38d9a9f72d967eb74bf",
"j_b/[2022] Acoustic Treats/folder.jpg": "967892be44b8c47e1be73f055a7c6f08" "j_b/[2022] Acoustic Treats/folder.jpg": "967892be44b8c47e1be73f055a7c6f08"
} }

View file

@ -3,7 +3,6 @@ Files created:
{output_directory} {output_directory}
.ytdl-sub-jb-download-archive.json .ytdl-sub-jb-download-archive.json
{output_directory}/j_b/[2021] Baby Santana's Dorian Groove {output_directory}/j_b/[2021] Baby Santana's Dorian Groove
01 - Baby Santana's Dorian Groove.info.json
01 - Baby Santana's Dorian Groove.mp3 01 - Baby Santana's Dorian Groove.mp3
Music Tags: Music Tags:
album: Baby Santana's Dorian Groove album: Baby Santana's Dorian Groove
@ -15,7 +14,6 @@ Files created:
year: 2021 year: 2021
folder.jpg folder.jpg
{output_directory}/j_b/[2021] Purple Clouds {output_directory}/j_b/[2021] Purple Clouds
01 - Purple Clouds.info.json
01 - Purple Clouds.mp3 01 - Purple Clouds.mp3
Music Tags: Music Tags:
album: Purple Clouds album: Purple Clouds
@ -27,7 +25,6 @@ Files created:
year: 2021 year: 2021
folder.jpg folder.jpg
{output_directory}/j_b/[2022] Acoustic Treats {output_directory}/j_b/[2022] Acoustic Treats
01 - 20160426 184214.info.json
01 - 20160426 184214.mp3 01 - 20160426 184214.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -37,7 +34,6 @@ Files created:
title: 20160426 184214 title: 20160426 184214
track: 1 track: 1
year: 2022 year: 2022
02 - 20160502 123150.info.json
02 - 20160502 123150.mp3 02 - 20160502 123150.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -47,7 +43,6 @@ Files created:
title: 20160502 123150 title: 20160502 123150
track: 2 track: 2
year: 2022 year: 2022
03 - 20160504 143832.info.json
03 - 20160504 143832.mp3 03 - 20160504 143832.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -57,7 +52,6 @@ Files created:
title: 20160504 143832 title: 20160504 143832
track: 3 track: 3
year: 2022 year: 2022
04 - 20160601 221234.info.json
04 - 20160601 221234.mp3 04 - 20160601 221234.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -67,7 +61,6 @@ Files created:
title: 20160601 221234 title: 20160601 221234
track: 4 track: 4
year: 2022 year: 2022
05 - 20160601 222440.info.json
05 - 20160601 222440.mp3 05 - 20160601 222440.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -77,7 +70,6 @@ Files created:
title: 20160601 222440 title: 20160601 222440
track: 5 track: 5
year: 2022 year: 2022
06 - 20170604 190236.info.json
06 - 20170604 190236.mp3 06 - 20170604 190236.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -87,7 +79,6 @@ Files created:
title: 20170604 190236 title: 20170604 190236
track: 6 track: 6
year: 2022 year: 2022
07 - 20170612 193646.info.json
07 - 20170612 193646.mp3 07 - 20170612 193646.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -97,7 +88,6 @@ Files created:
title: 20170612 193646 title: 20170612 193646
track: 7 track: 7
year: 2022 year: 2022
08 - 20170628 215206.info.json
08 - 20170628 215206.mp3 08 - 20170628 215206.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -107,7 +97,6 @@ Files created:
title: 20170628 215206 title: 20170628 215206
track: 8 track: 8
year: 2022 year: 2022
09 - Finding Home.info.json
09 - Finding Home.mp3 09 - Finding Home.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -117,7 +106,6 @@ Files created:
title: Finding Home title: Finding Home
track: 9 track: 9
year: 2022 year: 2022
10 - Shallow Water WIP.info.json
10 - Shallow Water WIP.mp3 10 - Shallow Water WIP.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats
@ -127,7 +115,6 @@ Files created:
title: Shallow Water WIP title: Shallow Water WIP
track: 10 track: 10
year: 2022 year: 2022
11 - Untold History.info.json
11 - Untold History.mp3 11 - Untold History.mp3
Music Tags: Music Tags:
album: Acoustic Treats album: Acoustic Treats