| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- class Model:
- def __init__(self, id_=None):
- self.id = id_
- def as_fields_and_values(self):
- fields, values = [], []
- for attr, val in self.__dict__.items():
- if attr[0] == '_':
- continue
- fields.append(attr)
- values.append(val)
- return fields, values
- class MusicFolder(Model):
- STATUS_UNKNOWN = 0
- STATUS_FOUND = 1
- STATUS_UNAVAILABLE = 2
- STATUS_DELETED = 3
- def __init__(self, id_=None, path_=None, last_scan=None, status=None):
- super().__init__(id_)
- self.path = path_
- self.last_scan = last_scan
- self.status = status if status is not None else MusicFolder.STATUS_UNKNOWN
- class Profile(Model):
- def __init__(self, id_=None, name=None, created_on=None):
- super().__init__(id_)
- self.name = name
- self.created_on = created_on
- class Tag(Model):
- def __init__(self, id_=None, label=None, color=None, deleted=0):
- super().__init__(id_)
- self.label = label
- self.color = color
- self.deleted = deleted
- class Track(Model):
- def __init__(self, id_=None, profile_id=None, music_folder_id=None, name=None,
- format_=None, artist=None, album=None, track_num=None, year=None,
- duration=None, size=None, note=None, status=None, path_=None,
- hash_=None, origin=None):
- super().__init__(id_)
- self.profile_id = profile_id
- self.music_folder_id = music_folder_id
- self.name = name
- self.format = format_
- self.artist = artist
- self.album = album
- self.track_num = track_num
- self.year = year
- self.duration = duration
- self.size = size
- self.note = note
- self.status = status
- self.path = path_
- self.hash = hash_
- self.origin = origin
- class TrackTag(Model):
- def __init__(self, id_=None, track_id=None, tag_id=None):
- super().__init__(id_)
- self.track_id = track_id
- self.tag_id = tag_id
|