Added get_metadata into base songs

This commit is contained in:
Manuel Cortez 2020-07-08 13:14:50 -05:00
parent dae1df79ad
commit 6aeffd57bb

View File

@ -31,6 +31,14 @@ class baseInterface(object):
def transcoder_enabled(self): def transcoder_enabled(self):
return False return False
def get_metadata(self, item):
data = dict()
keys = ["title", "album", "artist", "tracknumber"]
for k in keys:
if hasattr(item, k):
data[k] = getattr(item, k)
return data
class song(object): class song(object):
""" Represents a song in all services. Data will be filled by the service itself""" """ Represents a song in all services. Data will be filled by the service itself"""
@ -51,6 +59,9 @@ class song(object):
def get_download_url(self): def get_download_url(self):
self.download_url = self.extractor.get_download_url(self.url) self.download_url = self.extractor.get_download_url(self.url)
def get_metadata(self):
return self.extractor.get_metadata(self)
class baseSettings(wx.Panel): class baseSettings(wx.Panel):
config_section = "base" config_section = "base"