Adding Cleaner and fixing bugs

This commit is contained in:
Rafael Vargas
2022-03-26 14:45:27 -04:00
parent 362ec02fe4
commit f30513f710
15 changed files with 115 additions and 184 deletions

View File

@@ -2,17 +2,14 @@ from Music.Interfaces import ISong, IPlaylist
class Song(ISong):
"""Store the usefull information about a Song"""
def __init__(self, identifier: str, playlist: IPlaylist, requester: str) -> None:
"""Create a song with only the URL to the youtube song"""
self.__identifier = identifier
self.__info = {'requester': requester}
self.__problematic = False
self.__playlist: IPlaylist = playlist
def finish_down(self, info: dict) -> None:
"""Get and store the full information of the song"""
self.__usefull_keys = ['duration',
'title', 'webpage_url',
'channel', 'id', 'uploader',
@@ -34,7 +31,6 @@ class Song(ISong):
@property
def source(self) -> str:
"""Return the Song Source URL to play"""
if 'url' in self.__info.keys():
return self.__info['url']
else:
@@ -42,7 +38,6 @@ class Song(ISong):
@property
def title(self) -> str:
"""Return the Song Title"""
if 'title' in self.__info.keys():
return self.__info['title']
else:
@@ -50,7 +45,6 @@ class Song(ISong):
@property
def duration(self) -> str:
"""Return the Song Title"""
if 'duration' in self.__info.keys():
return self.__info['duration']
else:
@@ -65,7 +59,6 @@ class Song(ISong):
return self.__problematic
def destroy(self) -> None:
"""Mark this song with problems and removed from the playlist due to any type of error"""
print(f'DEVELOPER NOTE -> Music self destroying {self.__identifier}')
self.__problematic = True
self.__playlist.destroy_song(self)