Gracefully retrieve uploaded songs with a blank duration (#578) (#580)

* add unit test that attempts to retrieve a song after its been uploaded

* prevent parsing errors when an uploaded song lacks a duration

* update unit test to delete/re-upload song if it already is uploaded

* format

* fix test

* add another sleep to end2end playlist

---------

Co-authored-by: sigma67 <ytmusicapi@gmail.com>
This commit is contained in:
Alex Pastel 2024-05-11 10:23:11 -06:00 • committed by GitHub
commit ae966bb96a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 2 deletions

View file

@ -61,7 +61,8 @@ def get_dot_separator_index(runs):
def parse_duration(duration):
if duration is None:
# duration may be falsy or a single space: ' '
if not duration or not duration.strip():
return duration
mapped_increments = zip([1, 60, 3600], reversed(duration.split(":")))
seconds = sum(multiplier * int(time) for multiplier, time in mapped_increments)