Sliim / soundcloud-syncer

Synchronize user's favorites tracks from soundcloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sc-syncer does not handle urllib.ContentTooShortError

bong0 opened this issue · comments

commented

Traceback:

9%  6332416 / 66651115Traceback (most recent call last):
  File /usr/local/bin/sc-syncer, line 115, in <module>
    main()
  File /usr/local/bin/sc-syncer, line 100, in main
    limit)
  File /usr/local/bin/sc-syncer, line 35, in downloader
    if strack.download(output) is False:
  File /usr/local/lib/python3.2/dist-packages/ssyncer/strack.py, line 184, in download
    urllib.request.urlretrieve(dlurl, local_file, self._progress_hook)
  File /usr/lib/python3.2/urllib/request.py, line 151, in urlretrieve
    return _urlopener.retrieve(url, filename, reporthook, data)
  File /usr/lib/python3.2/urllib/request.py, line 1619, in retrieve
    % (read, size), result)
urllib.error.ContentTooShortError: <urlopen error retrieval incomplete: got only 6329759 out of 66651115 bytes>

OS: Debian Wheezy armhf on Raspberry Pi 1 (armv6)
installed via python3 pip

commented

Hi,

Thanks for your feedback :)

Can you give me the soundcloud's track that soundcloud-syncer try to download please ? This will allow me to reproduce this error :). Thx!

commented

@Sliim I'm sorry, the trackid is lost now. It went out of my shell buffer.

What I can tell you is that this was probably an API Issue. SC did not deliver the data the script expected for whatever reason. I think it's best to retry it a few times. Restarting the script helped for me.

The API also does other weird things like returning 401s when it shouldn't? (https://twitter.com/bong0/status/565103161325924353)

commented

Hmm ok, I will look to implement a retry system when download fail, and go to the next track if max retry is reached.

For the 401 error, do you set a correct client-id to the script ? (sc-syncer can determine itself the client id to use due to some change in the soundcloud website)

commented

@Sliim yep that would also be my solution for that.

Yes the client ID is indeed valid. It's from an application I registered for that purpose and also works for all the other tracks. Auto determining the client_id does not work anyway for me.

commented

Yeah! Sorry, I meant "sc-syncer can't determine itself the client id to use due to some change in the soundcloud website" in my last comment.. :)

commented

@Sliim Aah okay. It makes more sense for me anyway that everyone uses it's own client id. It's no point where I would expect a fix.

commented

Hi!

soundcloud-syncer 0.3.1 should fix this issue ;).
The default number of retry is 3, it can be customized with -R option.
If the maximum retry is reached, sc-syncer go to the next track.