Skip to content

Commit

Permalink
Allow for playlists that don't specify track duration (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
fijam committed Oct 2, 2022
1 parent bab2ca1 commit 39bd397
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def request_playlist_content(args):
for i in range(item_count):
track_name = response.json()['playlistItems']['items'][i]['columns'][0]
t_list.append(track_name)
total_time += int(response.json()['playlistItems']['items'][i]['columns'][1])
track_duration = response.json()['playlistItems']['items'][i]['columns'][1].strip()
if track_duration.isdecimal():
total_time += int(track_duration)
print(f'Total playlist duration: {datetime.timedelta(seconds=total_time)}')
if total_time >= 4800:
logging.warning('playlist duration exceeds 80 minutes!')
Expand Down

0 comments on commit 39bd397

Please sign in to comment.