]> git.0d.be Git - django-panik-nonstop.git/blobdiff - nonstop/models.py
trivial: fix misindentation
[django-panik-nonstop.git] / nonstop / models.py
index 2310a81c7b9d14b337fcdcf920e581c31447c882..06b6516b32b86aa4264ca3f9926c21e4ba02109f 100644 (file)
@@ -43,6 +43,12 @@ class Artist(models.Model):
         return SomaLogLine.objects.filter(filepath__track__artist=self
                 ).exclude(on_air=False).order_by('-play_timestamp')
 
+    def active_tracks(self):
+        return self.track_set.filter(nonstop_zones__isnull=False).distinct().order_by('title')
+
+    def available_tracks(self):
+        return self.track_set.filter(nonstop_zones__isnull=True).order_by('title')
+
 
 class Album(models.Model):
     name = models.CharField(_('Name'), max_length=255)
@@ -51,7 +57,9 @@ class Album(models.Model):
 LANGUAGES = [
     ('en', _('English')),
     ('fr', _('French')),
-    ('nl', _('Dutch'))
+    ('nl', _('Dutch')),
+    ('other', _('Other')),
+    ('na', _('Not applicable')),
 ]
 
 class Track(models.Model):
@@ -59,7 +67,7 @@ class Track(models.Model):
     artist = models.ForeignKey(Artist, null=True)
     album = models.ForeignKey(Album, null=True)
     instru = models.BooleanField(_('Instru'), default=False)
-    language = models.CharField(max_length=3,
+    language = models.CharField(max_length=10,
             choices=LANGUAGES, blank=True)
     sabam = models.BooleanField('SABAM', default=True)
     cfwb = models.BooleanField('CFWB', default=False)
@@ -89,7 +97,7 @@ class Track(models.Model):
             if os.path.exists(nfile.get_local_filepath()):
                 return nfile.get_local_filepath()
         if nfile:
-           return nfile.get_local_filepath()
+            return nfile.get_local_filepath()
         return None
 
     def file_exists(self):
@@ -229,6 +237,7 @@ class ScheduledDiffusion(models.Model):
     stream = models.ForeignKey(Stream, null=True, blank=True)
     creation_timestamp = models.DateTimeField(auto_now_add=True, null=True)
     added_to_nonstop_timestamp = models.DateTimeField(null=True)
+    auto_delayed = models.BooleanField(default=False)
 
     def __str__(self):
         return 'Diffusion of %s' % self.diffusion
@@ -322,6 +331,9 @@ class RecurringStreamOccurence(models.Model, RecurringOccurenceMixin):
     diffusion = models.ForeignKey(RecurringStreamDiffusion, on_delete=models.CASCADE)
     datetime = models.DateTimeField(_('Date/time'), db_index=True)
 
+    def __str__(self):
+        return 'Recurring stream of %s' % self.diffusion.stream
+
     @property
     def stream(self):
         return self.diffusion.stream