mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Fixing error 34
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
from time import time
|
||||
|
||||
|
||||
class Song:
|
||||
def __init__(self, identifier: str, playlist, requester: str) -> None:
|
||||
self.__identifier = identifier
|
||||
self.__info = {'requester': requester}
|
||||
self.__problematic = False
|
||||
self.__playlist = playlist
|
||||
self.__downloadTime: int = time()
|
||||
|
||||
def finish_down(self, info: dict) -> None:
|
||||
if info is None or info == {}:
|
||||
self.destroy()
|
||||
return None
|
||||
|
||||
self.__downloadTime = time()
|
||||
self.__useful_keys = ['duration',
|
||||
'title', 'webpage_url',
|
||||
'channel', 'id', 'uploader',
|
||||
@@ -35,6 +40,10 @@ class Song:
|
||||
self.__info['title'] = ''.join(char if char.isalnum() or char ==
|
||||
' ' else ' ' for char in self.__info['title'])
|
||||
|
||||
@property
|
||||
def downloadTime(self) -> int:
|
||||
return self.__downloadTime
|
||||
|
||||
@property
|
||||
def source(self) -> str:
|
||||
if 'url' in self.__info.keys():
|
||||
@@ -42,6 +51,10 @@ class Song:
|
||||
else:
|
||||
return None
|
||||
|
||||
@source.setter
|
||||
def source(self, value) -> None:
|
||||
self.__info['url'] = value
|
||||
|
||||
@property
|
||||
def title(self) -> str:
|
||||
if 'title' in self.__info.keys():
|
||||
@@ -53,13 +66,17 @@ class Song:
|
||||
def duration(self) -> str:
|
||||
if 'duration' in self.__info.keys():
|
||||
return self.__info['duration']
|
||||
else:
|
||||
return 0.0
|
||||
else: # Default minimum duration
|
||||
return 5.0
|
||||
|
||||
@property
|
||||
def identifier(self) -> str:
|
||||
return self.__identifier
|
||||
|
||||
@identifier.setter
|
||||
def identifier(self, value) -> None:
|
||||
self.__identifier = value
|
||||
|
||||
@property
|
||||
def problematic(self) -> bool:
|
||||
return self.__problematic
|
||||
|
||||
Reference in New Issue
Block a user