2021-07-08 16:45:15 -04:00
|
|
|
# Copyright 2021 (c) Anna Schumaker.
|
2021-06-29 16:00:27 -04:00
|
|
|
from gi.repository import GObject
|
2021-07-08 16:45:15 -04:00
|
|
|
|
|
|
|
tracks = { }
|
|
|
|
|
2021-06-29 16:00:27 -04:00
|
|
|
class FakeTrack(GObject.GObject):
|
2021-07-07 14:06:56 -04:00
|
|
|
def __init__(self, n, tag=None):
|
2021-06-29 16:00:27 -04:00
|
|
|
GObject.GObject.__init__(self)
|
2021-07-08 16:45:15 -04:00
|
|
|
self.trackid = n
|
2021-07-08 16:55:56 -04:00
|
|
|
self.length = n
|
2021-07-07 14:06:56 -04:00
|
|
|
self.tag = tag
|
2021-07-08 16:45:15 -04:00
|
|
|
|
|
|
|
def __int__(self):
|
|
|
|
return self.trackid
|
|
|
|
|
2021-07-05 13:08:08 -04:00
|
|
|
def add_to_playlist(self, name):
|
|
|
|
self.tag.add_track(self)
|
|
|
|
|
2021-07-07 14:06:56 -04:00
|
|
|
def remove_from_playlist(self, name):
|
|
|
|
self.tag.remove_track(self)
|
2021-07-08 16:45:15 -04:00
|
|
|
|
2021-07-07 14:06:56 -04:00
|
|
|
|
|
|
|
def Track(n, tag=None):
|
|
|
|
return tracks.setdefault((n,tag), FakeTrack(n, tag=tag))
|