forked from rc/aircox
name fix
This commit is contained in:
@ -10,6 +10,7 @@ import tzlocal
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils import timezone as tz
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from aircox import settings
|
||||
from aircox.models import Station, Sound, Port
|
||||
@ -63,15 +64,15 @@ class BaseMetadata:
|
||||
if data:
|
||||
self.validate(data)
|
||||
|
||||
def validate_status(self, status):
|
||||
def validate_status(self, status, i18n=False):
|
||||
on_air = self.controller.source
|
||||
if on_air and status == 'playing' and (on_air == self or
|
||||
on_air.rid == self.rid):
|
||||
return 'playing'
|
||||
return _('playing') if i18n else 'playing'
|
||||
elif status == 'playing':
|
||||
return 'paused'
|
||||
return _('paused') if i18n else 'paused'
|
||||
else:
|
||||
return 'stopped'
|
||||
return _('stopped') if i18n else 'stopped'
|
||||
|
||||
def validate_air_time(self, air_time):
|
||||
if air_time:
|
||||
|
@ -2,10 +2,10 @@ from django.contrib import admin
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from . import viewsets
|
||||
from .views import StreamerAdminView
|
||||
from .views import StreamerAdminMixin
|
||||
|
||||
|
||||
admin.site.route_view('tools/streamer', StreamerAdminView.as_view(),
|
||||
admin.site.route_view('tools/streamer', StreamerAdminMixin.as_view(),
|
||||
'tools-streamer', label=_('Streamer Monitor'))
|
||||
|
||||
streamer_prefix = 'streamer/(?P<station_pk>[0-9]+)/'
|
||||
|
@ -1,10 +1,10 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from aircox.views.admin import BaseAdminView
|
||||
from aircox.views.admin import AdminMixin
|
||||
|
||||
|
||||
class StreamerAdminView(BaseAdminView, TemplateView):
|
||||
class StreamerAdminMixin(AdminMixin, TemplateView):
|
||||
template_name = 'aircox_streamer/streamer.html'
|
||||
title = _('Streamer Monitor')
|
||||
|
||||
|
Reference in New Issue
Block a user