From 499b6ac2046b5ae0587ba8bd7745ded3b44cdffa Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 23 Oct 2011 18:19:47 +0200 Subject: [PATCH 1/3] ignore multiple files at once --- pandora/archive/views.py | 41 ++++++++++++++++++++++++++++++++++ static/js/pandora/filesView.js | 21 ++++++++++++++--- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 068f83bde..e5aae6124 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -280,6 +280,47 @@ def moveFiles(request): return render_to_json_response(response) actions.register(moveFiles, cache=False) +@login_required_json +def editFiles(request): + ''' + change file / item link + param data { + ids: ids of files + part: + language: + ignore: boolean + } + + return { + status: {'code': int, 'text': string}, + data: { + } + } + ''' + data = json.loads(request.POST['data']) + files = models.File.objects.filter(oshash__in=data['ids']) + response = json_response() + #FIXME: only editable files! + if True: + if 'ignore' in data: + models.Instance.objects.filter(file__in=files).update(ignore=data['ignore']) + files.update(auto=True) + #FIXME: is this to slow to run sync? + for i in Item.objects.filter(files__in=files).distinct(): + i.update_selected() + i.update_wanted() + response = json_response(status=200, text='updated') + updates = {} + for key in ('part', 'language'): + if key in data: + updates[key] = data[key] + if updates: + files.update(**updates) + response = json_response(status=200, text='updated') + else: + response = json_response(status=403, text='permissino denied') + return render_to_json_response(response) +actions.register(editFiles, cache=False) @login_required_json def editFile(request): diff --git a/static/js/pandora/filesView.js b/static/js/pandora/filesView.js index 75314d1a0..e67162cfb 100644 --- a/static/js/pandora/filesView.js +++ b/static/js/pandora/filesView.js @@ -33,15 +33,27 @@ pandora.ui.filesView = function(options, self) { }) .appendTo(self.$toolbar); - self.$moveButton = Ox.Button({ + self.$ignoreButton = Ox.Button({ disabled: 'true', - title: 'Move Selected Files...' + title: 'Ignore Selected Files...' }) .css({ float: 'right', margin: '4px' }) - .appendTo(self.$toolbar); + .appendTo(self.$toolbar) + .bindEvent({ + click: function() { + var data = { + ids: self.selected, + ignore: true + }; + pandora.api.editFiles(data, function(result) { + Ox.Request.clearCache(); + self.$filesList.reloadList(); + }); + } + }); self.$filesList = Ox.TextList({ columns: [ @@ -417,6 +429,9 @@ pandora.ui.filesView = function(options, self) { self.$moveButton.options({ disabled: self.selected.length === 0 }); + self.$ignoreButton.options({ + disabled: self.selected.length === 0 + }); } return that; From ed6bcebae6bf7a7e5a2fbd707291d16b4b9a1460 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 23 Oct 2011 23:47:22 +0200 Subject: [PATCH 2/3] remove striped poster --- pandora/item/models.py | 3 ++- pandora/item/views.py | 2 +- static/png/poster.png | Bin 0 -> 110 bytes static/png/posterDark.48.png | Bin 180 -> 0 bytes 4 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 static/png/poster.png delete mode 100644 static/png/posterDark.48.png diff --git a/pandora/item/models.py b/pandora/item/models.py index 5f9ea8ddf..9f4c59f52 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -947,7 +947,8 @@ class Item(models.Model): if settings.USE_IMDB: if len(self.itemId) == 7: cmd += ['-i', self.itemId] - cmd += ['-o', self.oxdbId] + oxdbId = self.oxdbId or self.oxdb_id() or self.ItemId + cmd += ['-o', oxdbId] else: cmd += ['-i', self.itemId] ox.makedirs(os.path.join(settings.MEDIA_ROOT,self.path())) diff --git a/pandora/item/views.py b/pandora/item/views.py index 4581cc479..e52d394a0 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -690,7 +690,7 @@ def poster(request, id, size=None): if item.poster: return image_to_response(item.poster, size) else: - poster_path = os.path.join(settings.STATIC_ROOT, 'png/posterDark.48.png') + poster_path = os.path.join(settings.STATIC_ROOT, 'png/poster.png') response = HttpFileResponse(poster_path, content_type='image/jpeg') response['Cache-Control'] = 'no-cache' return response diff --git a/static/png/poster.png b/static/png/poster.png new file mode 100644 index 0000000000000000000000000000000000000000..8659c91db5f1c62bb8c12961b37a3cd0adff678b GIT binary patch literal 110 zcmeAS@N?(olHy`uVBq!ia0vp^0YKcq!2~3QeJig5DN|1u$B>FSZx0$W0(plPeD%-e gD7eiHS)` zNl8mfD<~)^Dk@I&URnoK6YlBa7@`sU_S{Cn1_cq8i^9@BuD48a=#tG4c4v0_>t;}F zJ0a)Oq}DGJpXapSI=v$;e}%kHvgq5yl(mOut~kahrEVc^!7q`1FjC_f?wowE de|taDUSi5}&#bvNB0wt`JYD@<);T3K0RYOvIy3+P From 49674a51b7737dacb8971cc340c1c3fccf3a01ac Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 24 Oct 2011 00:03:41 +0200 Subject: [PATCH 3/3] show video preview only if item is rendered --- static/js/pandora/info.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index 2cf7b2c83..412d13d3d 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -66,8 +66,11 @@ pandora.ui.info = function() { previousView == 'video' && resizeInfo(); }); } else if (view == 'video') { - pandora.api.get({id: id, keys: ['duration', 'videoRatio']}, function(result) { - if (result.data) { + pandora.api.get({ + id: id, + keys: ['duration', 'rendered', 'videoRatio'] + }, function(result) { + if (result.data && result.data.rendered) { pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement(); pandora.$ui.videoPreview = pandora.ui.videoPreview({ duration: result.data.duration,