nathom / streamrip

A scriptable music downloader for Qobuz, Tidal, SoundCloud, and Deezer
GNU General Public License v3.0
2.38k stars 209 forks source link

[BUG] FlacNoHeaderError when trying to download from tidal #477

Open exorcist365 opened 8 months ago

exorcist365 commented 8 months ago

Describe the bug

self-descriptive but here is a screenshot https://0x0.st/HJkw.png

Command Used

rip url https://listen.tidal.com/album/5749282 --max-quality 3

Debug Traceback

∫ rip url https://listen.tidal.com/album/5749282 --max-quality 3
Logged into Tidal

Downloading When the Kite String Pops (Album)

Downloading cover art (large)

Track 01 |███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 00:00 left at 11.7MB/s

  FLACNoHeaderError

  '/home/joan/StreamripDownloads/Acid Bath - When the Kite String Pops (1994) [FLAC] [16B-44.1kHz]/01. Acid Bath - The Blue (Explicit).flac' is not a valid FLAC file

  at ~/.local/lib/python3.11/site-packages/mutagen/flac.py:920 in __check_header
      916│                 fileobj.seek(size - 4)
      917│                 if fileobj.read(4) != b"fLaC":
      918│                     size = None
      919│         if size is None:
    → 920│             raise FLACNoHeaderError(
      921│                 "%r is not a valid FLAC file" % name)
      922│         return size
      923│
      924│

If this was unexpected, please open a Bug Report at https://github.com/nathom/streamrip/issues/new/choose

Config File

default config / i dont have

Operating System

Linux

streamrip version

1.9.7

Screenshots and recordings

No response

Additional context

No response

naiches commented 5 months ago

I've had this same error with Qobuz some time ago. It seemed to be account related. Have you tested this with a different account?

nodadyoushutup commented 1 week ago

I am just leaving a comment that this bug is still not resolved. I haven't done a deep dive on the code but judging from the error message it looks like it failed to get a response back from Tidal when making some sort of request. This is probably due to some sort of timeout on requests. I noticed when I was power downloading some albums and had multiple terminal tabs open that sometimes downloads would fail because Tidal would kick you for making too many requests in X period of time (never really found out how long that was, just waited a bit and tried again).

So if you are downloading a full artist or a bunch of albums concurrently this seems to get thrown. For sure when downloading an artists wholesale. I found just coming back to it after a brief period has resolved it.

EDIT: Maybe need to adjust the requests_per_minute in the config to be lower than 60.

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/apps/.local/bin/rip:8 in <module>                                                          │
│                                                                                                  │
│   5 from streamrip.rip import rip                                                                │
│   6 if __name__ == '__main__':                                                                   │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(rip())                                                                          │
│   9                                                                                              │
│                                                                                                  │
│ /usr/lib/python3/dist-packages/click/core.py:1128 in __call__                                    │
│                                                                                                  │
│                                     ... 24 frames hidden ...                                     │
│                                                                                                  │
│ /home/apps/.local/lib/python3.10/site-packages/mutagen/flac.py:794 in load                       │
│                                                                                                  │
│   791 │   │   self.seektable = None                                                              │
│   792 │   │                                                                                      │
│   793 │   │   fileobj = StrictFileObject(fileobj)                                                │
│ ❱ 794 │   │   self.__check_header(fileobj, filething.name)                                       │
│   795 │   │   while self.__read_metadata_block(fileobj):                                         │
│   796 │   │   │   pass                                                                           │
│   797                                                                                            │
│                                                                                                  │
│ /home/apps/.local/lib/python3.10/site-packages/mutagen/flac.py:929 in __check_header             │
│                                                                                                  │
│   926 │   │   │   │   if fileobj.read(4) != b"fLaC":                                             │
│   927 │   │   │   │   │   size = None                                                            │
│   928 │   │   if size is None:                                                                   │
│ ❱ 929 │   │   │   raise FLACNoHeaderError(                                                       │
│   930 │   │   │   │   "%r is not a valid FLAC file" % name)                                      │
│   931 │   │   return size                                                                        │
│   932                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FLACNoHeaderError: '/mnt/epool/media/music/rip/BLACKPINK - BORN PINK (2022) [FLAC] [16B-44.1kHz]/05. BLACKPINK - Hard to Love.flac' is not a valid FLAC file
sys:1: RuntimeWarning: coroutine 'Artist._download_async.<locals>._rip' was never awaited