forked from rc/aircox
streamer sound uri/path
This commit is contained in:
@ -46,7 +46,13 @@ class SoundQuerySet(models.QuerySet):
|
||||
""" Return sounds that are archives """
|
||||
return self.filter(type=Sound.TYPE_ARCHIVE)
|
||||
|
||||
def paths(self, archive=True, order_by=True):
|
||||
def path(self, paths):
|
||||
if isinstance(paths, str):
|
||||
return self.filter(file=paths.replace(conf.MEDIA_ROOT + '/', ''))
|
||||
return self.filter(file__in=(p.replace(conf.MEDIA_ROOT + '/', '')
|
||||
for p in paths))
|
||||
|
||||
def playlist(self, archive=True, order_by=True):
|
||||
"""
|
||||
Return files absolute paths as a flat list (exclude sound without path).
|
||||
If `order_by` is True, order by path.
|
||||
@ -104,6 +110,7 @@ class Sound(models.Model):
|
||||
|
||||
file = models.FileField(
|
||||
_('file'), upload_to=_upload_to, max_length=256,
|
||||
db_index=True,
|
||||
)
|
||||
duration = models.TimeField(
|
||||
_('duration'),
|
||||
|
Reference in New Issue
Block a user