use first format by default

This commit is contained in:
j 2025-01-31 12:33:34 +05:30
commit 0da9097a6a
2 changed files with 4 additions and 2 deletions

View file

@ -553,7 +553,7 @@ class File(models.Model):
def process_stream(self): def process_stream(self):
''' '''
extract derivatives from webm upload extract derivatives from stream upload
''' '''
from . import tasks from . import tasks
return tasks.process_stream.delay(self.id) return tasks.process_stream.delay(self.id)

View file

@ -1004,7 +1004,9 @@ def download_source(request, id, part=None):
response['Content-Disposition'] = "attachment; filename*=UTF-8''%s" % quote(filename.encode('utf-8')) response['Content-Disposition'] = "attachment; filename*=UTF-8''%s" % quote(filename.encode('utf-8'))
return response return response
def download(request, id, resolution=None, format='webm', part=None): def download(request, id, resolution=None, format=None, part=None):
if format is None:
format = settings.CONFIG['video']['formats'][0]
item = get_object_or_404(models.Item, public_id=id) item = get_object_or_404(models.Item, public_id=id)
if not resolution or int(resolution) not in settings.CONFIG['video']['resolutions']: if not resolution or int(resolution) not in settings.CONFIG['video']['resolutions']:
resolution = max(settings.CONFIG['video']['resolutions']) resolution = max(settings.CONFIG['video']['resolutions'])