Miserlou / SoundScrape

SoundCloud (and Bandcamp and Mixcloud) downloader in Python.
MIT License
1.42k stars 146 forks source link

Time Limit for SoundCloud (Other services not implemented) - FIXED #179

Open gamemasta0 opened 7 years ago

gamemasta0 commented 7 years ago

Code was causing errors when a time limit wasn't set. I've added sanity checks. This should fix the errors thrown in the tests from that.

From the last pull request:

-Added a parser argument “-T, --time-limit” that accepts a duration (hh:mm:ss) to act as an upper limit so songs longer than it will not be downloaded. (example usage: “soundscrape itsvestige -l -T 10:00” will download all of Vestige’s likes that are 10 minutes or less in length)

-Added code to check the track’s duration against the upper limit parameter and output a warning string if limits are exceeded indicating that a download has been prevented.

-Added functions to resolve time to string and string to time. (Note: internally, SoundCloud uses milliseconds for duration. It is assumed that most users will not be so specific as to prevent durations as precise as the millisecond level so for all calculations, durations are converted to seconds)

gamemasta0 commented 7 years ago

Just looked at the log, I'm not sure why it's getting a KeyError on 'time_limit'. When I set a breakpoint at that line of code the key is defined properly and has a value

Edit: Just checked test.py, it seems that it was calling process_soundcloud directly with its own vargs dictionary not adhering to the argument parser in soundscrape.py. This was causing the KeyError since I had assumed that the default value for key 'time_limit' set by the parser would always be present. The remaining errors do not seem to be related to the time_limit code since all errors are present in the other recent pull requests as well.

gamemasta0 commented 7 years ago

@Miserlou It appears the issues that were detected by The Travis CI build also occur on the master branch, I just ran test.py on a clean version and the three errors are present. Can you take a look?

gamemasta0 commented 7 years ago

Just added some code to avoid downloading duplicate files. Some files that had a .wav version were being redownloaded and overwritten and some artists on SoundCloud change their name so a song would be redownloaded. Now the program either asks for desired behavior (on -A) or skips the similar files automatically (on -s)

tsoernes commented 6 years ago

@gamemasta0 Could you see if you can make the CI tests pass

Lanchon commented 4 years ago

you can't generate a PR in master. you have to create a branch for the PR. the PR is live and whenever you commit to its branch it is updated.