We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 55d548cd authored by Daniel Watkins's avatar Daniel Watkins

Add storage of NowPlaying expiries.

parent 18af5d75
......@@ -131,11 +131,19 @@ class Md5Password(models.Model):
class NowPlaying(models.Model):
user = models.OneToOneField(GobblerUser, primary_key=True)
track = models.ForeignKey(Track)
expires = models.DateTimeField(editable=False)
def artist(self):
return self.track.album.artist
def save(self, force_insert=False, force_update=False):
if self.track.length is not None:
self.expires = datetime.now() + self.track.length
self.expires = datetime.now() + 300
super(NowPlaying, self).save(force_insert, force_update)
def __unicode__(self):
return "%s is playing %s" % (self.user, self.track)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment