ebb-earl-co / tidal-wave

Waving at the TIDAL music service
Apache License 2.0
38 stars 2 forks source link

Error after one file is downloaded #54

Closed eevan78 closed 7 months ago

eevan78 commented 7 months ago

I have tried to download an album in Atmos format using Windows pyapp container. But after getting the first audio file is sucessfully written, it exits with the following:

d:\Software\Tidal-dl>tidal-wave_2024.1.10_py311_pyapp.exe --audio-format Atmos https://listen.tidal.com/album/205605624
2024-01-19:16:01:28,526 INFO     [models.py:544] TIDAL album ID parsed from input: 205605624
2024-01-19:16:01:29,717 INFO     [requesting.py:89] Requesting from TIDAL API: albums/205605624
2024-01-19:16:01:30,298 INFO     [requesting.py:89] Requesting from TIDAL API: albums/205605624/items
2024-01-19:16:01:33,020 INFO     [requesting.py:89] Requesting from TIDAL API: albums/205605624/review
2024-01-19:16:01:33,347 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605625/credits
2024-01-19:16:01:33,624 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605625/playbackinfopostpaywall
2024-01-19:16:01:33,903 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605625/lyrics
2024-01-19:16:01:34,626 WARNING  [requesting.py:96] 404 Client Error: not found for TIDAL API endpoint tracks/205605625/lyrics
2024-01-19:16:01:34,763 INFO     [utils.py:85] Wrote artist image JPEG for Artist(id=946, name='Megadeth', type='MAIN') to 'C:\Users\705631\Music\Megadeth\Rust In Peace [205605624] [1990]\Megadeth.jpg'
2024-01-19:16:01:34,764 INFO     [requesting.py:89] Requesting from TIDAL API: artists/946/bio
2024-01-19:16:01:35,067 INFO     [track.py:213] Writing artist bio for artist 946 to 'C:\Users\705631\Music\Megadeth\Rust In Peace [205605624] [1990]\Megadeth-bio.json
2024-01-19:16:01:35,071 INFO     [track.py:245] Writing track 205605625 to 'C:\Users\705631\Music\Megadeth\Rust In Peace [205605624] [1990]\01 - Holy Wars...The Punishment Due [A].m4a'
2024-01-19:16:01:41,186 INFO     [track.py:286] Track 205605625 written to 'C:\Users\705631\Music\Megadeth\Rust In Peace [205605624] [1990]\01 - Holy Wars...The Punishment Due [A].m4a'
Traceback (most recent call last):

  File "<frozen runpy>", line 198, in _run_module_as_main

  File "<frozen runpy>", line 88, in _run_code

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\__main__.py", line 3, in <module>
    app()

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\main.py", line 91, in main
    album.get(

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\album.py", line 148, in get
    self.get_tracks(session, audio_format, out_dir)

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\album.py", line 101, in get_tracks
    track_files_value: Optional[str] = track.get(
                                       ^^^^^^^^^^

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\track.py", line 549, in get
    self.set_tags()

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\track.py", line 449, in set_tags
    subprocess.run(cmd)

  File "C:\Users\705631\AppData\Local\pyapp\cache\distributions\_9785110593903059623\python\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\705631\AppData\Local\pyapp\cache\distributions\_9785110593903059623\python\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File "C:\Users\705631\AppData\Local\pyapp\cache\distributions\_9785110593903059623\python\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [WinError 2] The system cannot find the file specified

The same happens if I try with one track from the same album. The track is downloaded properly:

d:\Software\Tidal-dl>tidal-wave_2024.1.10_py311_pyapp.exe --audio-format Atmos https://tidal.com/browse/track/205605626
2024-01-19:16:05:31,257 INFO     [models.py:599] TIDAL track ID parsed from input: 205605626
2024-01-19:16:05:32,059 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605626
2024-01-19:16:05:32,672 INFO     [requesting.py:89] Requesting from TIDAL API: albums/205605624
2024-01-19:16:05:32,723 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605626/credits
2024-01-19:16:05:33,392 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605626/playbackinfopostpaywall
2024-01-19:16:05:34,126 INFO     [requesting.py:89] Requesting from TIDAL API: tracks/205605626/lyrics
2024-01-19:16:05:34,434 WARNING  [requesting.py:96] 404 Client Error: not found for TIDAL API endpoint tracks/205605626/lyrics
2024-01-19:16:05:35,115 INFO     [track.py:245] Writing track 205605626 to 'C:\Users\705631\Music\Megadeth\Rust In Peace [205605624] [1990]\02 - Hangar 18 [A].m4a'
2024-01-19:16:06:34,302 INFO     [track.py:286] Track 205605626 written to 'C:\Users\705631\Music\Megadeth\Rust In Peace [205605624] [1990]\02 - Hangar 18 [A].m4a'
Traceback (most recent call last):

  File "<frozen runpy>", line 198, in _run_module_as_main

  File "<frozen runpy>", line 88, in _run_code

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\__main__.py", line 3, in <module>
    app()

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\main.py", line 82, in main
    track.get(

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\track.py", line 549, in get
    self.set_tags()

  File "C:\Users\705631\AppData\Local\pyapp\data\tidal-wave\9785110593903059623\2024.1.10\Lib\site-packages\tidal_wave\track.py", line 449, in set_tags
    subprocess.run(cmd)

  File "C:\Users\705631\AppData\Local\pyapp\cache\distributions\_9785110593903059623\python\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users\705631\AppData\Local\pyapp\cache\distributions\_9785110593903059623\python\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File "C:\Users\705631\AppData\Local\pyapp\cache\distributions\_9785110593903059623\python\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [WinError 2] The system cannot find the file specified

What could be the problem here?

ebb-earl-co commented 7 months ago

@eevan78 there is not good documentation about this right now, so I see why you’ve raised an issue; thanks for having done so.

I am confident that you’re seeing this problem because your Windows system is missing FFmpeg.

if you need direction how to get FFmpeg installed on Windows, let me know.

ebb-earl-co commented 7 months ago

@eevan78 the easiest way to get FFmpeg on Windows is with the chocolatey package manager, but there are other places to download it; I list a couple on the README file.

eevan78 commented 7 months ago

Thanks for the explanation! I have a static build of ffmpeg, it was just not located on the path. I have placed it in appropriate folder, and now the tool works fine. There are some minor issues with metadata, but I can easily correct that after downloading files...

ebb-earl-co commented 7 months ago

Thanks for the explanation! I have a static build of ffmpeg, it was just not located on the path. I have placed it in appropriate folder, and now the tool works fine. There are some minor issues with metadata, but I can easily correct that after downloading files...

@eevan78 Excellent! Can you elaborate on the metadata issues point? I'm happy to look into it

eevan78 commented 7 months ago

@ebb-earl-co I have looked into the code, and now I understand what is the FFMpeg used for.

Here are some of the things I have picked up. I have downloaded the Rust In Peace album in Atmos format. Files written to the disk are in fact Matroska containers (mka) but their extension is m4a:

Snimak ekrana 2024-01-21 134151

Here is a detailed MediaInfo report on the first file:

General
Unique ID                                : 145728456914837341797917157298972942706 (0x6DA247A70346A769DC7D4FBBA2E46172)
Complete name                            : C:\Data\Software\Audio\tidal-wave\Megadeth\Rust In Peace [205605624] [1990]\01 - Holy Wars...The Punishment Due [A].m4a
Format                                   : Matroska
Format version                           : Version 4
File size                                : 36.7 MiB
Duration                                 : 6 min 35 s
Overall bit rate                         : 779 kb/s
Frame rate                               : 90 000.898 FPS
Movie name                               : Holy Wars...The Punishment Due
Track name/Position                      : 1/9
Writing application                      : Lavf60.20.100
Writing library                          : Lavf60.20.100
Copyright                                : ℗ 1990 Capitol Records, LLC
Comment                                  : http://www.tidal.com/track/205605625
ErrorDetectionType                       : Per level 1
ALBUM                                    : Rust In Peace
ALBUM_ARTIST                             : Megadeth
ARTIST                                   : Megadeth
COMPOSER                                 : Dave Mustaine
DATE                                     : 1990-09-24
DISC                                     : 1/1
FileExtension_Invalid                    : mkv mk3d mka mks

Video
ID                                       : 2
Format                                   : V_MJPEG
Codec ID                                 : V_MJPEG
Width                                    : 1 280 pixels
Height                                   : 1 280 pixels
Display aspect ratio                     : 1.000
Frame rate mode                          : Constant
Frame rate                               : 90 000.898 FPS
Color space                              : YUV
Default                                  : No
Forced                                   : No
Color range                              : Full
Matrix coefficients                      : BT.470 System B/G

Audio
ID                                       : 1
Format                                   : E-AC-3 JOC
Format/Info                              : Enhanced AC-3 with Joint Object Coding
Commercial name                          : Dolby Digital Plus with Dolby Atmos
Codec ID                                 : A_EAC3
Duration                                 : 6 min 35 s
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 32 bits
Compression mode                         : Lossy
Stream size                              : 36.2 MiB (99%)
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No
VENDOR_ID                                : [0][0][0][0]
Complexity index                         : 16
Number of dynamic objects                : 15
Bed channel count                        : 1 channel
Bed channel configuration                : LFE

Maybe this is the reason why metadata is messed up a bit (a detailed properties from foobar2000): Snimak ekrana 2024-01-21 141651

I also realize that metadata on Tidal is not perfect, so it's not easy to cover all quirks (compare the info for the first and second track - first has Mix engineer, second Mixer. For Atmos format, a nice feature to have is who was the Immersive mastering engineer):

Snimak ekrana 2024-01-21 142436

(there is an Engineer metadata in Additional Credits): Snimak ekrana 2024-01-21 142527

I hope this can help a bit...

ebb-earl-co commented 7 months ago

@eevan78 thank you for having put in the time to document this. A few points in response:

These are valuable points that will help the value of tidal-wave, so can you open a new issue with the changes you'd like to see? Just so that I can track the feature branch and development steps that correspond to changing these things.

Thank you for your input!

ebb-earl-co commented 7 months ago

@eevan78 I'm working on some changes as we speak and here is the same file that you highlighted above, with output from ffprobe:

c@darter-pro:~/projects/tidal-wave/Music/Megadeth/Rust In Peace [205605624] [1990]$ ffp 01\ -\ Holy\ Wars...The\ Punishment\ Due\ \[A\].m4a 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5f73100] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01 - Holy Wars...The Punishment Due [A].m4a':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomdby1iso2mp41
    creation_time   : 2021-11-17T20:52:06.000000Z
    title           : Holy Wars...The Punishment Due
    artist          : Megadeth
    composer        : Dave Mustaine
    album           : Rust In Peace
    track           : 1/9
    disc            : 1/1
    date            : 1990-09-24
    REPLAYGAIN_TRACK_PEAK: 0.0
    REPLAYGAIN_TRACK_GAIN: 0.0
    REPLAYGAIN_ALBUM_PEAK: None
    REPLAYGAIN_ALBUM_GAIN: None
    ARTISTS         : Megadeth
    MIXER           : Max Norman
    ENGINEER        : Mills Logan
    ISRC            : USUM72121699
    LYRICIST        : Dave Mustaine
    BARCODE         : 00602445253975
    PRODUCER        : Dave Mustaine;Mike Clink
    album_artist    : Megadeth
    copyright       : ℗ 1990 Capitol Records, LLC
    comment         : http://www.tidal.com/track/205605625
  Duration: 00:06:35.14, start: 0.000000, bitrate: 777 kb/s
  Stream #0:0[0x1](und): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s (default)
    Metadata:
      creation_time   : 2021-11-17T20:52:06.000000Z
      handler_name    : sound handler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
      replaygain: track gain - 0.000000, track peak - unknown, album gain - 0.000000, album peak - unknown, 
  Stream #0:1[0x0]: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 1280x1280 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn (attached pic)

and mediainfo:

c@darter-pro:~/projects/tidal-wave/Music/Megadeth/Rust In Peace [205605624] [1990]$ mediainfo 01\ -\ Holy\ Wars...The\ Punishment\ Due\ \[A\].m4a 
General
Complete name                            : 01 - Holy Wars...The Punishment Due [A].m4a
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/dby1/iso2/mp41)
File size                                : 36.6 MiB
Duration                                 : 6 min 35 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 778 kb/s
Album                                    : Rust In Peace
Album/Performer                          : Megadeth
Part/Position                            : 1
Part/Total                               : 1
Track name                               : Holy Wars...The Punishment Due
Track name/Position                      : 1
Track name/Total                         : 9
Performer                                : Megadeth
Composer                                 : Dave Mustaine
Recorded date                            : 1990-09-24
Encoded date                             : UTC 2021-11-17 20:52:06
Tagged date                              : UTC 2021-11-17 20:52:06
ISRC                                     : USUM72121699
Copyright                                : ℗ 1990 Capitol Records, LLC
Cover                                    : Yes
Comment                                  : http://www.tidal.com/track/205605625
REPLAYGAIN_TRACK_PEAK                    : 0.0
REPLAYGAIN_TRACK_GAIN                    : 0.0
REPLAYGAIN_ALBUM_PEAK                    : None
REPLAYGAIN_ALBUM_GAIN                    : None
ARTISTS                                  : Megadeth
MIXER                                    : Max Norman
ENGINEER                                 : Mills Logan
LYRICIST                                 : Dave Mustaine
BARCODE                                  : 00602445253975
PRODUCER                                 : Dave Mustaine;Mike Clink

Audio
ID                                       : 1
Format                                   : E-AC-3 JOC
Format/Info                              : Enhanced AC-3 with Joint Object Coding
Commercial name                          : Dolby Digital Plus with Dolby Atmos
Codec ID                                 : ec-3
Duration                                 : 6 min 35 s
Bit rate mode                            : Constant
Bit rate                                 : 768 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 36.2 MiB (99%)
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2021-11-17 20:52:06
Tagged date                              : UTC 2021-11-17 20:52:06
Complexity index                         : Not present / 16
Number of dynamic objects                : 15
Bed channel count                        : 1 channel
Bed channel configuration                : LFE

Is this more consistent with what you expected?

eevan78 commented 7 months ago

@ebb-earl-co Yes, this looks excellent! Thanks for such a fast fix. This is very nice improvement! Now I think that there is no need to open another issue...