25 lines
562 B
Python
25 lines
562 B
Python
# Copyright 2021 (c) Anna Schumaker.
|
|
from gi.repository import GObject
|
|
|
|
tracks = { }
|
|
|
|
class FakeTrack(GObject.GObject):
|
|
def __init__(self, n, tag=None):
|
|
GObject.GObject.__init__(self)
|
|
self.trackid = n
|
|
self.length = n
|
|
self.tag = tag
|
|
|
|
def __int__(self):
|
|
return self.trackid
|
|
|
|
def add_to_playlist(self, name):
|
|
self.tag.add_track(self)
|
|
|
|
def remove_from_playlist(self, name):
|
|
self.tag.remove_track(self)
|
|
|
|
|
|
def Track(n, tag=None):
|
|
return tracks.setdefault((n,tag), FakeTrack(n, tag=tag))
|