forked from rc/aircox
remove old cms, switch to wagtail; move website to cms
This commit is contained in:
@ -175,6 +175,6 @@ class ScheduleAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(Track)
|
||||
class TrackAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'title', 'artist', 'position', 'pos_in_secs', 'related']
|
||||
list_display = ['id', 'title', 'artist', 'position', 'in_seconds', 'related']
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -64,12 +64,12 @@ class Importer:
|
||||
maps = settings.AIRCOX_IMPORT_PLAYLIST_CSV_COLS
|
||||
tracks = []
|
||||
|
||||
pos_in_secs = ('minutes' or 'seconds') in maps
|
||||
in_seconds = ('minutes' or 'seconds') in maps
|
||||
for index, line in enumerate(self.data):
|
||||
position = \
|
||||
int(self.__get(line, 'minutes', 0)) * 60 + \
|
||||
int(self.__get(line, 'seconds', 0)) \
|
||||
if pos_in_secs else index
|
||||
if in_seconds else index
|
||||
|
||||
track, created = Track.objects.get_or_create(
|
||||
related_type = ContentType.objects.get_for_model(related),
|
||||
@ -79,7 +79,7 @@ class Importer:
|
||||
position = position,
|
||||
)
|
||||
|
||||
track.pos_in_secs = pos_in_secs
|
||||
track.in_seconds = pos_in_secs
|
||||
track.info = self.__get(line, 'info')
|
||||
tags = self.__get(line, 'tags')
|
||||
if tags:
|
||||
|
@ -348,6 +348,10 @@ class Schedule(models.Model):
|
||||
help_text = 'this schedule is a rerun of this one',
|
||||
)
|
||||
|
||||
@property
|
||||
def end(self):
|
||||
return self.date + utils.to_timedelta(self.duration)
|
||||
|
||||
def match(self, date = None, check_time = True):
|
||||
"""
|
||||
Return True if the given datetime matches the schedule
|
||||
@ -746,9 +750,9 @@ class Track(Related):
|
||||
_('artist'),
|
||||
max_length = 128,
|
||||
)
|
||||
position = models.SmallIntegerField(
|
||||
default = 0,
|
||||
help_text=_('position in the playlist'),
|
||||
tags = TaggableManager(
|
||||
verbose_name=_('tags'),
|
||||
blank=True,
|
||||
)
|
||||
info = models.CharField(
|
||||
_('information'),
|
||||
@ -757,12 +761,12 @@ class Track(Related):
|
||||
help_text=_('additional informations about this track, such as '
|
||||
'the version, if is it a remix, features, etc.'),
|
||||
)
|
||||
tags = TaggableManager(
|
||||
verbose_name=_('tags'),
|
||||
blank=True,
|
||||
position = models.SmallIntegerField(
|
||||
default = 0,
|
||||
help_text=_('position in the playlist'),
|
||||
)
|
||||
pos_in_secs = models.BooleanField(
|
||||
_('seconds'),
|
||||
in_seconds = models.BooleanField(
|
||||
_('in seconds'),
|
||||
default = False,
|
||||
help_text=_('position in the playlist is expressed in seconds')
|
||||
)
|
||||
|
Reference in New Issue
Block a user