nathom / streamrip

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

'Track' object has no attribute 'folder' #526

Closed G5dwe1 closed 7 months ago

G5dwe1 commented 8 months ago

Describe the bug

Screenshot_2024-01-06-22-33-23-173_com termux

Command Used

Rip url --max-quality 2 tidal

Debug Traceback

rip url --max-quality 2 https://tidal.com/track/96312547 -vvv
DEBUG:streamrip:Config loaded
DEBUG:streamrip:Parsed urls: [('tidal', 'track', '96312547')]
DEBUG:streamrip:Searching for {'id': '96312547'} in database
DEBUG:streamrip:Executing SELECT EXISTS(SELECT 1 FROM downloads WHERE id=?)
DEBUG:streamrip:{'quality': 3, 'download_videos': True, 'user_id': 196211909, 'country_code': 'US', 'access_token': 'eyJraWQiOiJ2OU1GbFhqWSIsImFsZyI6IkVTMjU2In0.eyJ0eXBlIjoibzJfYWNjZXNzIiwidWlkIjoxOTYyMTE5MDksInNjb3BlIjoid19zdWIgcl91c3Igd191c3IiLCJnVmVyIjowLCJzVmVyIjowLCJjaWQiOjMyMzUsImV4cCI6MTcwNDk3ODk0OCwic2lkIjoiYzZlMzM0YWUtMGVhZS00YTM1LTlmNjEtYTliN2RjYWM1OGZhIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLnRpZGFsLmNvbS92MSJ9.W4P4lGK7jg2VEswgOUB9rDJ4rK226JW2Ph142gvV8UrkpCUrsGWxxVTdWwa47Ll4HSU2RPzkx3-yGJDK4yVgjQ', 'refresh_token': 'eyJraWQiOiJoUzFKYTdVMCIsImFsZyI6IkVTNTEyIn0.eyJ0eXBlIjoibzJfcmVmcmVzaCIsInVpZCI6MTk2MjExOTA5LCJzY29wZSI6Indfc3ViIHJfdXNyIHdfdXNyIiwiY2lkIjozMjM1LCJzVmVyIjowLCJnVmVyIjowLCJpc3MiOiJodHRwczovL2F1dGgudGlkYWwuY29tL3YxIn0.AMVnXosP8_x5PH3Bod3odRaYMbqoWxIm805BoNVKcwCaId5JaHvogJdZbKgv2Ctp9rYqJQqZKRG34mGvPkTZw3MsAZPDnA0ItQW9KGGQhfwCxt2dQzi4dYFxzlTYKv4aDFw6J4D6evYzgLaW-HlsrYorRl9GPgvdCOOjJNU2SO1q7Eh2', 'token_expiry': 1704978963.4598057}
DEBUG:streamrip:Logging in with access token
Logged into Tidal
DEBUG:streamrip:Config saved: /data/data/com.termux/files/home/.config/streamrip/config.toml
DEBUG:streamrip:{'id': '96312547'}
DEBUG:streamrip:{'downloads': {'folder': '', 'source_subdirectories': False, 'concurrency': {'enabled': True, 'max_connections': 3}}, 'qobuz': {'quality': 2, 'download_booklets': True, 'email': '', 'password': '', 'app_id': '', 'secrets': []}, 'tidal': {'quality': 2, 'download_videos': True, 'user_id': 196211909, 'country_code': 'US', 'access_token': 'eyJraWQiOiJ2OU1GbFhqWSIsImFsZyI6IkVTMjU2In0.eyJ0eXBlIjoibzJfYWNjZXNzIiwidWlkIjoxOTYyMTE5MDksInNjb3BlIjoid19zdWIgcl91c3Igd191c3IiLCJnVmVyIjowLCJzVmVyIjowLCJjaWQiOjMyMzUsImV4cCI6MTcwNDk3ODk0OCwic2lkIjoiYzZlMzM0YWUtMGVhZS00YTM1LTlmNjEtYTliN2RjYWM1OGZhIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLnRpZGFsLmNvbS92MSJ9.W4P4lGK7jg2VEswgOUB9rDJ4rK226JW2Ph142gvV8UrkpCUrsGWxxVTdWwa47Ll4HSU2RPzkx3-yGJDK4yVgjQ', 'refresh_token': 'eyJraWQiOiJoUzFKYTdVMCIsImFsZyI6IkVTNTEyIn0.eyJ0eXBlIjoibzJfcmVmcmVzaCIsInVpZCI6MTk2MjExOTA5LCJzY29wZSI6Indfc3ViIHJfdXNyIHdfdXNyIiwiY2lkIjozMjM1LCJzVmVyIjowLCJnVmVyIjowLCJpc3MiOiJodHRwczovL2F1dGgudGlkYWwuY29tL3YxIn0.AMVnXosP8_x5PH3Bod3odRaYMbqoWxIm805BoNVKcwCaId5JaHvogJdZbKgv2Ctp9rYqJQqZKRG34mGvPkTZw3MsAZPDnA0ItQW9KGGQhfwCxt2dQzi4dYFxzlTYKv4aDFw6J4D6evYzgLaW-HlsrYorRl9GPgvdCOOjJNU2SO1q7Eh2', 'token_expiry': 1704978963.4598057}, 'deezer': {'quality': 2, 'arl': '', 'use_deezloader': True, 'deezloader_warnings': True}, 'soundcloud': {'quality': 0, 'client_id': '', 'app_version': ''}, 'youtube': {'quality': 0, 'download_videos': False, 'video_downloads_folder': ''}, 'database': {'downloads': {'enabled': True, 'path': '/data/data/com.termux/files/home/.config/streamrip/downloads.db'}, 'failed_downloads': {'enabled': True, 'path': '/data/data/com.termux/files/home/.config/streamrip/failed_downloads.db'}}, 'conversion': {'enabled': False, 'codec': 'ALAC', 'sampling_rate': 48000, 'bit_depth': 24, 'lossy_bitrate': 320}, 'filters': {'extras': False, 'repeats': False, 'non_albums': False, 'features': False, 'non_studio_albums': False, 'non_remaster': False}, 'artwork': {'embed': True, 'size': 'large', 'max_width': -1, 'max_height': -1, 'keep_hires_cover': True}, 'metadata': {'set_playlist_to_album': True, 'new_playlist_tracknumbers': True, 'exclude': []}, 'filepaths': {'add_singles_to_folder': False, 'folder_format': '{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]', 'track_format': '{tracknumber}. {artist} - {title}{explicit}', 'restrict_characters': False, 'truncate': True}, 'lastfm': {'source': 'qobuz', 'fallback_source': 'deezer'}, 'theme': {'progress_bar': 'dainty'}, 'misc': {'version': '1.9.6'}}
DEBUG:streamrip:Arguments from config: {'restrict_filenames': False, 'truncate_filenames': True, 'parent_folder': '', 'folder_format': '{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{sampling_rate}kHz]', 'track_format': '{tracknumber}. {artist} - {title}{explicit}', 'embed_cover': True, 'embed_cover_size': 'large', 'keep_hires_cover': True, 'set_playlist_to_album': True, 'stay_temp': False, 'conversion': {'enabled': False, 'codec': 'ALAC', 'sampling_rate': 48000, 'bit_depth': 24, 'lossy_bitrate': 320}, 'concurrent_downloads': True, 'max_connections': 3, 'new_tracknumbers': True, 'download_videos': True, 'download_booklets': True, 'download_youtube_videos': False, 'youtube_video_downloads_folder': '', 'add_singles_to_folder': False, 'max_artwork_width': -1, 'max_artwork_height': -1, 'exclude_tags': []}
DEBUG:streamrip:Loading metadata
DEBUG:streamrip:{'id': 96312547, 'title': 'YEAH RIGHT', 'duration': 174, 'replayGain': -9.1, 'peak': 0.997223, 'allowStreaming': True, 'streamReady': True, 'adSupportedStreamReady': True, 'djReady': True, 'stemReady': False, 'streamStartDate': '2018-10-02T00:00:00.000+0000', 'premiumStreamingOnly': False, 'trackNumber': 6, 'volumeNumber': 1, 'version': None, 'popularity': 54, 'copyright': '℗ 2018 88rising Records/Warner Records Inc.', 'url': 'http://www.tidal.com/track/96312547', 'isrc': 'USUYG1194991', 'editable': False, 'explicit': True, 'audioQuality': 'HI_RES', 'audioModes': ['STEREO'], 'mediaMetadata': {'tags': ['LOSSLESS', 'MQA']}, 'artist': {'id': 5888982, 'name': 'Joji', 'type': 'MAIN', 'picture': '5d03f99e-706c-4bd4-9ca4-d71d9bec76b7'}, 'artists': [{'id': 5888982, 'name': 'Joji', 'type': 'MAIN', 'picture': '5d03f99e-706c-4bd4-9ca4-d71d9bec76b7'}], 'album': {'id': 96312541, 'title': 'BALLADS 1', 'cover': '2a726738-5b18-4ca7-94db-bcb01244ee60', 'vibrantColor': '#9f4c52', 'videoCover': None}, 'mixes': {'TRACK_MIX': '001aa150661f2d325b1b42e2c04f34'}}
DEBUG:streamrip:{'id': 96312547, 'title': 'YEAH RIGHT', 'duration': 174, 'replayGain': -9.1, 'peak': 0.997223, 'allowStreaming': True, 'streamReady': True, 'adSupportedStreamReady': True, 'djReady': True, 'stemReady': False, 'streamStartDate': '2018-10-02T00:00:00.000+0000', 'premiumStreamingOnly': False, 'trackNumber': 6, 'volumeNumber': 1, 'version': None, 'popularity': 54, 'copyright': '℗ 2018 88rising Records/Warner Records Inc.', 'url': 'http://www.tidal.com/track/96312547', 'isrc': 'USUYG1194991', 'editable': False, 'explicit': True, 'audioQuality': 'HI_RES', 'audioModes': ['STEREO'], 'mediaMetadata': {'tags': ['LOSSLESS', 'MQA']}, 'artist': {'id': 5888982, 'name': 'Joji', 'type': 'MAIN', 'picture': '5d03f99e-706c-4bd4-9ca4-d71d9bec76b7'}, 'artists': [{'id': 5888982, 'name': 'Joji', 'type': 'MAIN', 'picture': '5d03f99e-706c-4bd4-9ca4-d71d9bec76b7'}], 'album': {'id': 96312541, 'title': 'BALLADS 1', 'cover': '2a726738-5b18-4ca7-94db-bcb01244ee60', 'vibrantColor': '#9f4c52', 'videoCover': None}, 'mixes': {'TRACK_MIX': '001aa150661f2d325b1b42e2c04f34'}}
Downloading Joji - YEAH RIGHT

  Stack trace:

  9  /data/data/com.termux/files/usr/lib/python3.11/site-packages/cleo/application.py:330 in run
      328│
      329│             try:
    → 330│                 exit_code = self._run(io)
      331│             except Exception as e:
      332│                 if not self._catch_exceptions:

  8  /data/data/com.termux/files/usr/lib/python3.11/site-packages/rip/cli.py:762 in _run
      760│             logger.addHandler(fh)
      761│
    → 762│         super()._run(io)
      763│
      764│     def create_io(self, input=None, output=None, error_output=None):

  7  /data/data/com.termux/files/usr/lib/python3.11/site-packages/cleo/application.py:425 in _run
      423│                 io.set_input(ArgvInput(argv))
      424│
    → 425│         exit_code = self._run_command(command, io)
      426│         self._running_command = None
      427│

  6  /data/data/com.termux/files/usr/lib/python3.11/site-packages/cleo/application.py:432 in _run_command
      430│     def _run_command(self, command: Command, io: IO) -> int:
      431│         if self._event_dispatcher is None:
    → 432│             return command.run(io)
      433│
      434│         # Bind before the console.command event,

  5  /data/data/com.termux/files/usr/lib/python3.11/site-packages/cleo/commands/base_command.py:118 in run
      116│         io.input.validate()
      117│
    → 118│         status_code = self.execute(io)
      119│
      120│         if status_code is None:

  4  /data/data/com.termux/files/usr/lib/python3.11/site-packages/cleo/commands/command.py:85 in execute
       83│
       84│         try:
    →  85│             return self.handle()
       86│         except KeyboardInterrupt:
       87│             return 1

  3  /data/data/com.termux/files/usr/lib/python3.11/site-packages/rip/cli.py:125 in handle
      123│
      124│         if len(core) > 0:
    → 125│             core.download()
      126│         elif not urls and path is None:
      127│             self.line("Must pass arguments. See rip url -h.")

  2  /data/data/com.termux/files/usr/lib/python3.11/site-packages/rip/core.py:314 in download
      312│
      313│             try:
    → 314│                 item.download(**arguments)
      315│                 for item_id in item.downloaded_ids:
      316│                     # Add items row by row

  1  /data/data/com.termux/files/usr/lib/python3.11/site-packages/streamrip/media.py:284 in download
       282│             secho(f"Downloading {self!s}\n", bold=True)
       283│
    →  284│         self._prepare_download(
       285│             quality=quality,
       286│             parent_folder=parent_folder,

  AttributeError

  'Track' object has no attribute 'folder'

  at /data/data/com.termux/files/usr/lib/python3.11/site-packages/streamrip/media.py:233 in _prepare_download
       229│         self.quality = min(
       230│             kwargs["quality"], self.client.max_quality, self.meta.quality
       231│         )
       232│
    →  233│         self.folder = kwargs["parent_folder"] or self.folder
       234│
       235│         if not self.part_of_tracklist and kwargs["add_singles_to_folder"]:
       236│             self.folder = os.path.join(
       237│                 self.folder,

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

Config File

None

Operating System

Termux (Android)

streamrip version

1.9.7

Screenshots and recordings

No response

Additional context

No response

nathom commented 8 months ago

Try using v2 on the dev branch.

G5dwe1 commented 8 months ago

How to using it. I don't know

nathom commented 8 months ago

Instructions are on the README

G5dwe1 commented 8 months ago

Thank you for providing the explanation. One more thing I want to ask. How to adjust several things such as the quality of the song or album cover, activate LRC, adjust the music quality.

G5dwe1 commented 8 months ago

Some songs experience errors like this when rip tidal

rip url https://tidal.com/track/77555393 ───────────── Downloading Hold Back The River ───────────── ╭─────────── Traceback (most recent call last) ───────────╮ │ /data/data/com.termux/files/usr/lib/python3.11/site-pac │ │ kages/mutagen/mp4/init.py:1053 in load │ │ │ │ 1050 │ @convert_error(IOError, MP4StreamInfoError) │ │ 1051 │ def load(self, atoms, fileobj): │ │ 1052 │ │ try: │ │ ❱ 1053 │ │ │ moov = atoms[b"moov"] │ │ 1054 │ │ except KeyError: │ │ 1055 │ │ │ raise MP4StreamInfoError("not a MP4 │ │ 1056 │ │ │ │ /data/data/com.termux/files/usr/lib/python3.11/site-pac │ │ kages/mutagen/mp4/_atom.py:188 in getitem │ │ │ │ 185 │ │ │ if child.name == names[0]: │ │ 186 │ │ │ │ return child[names[1:]] │ │ 187 │ │ else: │ │ ❱ 188 │ │ │ raise KeyError("%r not found" % names │ │ 189 │ │ │ 190 │ def repr(self): │ │ 191 │ │ return "\n".join([repr(child) for child i │ ╰─────────────────────────────────────────────────────────╯ KeyError: "b'moov' not found"

During handling of the above exception, another exception occurred:

╭─────────── Traceback (most recent call last) ───────────╮ │ /data/data/com.termux/files/usr/bin/rip:8 in │ │ │ │ 5 from streamrip.rip import rip │ │ 6 if name == 'main': │ │ 7 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', │ │ ❱ 8 │ sys.exit(rip()) │ │ 9 │ │ │ │ /data/data/com.termux/files/usr/lib/python3.11/site-pac │ │ kages/click/core.py:1157 in call │ │ │ │ ... 18 frames hidden ... │ │ │ │ /data/data/com.termux/files/usr/lib/python3.11/site-pac │ │ kages/mutagen/_util.py:185 in wrapper │ │ │ │ 182 │ │ @wraps(func) │ │ 183 │ │ def wrapper(*args, *kwargs): │ │ 184 │ │ │ try: │ │ ❱ 185 │ │ │ │ return func(args, **kwargs) │ │ 186 │ │ │ except exc_dest: │ │ 187 │ │ │ │ raise │ │ 188 │ │ │ except exc_src as err: │ │ │ │ /data/data/com.termux/files/usr/lib/python3.11/site-pac │ │ kages/mutagen/mp4/init.py:1055 in load │ │ │ │ 1052 │ │ try: │ │ 1053 │ │ │ moov = atoms[b"moov"] │ │ 1054 │ │ except KeyError: │ │ ❱ 1055 │ │ │ raise MP4StreamInfoError("not a MP4 │ │ 1056 │ │ │ │ 1057 │ │ for trak in moov.findall(b"trak"): │ │ 1058 │ │ │ hdlr = trak[b"mdia", b"hdlr"] │ ╰─────────────────────────────────────────────────────────╯ MP4StreamInfoError: not a MP4 file

nathom commented 7 months ago

Fixed in last release.