fix torrent path, set rendered to false if uploading again

This commit is contained in:
j 2012-04-18 11:11:12 +02:00
parent 98ecd817ba
commit 7f96b34e54
3 changed files with 4 additions and 2 deletions

View file

@ -149,7 +149,7 @@ class File(models.Model):
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if self.auto: if self.auto:
self.set_state() self.set_state()
self.sort_path= utils.sort_string(self.path) self.sort_path = utils.sort_string(self.path)
if self.is_subtitle: if self.is_subtitle:
self.available = self.data and True or False self.available = self.data and True or False
else: else:

View file

@ -255,6 +255,8 @@ def firefogg_upload(request):
f.delete_frames() f.delete_frames()
f.uploading = True f.uploading = True
f.save() f.save()
if f.item.rendered and f.selected:
Item.objects.filter(id=f.item.id).update(rendered=False)
response = { response = {
'uploadUrl': request.build_absolute_uri('/api/upload/?id=%s&profile=%s' % (f.oshash, profile)), 'uploadUrl': request.build_absolute_uri('/api/upload/?id=%s&profile=%s' % (f.oshash, profile)),
'url': request.build_absolute_uri('/%s' % f.item.itemId), 'url': request.build_absolute_uri('/%s' % f.item.itemId),

View file

@ -1009,7 +1009,7 @@ class Item(models.Model):
meta['piece_size_pow2'] = piece_size_pow2 meta['piece_size_pow2'] = piece_size_pow2
ox.torrent.createTorrent(video, settings.TRACKER_URL, meta) ox.torrent.createTorrent(video, settings.TRACKER_URL, meta)
self.torrent.name = self.path('torrent/%s.torrent' % self.get('title')) self.torrent.name = torrent[len(settings.MEDIA_ROOT)+1:]
self.save() self.save()
def streams(self): def streams(self):