From fd7bd7a70467a3e4412a277b9ca1768bc26fc959 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 22 Nov 2011 17:49:38 +0100 Subject: [PATCH] no manual data if item has imdb id --- pandora/clip/models.py | 7 +++++-- pandora/item/models.py | 5 +++++ static/js/pandora/filesView.js | 16 +++++++++------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/pandora/clip/models.py b/pandora/clip/models.py index e8c19457..a85468ac 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -11,8 +11,11 @@ import managers class MetaClip: def update_calculated_values(self): - start = min(self.start, self.item.sort.duration) - end = min(self.end, self.item.sort.duration) + start = self.start + end = self.end + if self.item.sort.duration: + start = min(self.start, self.item.sort.duration) + end = min(self.end, self.item.sort.duration) self.duration = end - start if self.duration > 0: self.hue, self.saturation, self.lightness = extract.average_color( diff --git a/pandora/item/models.py b/pandora/item/models.py index be10eabb..0e3f31be 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -290,6 +290,11 @@ class Item(models.Model): if settings.USE_IMDB and len(self.itemId) != 7 and self.oxdbId != self.itemId: self.itemId = self.oxdbId #FIXME: move files to new id here + if settings.USE_IMDB and len(self.itemId) == 7: + for key in ('title', 'year', 'director', 'season', 'episode', + 'seriesTitle', 'episodeTitle'): + if key in self.data: + del self.data[key] if self.poster and os.path.exists(self.poster.path): self.poster_height = self.poster.height diff --git a/static/js/pandora/filesView.js b/static/js/pandora/filesView.js index 219ca63f..b3770f62 100644 --- a/static/js/pandora/filesView.js +++ b/static/js/pandora/filesView.js @@ -402,13 +402,15 @@ pandora.ui.filesView = function(options, self) { data[key] = self['$' + key + 'Input'].value(); }); pandora.api.moveFiles(data, function(result) { - if (self.$checkbox.value()) { - Ox.Request.clearCache(); // fixme: remove - pandora.UI.set({item: result.data.itemId}); - } else { - Ox.Log('', 'moved', self.selected, result.data.itemId); - self.$filesList.reloadList(); - self.$instancesList.reloadList(); + if(pandora.user.ui.item == self.options.id && pandora.user.ui.itemView == 'files') { + if (self.$checkbox.value()) { + Ox.Request.clearCache(); // fixme: remove + pandora.UI.set({item: result.data.itemId}); + } else { + Ox.Log('', 'moved', self.selected, result.data.itemId); + self.$filesList.reloadList(); + self.$instancesList.reloadList(); + } } }); }