kaimi-io / yandex-music-download

Yandex Music Downloader
https://kaimi.io/2013/11/yandex-music-downloader/
MIT License
238 stars 31 forks source link

Track number in filename [feature request] #21

Closed AndreyMZ closed 4 years ago

AndreyMZ commented 4 years ago

Tracks in a playlist have an order. When a playlist is downloaded, this order is lost. I suggest to (optionally) save this order by adding a track number in the filename of the track.

For example: 01. Example author - Example title.mp3 instead of just Example author - Example title.mp3

kaimi- commented 4 years ago

Got it. I'll probably implement a feature to define a track name using predefined variables for available info (such as title, name, etc).

kaimi- commented 4 years ago

Feature is implemented. For now 3 placeholders are available: #number, #artist, #title

AndreyMZ commented 4 years ago

Now the feature works for albums and tracks, but unfortunately it does not work for playlists:

C:\Music>docker run --rm -v "%CD%":/root -it yandex-music-downloader --dir /root --pattern "#number. #artist - #title" --url https://music.yandex.ru/users/strangeislandwithnumbers/playlists/1111 --cookie "<...>" 
[INFO] Checking Yandex.Music availability
[OK] Yandex.Music is available
[INFO] Fetching playlist info: 1111 [strangeislandwithnumbers]
[INFO] Playlist title: LOST OST additional
[INFO] Tracks total: 23
Use of uninitialized value within %mp3_tags in substitution iterator at /src/ya.pl line 919.
Use of uninitialized value within %mp3_tags in substitution iterator at /src/ya.pl line 919.
<...>
Use of uninitialized value within %mp3_tags in substitution iterator at /src/ya.pl line 919.
[INFO] Trying to fetch track: . Garry Schyman - Excessum Alighiero
[OK] Temporary saved track at /root/YAAaVMMBEE
[INFO] MP3 tags added for /root/YAAaVMMBEE
[INFO] /root/YAAaVMMBEE -> /root/. Garry Schyman - Excessum Alighiero.mp3
[INFO] Waiting for 5 seconds
[INFO] Trying to fetch track: . Rayden, KimI - Devil Trigger (from -Devil May Cry 5-)
[OK] Temporary saved track at /root/OYDN8gvs2n
[INFO] MP3 tags added for /root/OYDN8gvs2n
[INFO] /root/OYDN8gvs2n -> /root/. Rayden, KimI - Devil Trigger (from -Devil May Cry 5-).mp3
[INFO] Waiting for 5 seconds
<...>

Also, track number in an album and index number in a playlist may differ. I would like to be able to use the latter one when I download a playlist.

kaimi- commented 4 years ago

Please, try current version

AndreyMZ commented 4 years ago

Now it works, for playlists. Thank you!