forked from rc/aircox
work on website's player
This commit is contained in:
@ -10,6 +10,7 @@ from django.utils import timezone as tz
|
||||
from django.utils.html import strip_tags
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.conf import settings as main_settings
|
||||
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
@ -152,6 +153,16 @@ class Sound(Nameable):
|
||||
mtime = mtime.replace(microsecond = 0)
|
||||
return tz.make_aware(mtime, tz.get_current_timezone())
|
||||
|
||||
def url(self):
|
||||
"""
|
||||
Return an url to the stream
|
||||
"""
|
||||
# path = self._meta.get_field('path').path
|
||||
path = self.path.replace(main_settings.MEDIA_ROOT, '', 1)
|
||||
#path = self.path.replace(path, '', 1)
|
||||
# print(path, self._meta.get_field('path').path)
|
||||
return path
|
||||
|
||||
def file_exists(self):
|
||||
"""
|
||||
Return true if the file still exists
|
||||
|
Reference in New Issue
Block a user