nathom / streamrip

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

[BUG] (Qobuz) AssertionError #610

Open gezhao2000 opened 8 months ago

gezhao2000 commented 8 months ago

Describe the bug

Constantly getting AssertionError for some albums

Command Used

rip url https://www.qobuz.com/nl-nl/album/verdi-overtures-preludes-berliner-philharmoniker-claudio-abbado/0002894576272

Debug Traceback

│ C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\streamrip\metad │
│ ata\track.py:55 in from_qobuz                                                                    │
│                                                                                                  │
│    52 │   │   composer = typed(resp.get("composer", {}).get("name"), str | None)                 │
│    53 │   │   tracknumber = typed(resp.get("track_number", 1), int)                              │
│    54 │   │   discnumber = typed(resp.get("media_number", 1), int)                               │
│ >  55 │   │   artist = typed(                                                                    │
│    56 │   │   │   safe_get(                                                                      │
│    57 │   │   │   │   resp,                                                                      │
│    58 │   │   │   │   "performer",                                                               │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │       album = AlbumMetadata(                                                                 │ │
│ │               │   info=AlbumInfo(                                                            │ │
│ │               │   │   id='3210665',                                                          │ │
│ │               │   │   quality=2,                                                             │ │
│ │               │   │   container='FLAC',                                                      │ │
│ │               │   │   label='Deutsche Grammophon (DG)',                                      │ │
│ │               │   │   explicit=False,                                                        │ │
│ │               │   │   sampling_rate=44.1,                                                    │ │
│ │               │   │   bit_depth=16,                                                          │ │
│ │               │   │   booklets=None                                                          │ │
│ │               │   ),                                                                         │ │
│ │               │   album='Verdi: Overtures & Preludes',                                       │ │
│ │               │   albumartist='Berliner Philharmoniker, Claudio Abbado',                     │ │
│ │               │   year='1997',                                                               │ │
│ │               │   genre=['Classique'],                                                       │ │
│ │               │   covers=Covers(('original',                                                 │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_org.jpg',          │ │
│ │               'C:\\Users\\Administrator\\StreamripDownloads\\Berliner Philharmoniker,        │ │
│ │               Claudio Abbado - Verdi Overtures & Preludes (1997) [FLAC]                      │ │
│ │               [16B-44.1kHz]\\cover.jpg')                                                     │ │
│ │               ('large',                                                                      │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_600.jpg',          │ │
│ │               'C:\\Users\\Administrator\\StreamripDownloads\\Berliner Philharmoniker,        │ │
│ │               Claudio Abbado - Verdi Overtures & Preludes (1997) [FLAC]                      │ │
│ │               [16B-44.1kHz]\\__artwork\\cover-7053951623129056120.jpg')                      │ │
│ │               ('small',                                                                      │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_230.jpg', None)    │ │
│ │               ('thumbnail',                                                                  │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_50.jpg', None)),   │ │
│ │               │   tracktotal=9,                                                              │ │
│ │               │   disctotal=1,                                                               │ │
│ │               │   albumcomposer='Giuseppe Verdi',                                            │ │
│ │               │   comment=None,                                                              │ │
│ │               │   compilation=None,                                                          │ │
│ │               │   copyright='© 1997 Deutsche Grammophon GmbH, Berlin ℗ 1997 Deutsche         │ │
│ │               Grammophon GmbH, Berlin',                                                      │ │
│ │               │   date='1997-01-01',                                                         │ │
│ │               │   description=None,                                                          │ │
│ │               │   encoder=None,                                                              │ │
│ │               │   grouping=None,                                                             │ │
│ │               │   lyrics=None,                                                               │ │
│ │               │   purchase_date=None                                                         │ │
│ │               )                                                                              │ │
│ │         cls = <class 'streamrip.metadata.track.TrackMetadata'>                               │ │
│ │    composer = 'Giuseppe Verdi'                                                               │ │
│ │  discnumber = 1                                                                              │ │
│ │        isrc = 'DEF059605270'                                                                 │ │
│ │        resp = {                                                                              │ │
│ │               │   'maximum_bit_depth': 16,                                                   │ │
│ │               │   'copyright': '℗ 1997 Deutsche Grammophon GmbH, Berlin',                    │ │
│ │               │   'performers': 'Berliner Philharmoniker, Orchestra, MainArtist - Giuseppe   │ │
│ │               Verdi, Composer - Anto'+226,                                                   │ │
│ │               │   'audio_info': {                                                            │ │
│ │               │   │   'replaygain_track_gain': -4.43,                                        │ │
│ │               │   │   'replaygain_track_peak': 0.999939                                      │ │
│ │               │   },                                                                         │ │
│ │               │   'album': {                                                                 │ │
│ │               │   │   'maximum_bit_depth': 16,                                               │ │
│ │               │   │   'image': {                                                             │ │
│ │               │   │   │   'small':                                                           │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_230.jpg',          │ │
│ │               │   │   │   'thumbnail':                                                       │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_50.jpg',           │ │
│ │               │   │   │   'large':                                                           │ │
│ │               'https://static.qobuz.com/images/covers/72/62/0002894576272_600.jpg',          │ │
│ │               │   │   │   'back': None                                                       │ │
│ │               │   │   },                                                                     │ │
│ │               │   │   'media_count': 1,                                                      │ │
│ │               │   │   'artist': {                                                            │ │
│ │               │   │   │   'image': None,                                                     │ │
│ │               │   │   │   'name': 'Berliner Philharmoniker',                                 │ │
│ │               │   │   │   'id': 56836,                                                       │ │
│ │               │   │   │   'albums_count': 1451,                                              │ │
│ │               │   │   │   'slug': 'berliner-philharmoniker',                                 │ │
│ │               │   │   │   'picture': None                                                    │ │
│ │               │   │   },                                                                     │ │
│ │               │   │   'artists': [                                                           │ │
│ │               │   │   │   {                                                                  │ │
│ │               │   │   │   │   'id': 56836,                                                   │ │
│ │               │   │   │   │   'name': 'Berliner Philharmoniker',                             │ │
│ │               │   │   │   │   'roles': ['main-artist', 'orchestra']                          │ │
│ │               │   │   │   },                                                                 │ │
│ │               │   │   │   {                                                                  │ │
│ │               │   │   │   │   'id': 25529,                                                   │ │
│ │               │   │   │   │   'name': 'Claudio Abbado',                                      │ │
│ │               │   │   │   │   'roles': ['main-artist', 'conductor']                          │ │
│ │               │   │   │   }                                                                  │ │
│ │               │   │   ],                                                                     │ │
│ │               │   │   'upc': '0002894576272',                                                │ │
│ │               │   │   'released_at': 852073200,                                              │ │
│ │               │   │   'label': {                                                             │ │
│ │               │   │   │   'name': 'Deutsche Grammophon (DG)',                                │ │
│ │               │   │   │   'id': 80905,                                                       │ │
│ │               │   │   │   'albums_count': 8846,                                              │ │
│ │               │   │   │   'supplier_id': 1,                                                  │ │
│ │               │   │   │   'slug': 'deutsche-grammophon'                                      │ │
│ │               │   │   },                                                                     │ │
│ │               │   │   'title': 'Verdi: Overtures & Preludes',                                │ │
│ │               │   │   'qobuz_id': 3210665,                                                   │ │
│ │               │   │   ... +47                                                                │ │
│ │               │   },                                                                         │ │
│ │               │   'work': 'La forza del destino',                                            │ │
│ │               │   'composer': {'id': 712, 'name': 'Giuseppe Verdi'},                         │ │
│ │               │   'isrc': 'DEF059605270',                                                    │ │
│ │               │   'title': 'Overture (Sinfonia)',                                            │ │
│ │               │   'version': None,                                                           │ │
│ │               │   ... +22                                                                    │ │
│ │               }                                                                              │ │
│ │  streamable = True                                                                           │ │
│ │       title = 'La forza del destino: Overture (Sinfonia)'                                    │ │
│ │ tracknumber = 1                                                                              │ │
│ │     version = None                                                                           │ │
│ │        work = 'La forza del destino'                                                         │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                  │
│ C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\streamrip\metad │
│ ata\util.py:24 in typed                                                                          │
│                                                                                                  │
│   21                                                                                             │
│   22                                                                                             │
│   23 def typed(thing, expected_type: Type[T]) -> T:                                              │
│ > 24 │   assert isinstance(thing, expected_type)                                                 │
│   25 │   return thing                                                                            │
│   26                                                                                             │
│   27                                                                                             │
│                                                                                                  │
│ ┌─────────── locals ────────────┐                                                                │
│ │ expected_type = <class 'str'> │                                                                │
│ │         thing = None          │                                                                │
│ └───────────────────────────────┘                                                                │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
AssertionError

Config File

default

Operating System

Win10

streamrip version

2.0.5

Screenshots and recordings

No response

Additional context

No response

gezhao2000 commented 8 months ago

modified track.py line 55 to

artist = typed( safe_get( resp, "album", "artist", "name", ), str, )

It's OK now.