- New constant in const.py:
TRACK_STATS_URL = 'https://api.spotify.com/v1/audio-features/'
- New function in track.py:
get_song_duration(): makes a request to the API for audio features
which contain the song's duration in miliseconds. Converts miliseconds
to seconds.
- New function in utils.py:
get_downloaded_song_duration(): uses the subprocess module to run
an ffmpeg command that ouputs the duration of the song file in seconds.
Output is captured and returned as float.
So basically now in each directory created by zspotify
a .song_ids file will be created and appended to every
a song is installed in that directory.
Now, instead of checking if a file exists by name we're
checking with song id.