fix #650: playlists without track count in metadata now return trackCount=None
This commit is contained in:
parent
5478951ba3
commit
e433b22231
2 changed files with 4 additions and 4 deletions
|
|
@ -54,7 +54,7 @@ class TestPlaylists:
|
||||||
assert playlist["owned"] is False
|
assert playlist["owned"] is False
|
||||||
|
|
||||||
playlist = yt_oauth.get_playlist("RDATgXd-")
|
playlist = yt_oauth.get_playlist("RDATgXd-")
|
||||||
assert playlist["trackCount"] >= 100
|
assert playlist["trackCount"] is None # playlist has no trackCount
|
||||||
assert len(playlist["tracks"]) >= 100
|
assert len(playlist["tracks"]) >= 100
|
||||||
|
|
||||||
playlist = yt_oauth.get_playlist("PLj4BSJLnVpNyIjbCWXWNAmybc97FXLlTk", limit=None, related=True)
|
playlist = yt_oauth.get_playlist("PLj4BSJLnVpNyIjbCWXWNAmybc97FXLlTk", limit=None, related=True)
|
||||||
|
|
|
||||||
|
|
@ -151,9 +151,9 @@ class PlaylistsMixin(MixinProtocol):
|
||||||
song_count_text = second_subtitle_runs[has_views + 0]["text"]
|
song_count_text = second_subtitle_runs[has_views + 0]["text"]
|
||||||
song_count_search = re.findall(r"\d+", song_count_text)
|
song_count_search = re.findall(r"\d+", song_count_text)
|
||||||
# extract the digits from the text, return 0 if no match
|
# extract the digits from the text, return 0 if no match
|
||||||
song_count = to_int("".join(song_count_search)) if song_count_search is not None else 0
|
song_count = to_int("".join(song_count_search)) if song_count_search is not None else None
|
||||||
else:
|
else:
|
||||||
song_count = len(section_list["contents"])
|
song_count = None
|
||||||
|
|
||||||
playlist["trackCount"] = song_count
|
playlist["trackCount"] = song_count
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue