scdl icon indicating copy to clipboard operation
scdl copied to clipboard

syncing playlist breaks with `AttributeError: 'NoneType' object has no attribute 'user'`

Open Seme4eg opened this issue 2 years ago • 3 comments

sync command i'm using:

    scdl -l "https://soundcloud.com/sad_martian/sets/whistling" \
        --addtimestamp --addtofile --original-art \
        -c --sync archive.txt

error looks like this

Updating https://soundcloud.com/sad_martian/sets/whistling
Soundcloud Downloader
Found a playlist
Comparing tracks...
Traceback (most recent call last):
  File "/nix/store/4ypsmzznvy6sbch0ibcaq93laa4gymp1-scdl-2.7.2/bin/.scdl-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/4ypsmzznvy6sbch0ibcaq93laa4gymp1-scdl-2.7.2/lib/python3.10/site-packages/scdl/scdl.py", line 239, in main
    download_url(client, **python_args)
  File "/nix/store/4ypsmzznvy6sbch0ibcaq93laa4gymp1-scdl-2.7.2/lib/python3.10/site-packages/scdl/scdl.py", line 314, in download_url
    download_playlist(client, item, playlist_offset=offset, **kwargs)
  File "/nix/store/4ypsmzznvy6sbch0ibcaq93laa4gymp1-scdl-2.7.2/lib/python3.10/site-packages/scdl/scdl.py", line 475, in download_playlist
    playlist.tracks = sync(client, playlist, playlist_info, **kwargs)
  File "/nix/store/4ypsmzznvy6sbch0ibcaq93laa4gymp1-scdl-2.7.2/lib/python3.10/site-packages/scdl/scdl.py", line 426, in sync
    filename = get_filename(client.get_track(track_id),playlist_info=playlist_info,**kwargs)
  File "/nix/store/4ypsmzznvy6sbch0ibcaq93laa4gymp1-scdl-2.7.2/lib/python3.10/site-packages/scdl/scdl.py", line 504, in get_filename
    username = track.user.username
AttributeError: 'NoneType' object has no attribute 'user'

I haven't changed archive.txt file since i downloaded the playlist

Seme4eg avatar Oct 11 '22 09:10 Seme4eg

Seems like a track that was in the archive wasn't found on SoundCloud. Maybe one of the tracks removed from the playlist was completely deleted off the site? Either that or the api just couldn't resolve it for some reason.

If you upload the archive file I can try to manually check which track caused the issue. Otherwise I'll try to add a fix that removes bad ids from the archive sometime this week.

hunkyburrito avatar Oct 18 '22 07:10 hunkyburrito

Sorry for delay, i will attach several archive txts, cuz this problem is very common for me and i encounter it in many playlists of mine. Also it seems that after each failure archive.txt duplicates its contents sometimes. http://0x0.st/ow3x.txt <- archive.txt for https://soundcloud.com/sad_martian/sets/just_beats http://0x0.st/ow3E.txt <- archive.txt for https://soundcloud.com/sad_martian/sets/trip-hop

Seme4eg avatar Oct 19 '22 09:10 Seme4eg

After looking through the archives, I found several tracks that couldn't be found on my end which could mean:

  • Track was deleted from SoundCloud
  • Track is private
  • Artist's account was deleted

So I decided to just delete all the files that aren't in the new playlist from the directory instead of checking the file name for each change.

hunkyburrito avatar Oct 19 '22 19:10 hunkyburrito