2018-01-23 13:39:49 -06:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
|
|
|
|
class song(object):
|
|
|
|
""" Represents a song in all services. Data will be filled by the service itself"""
|
|
|
|
|
2018-01-26 11:52:18 -06:00
|
|
|
def __init__(self, extractor):
|
|
|
|
self.extractor = extractor
|
2018-01-23 13:39:49 -06:00
|
|
|
self.bitrate = 0
|
|
|
|
self.title = ""
|
|
|
|
self.artist = ""
|
|
|
|
self.duration = ""
|
|
|
|
self.size = 0
|
2018-01-24 17:41:18 -06:00
|
|
|
self.url = ""
|
2018-01-25 17:18:51 -06:00
|
|
|
self.download_url = ""
|
2018-01-24 17:41:18 -06:00
|
|
|
|
|
|
|
def format_track(self):
|
2018-02-27 10:54:06 -06:00
|
|
|
if self.size != 0:
|
|
|
|
return "{0}. {1}. {2}".format(self.title, self.duration, self.size)
|
|
|
|
else:
|
|
|
|
return "{0} {1}".format(self.title, self.duration)
|
2018-01-26 11:52:18 -06:00
|
|
|
|
|
|
|
def get_download_url(self):
|
|
|
|
self.download_url = self.extractor.get_download_url(self.url)
|