models.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. class Model:
  2. def __init__(self, id_=None):
  3. self.id = id_
  4. class MusicFolder(Model):
  5. STATUS_UNKNOWN = 0
  6. STATUS_FOUND = 1
  7. STATUS_UNAVAILABLE = 2
  8. STATUS_DELETED = 3
  9. def __init__(self, id_=None, path_=None, last_scan=None, status=None):
  10. super().__init__(id_)
  11. self.path = path_
  12. self.last_scan = last_scan
  13. self.status = status if status is not None else MusicFolder.STATUS_UNKNOWN
  14. class Profile(Model):
  15. def __init__(self, id_=None, name=None, created_on=None):
  16. super().__init__(id_)
  17. self.name = name
  18. self.created_on = created_on
  19. class Tag(Model):
  20. def __init__(self, id_=None, label=None, color=None, deleted=0):
  21. super().__init__(id_)
  22. self.label = label
  23. self.color = color
  24. self.deleted = deleted
  25. class Track(Model):
  26. def __init__(self, id_=None, profile_id=None, music_folder_id=None, name=None,
  27. format_=None, artist=None, album=None, track_num=None, year=None,
  28. duration=None, size=None, note=None, status=None, path_=None,
  29. hash_=None, origin=None):
  30. super().__init__(id_)
  31. self.profile_id = profile_id
  32. self.music_folder_id = music_folder_id
  33. self.name = name
  34. self.format = format_
  35. self.artist = artist
  36. self.album = album
  37. self.track_num = track_num
  38. self.year = year
  39. self.duration = duration
  40. self.size = size
  41. self.note = note
  42. self.status = status
  43. self.path = path_
  44. self.hash = hash_
  45. self.origin = origin
  46. class TrackTag(Model):
  47. def __init__(self, id_=None, track_id=None, tag_id=None):
  48. super().__init__(id_)
  49. self.track_id = track_id
  50. self.tag_id = tag_id