11
11
from ytmusic_deleter import cli
12
12
from ytmusic_deleter import common
13
13
from ytmusicapi import YTMusic
14
+ from ytmusicapi .models .content .enums import LikeStatus
14
15
15
16
16
17
def get_resource (file : str ) -> str :
@@ -321,7 +322,7 @@ def cleanup_library(yt_browser: YTMusic):
321
322
322
323
@pytest .fixture (name = "add_library_album" )
323
324
def fixture_add_library_album (yt_browser : YTMusic , sample_album_as_playlist ):
324
- response = yt_browser .rate_playlist (sample_album_as_playlist , common .LIKE )
325
+ response = yt_browser .rate_playlist (sample_album_as_playlist , LikeStatus .LIKE )
325
326
assert "actions" in response
326
327
327
328
# Wait for album to finish processing
@@ -362,7 +363,7 @@ def fixture_add_library_song(yt_browser: YTMusic, sample_album_browse_id):
362
363
363
364
@pytest .fixture (name = "add_podcast" )
364
365
def fixture_add_podcast (yt_browser : YTMusic , sample_podcast ):
365
- response = yt_browser .rate_playlist (sample_podcast , common .LIKE )
366
+ response = yt_browser .rate_playlist (sample_podcast , LikeStatus .LIKE )
366
367
assert "actions" in response
367
368
368
369
# Wait for podcast to be in library
@@ -380,7 +381,7 @@ def fixture_add_podcast(yt_browser: YTMusic, sample_podcast):
380
381
381
382
@pytest .fixture (name = "like_song" )
382
383
def fixture_like_song (yt_browser : YTMusic , sample_video ):
383
- response = yt_browser .rate_song (sample_video , common .LIKE )
384
+ response = yt_browser .rate_song (sample_video , LikeStatus .LIKE )
384
385
assert "actions" in response
385
386
386
387
# Wait for song to finish processing
@@ -397,7 +398,7 @@ def fixture_like_song(yt_browser: YTMusic, sample_video):
397
398
time .sleep (2 )
398
399
399
400
# Remove song from library to clean up
400
- yt_browser .rate_playlist ("OLAK5uy_lZ90LvUqQdKrByCbk99v54d8XpUOmFavo" , common .INDIFFERENT )
401
+ yt_browser .rate_playlist ("OLAK5uy_lZ90LvUqQdKrByCbk99v54d8XpUOmFavo" , LikeStatus .INDIFFERENT )
401
402
402
403
403
404
@pytest .fixture (name = "like_songs" )
@@ -408,9 +409,9 @@ def fixture_like_songs(yt_browser: YTMusic, medium_song_list):
408
409
if any (common .string_exists_in_dict (existing_like , song ) for existing_like in existing_likes ):
409
410
print (f"Song { song !r} was already in likes..." )
410
411
continue
411
- response = yt_browser .rate_song (song , common .LIKE )
412
+ response = yt_browser .rate_song (song , LikeStatus .LIKE )
412
413
while num_retries > 0 and (not common .string_exists_in_dict (response , "consistencyTokenJar" )):
413
- response = yt_browser .rate_song (song , common .LIKE )
414
+ response = yt_browser .rate_song (song , LikeStatus .LIKE )
414
415
num_retries -= 1
415
416
if num_retries == 0 :
416
417
pytest .fail (f"Ran out of tries to add song { song !r} to likes." )
@@ -423,13 +424,13 @@ def fixture_like_songs(yt_browser: YTMusic, medium_song_list):
423
424
@pytest .fixture (name = "like_many_songs" )
424
425
def fixture_like_many_songs (yt_browser : YTMusic , long_song_list ):
425
426
for song in long_song_list :
426
- response = yt_browser .rate_song (song , common .LIKE )
427
+ response = yt_browser .rate_song (song , LikeStatus .LIKE )
427
428
num_retries = 300
428
429
while num_retries > 0 and (
429
430
not common .string_exists_in_dict (response , "Removed from liked music" )
430
431
or not common .string_exists_in_dict (response , "consistencyTokenJar" )
431
432
):
432
- response = yt_browser .rate_song (song , common .LIKE )
433
+ response = yt_browser .rate_song (song , LikeStatus .LIKE )
433
434
num_retries -= 1
434
435
435
436
0 commit comments