forked from 0x2620/pandora
dont save files with _1
This commit is contained in:
parent
6a22dba8fa
commit
a9ae0ab5e6
3 changed files with 17 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division
|
||||
from __future__ import division, with_statement
|
||||
|
||||
import os.path
|
||||
import re
|
||||
|
|
@ -243,12 +243,13 @@ class File(models.Model):
|
|||
resolution=config['resolutions'][0],
|
||||
format=config['formats'][0])
|
||||
if created:
|
||||
stream.video.save(stream.name(), chunk)
|
||||
stream.video.name = stream.name()
|
||||
with open(stream.video.path, 'w') as f:
|
||||
f.write(chunk.read())
|
||||
else:
|
||||
f = open(stream.video.path, 'a')
|
||||
#FIXME: should check that chunk_id/offset is right
|
||||
f.write(chunk.read())
|
||||
f.close()
|
||||
with open(stream.video.path, 'a') as f:
|
||||
#FIXME: should check that chunk_id/offset is right
|
||||
f.write(chunk.read())
|
||||
if done:
|
||||
stream.available = True
|
||||
stream.save()
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ def upload(request):
|
|||
#float required?
|
||||
position = float(os.path.splitext(name)[0])
|
||||
fr, created = models.Frame.objects.get_or_create(file=f, position=position)
|
||||
if fr.frame:
|
||||
fr.frame.delete()
|
||||
fr.frame.save(name, frame)
|
||||
os.chmod(fr.frame.path, 0644)
|
||||
f.item.select_frame()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue