diff --git a/README b/README index 02505dec..83116ded 100644 --- a/README +++ b/README @@ -5,8 +5,9 @@ To setup a development instance of pan.do/ra, you need python, bazaar, pip and virtualenv and several other python modules: * Packages - apt-get install python-setuptools python-pip python-virtualenv ipython - apt-get install python-dev python-imaging python-numpy python-psycopg2 + apt-get install bzr git subversion mercurial \ + python-setuptools python-pip python-virtualenv ipython \ + python-dev python-imaging python-numpy python-psycopg2 bzr branch http://code.0x2620.org/pandora pandora cd pandora @@ -17,13 +18,12 @@ you need python, bazaar, pip and virtualenv and several other python modules: bzr branch http://code.0x2620.org/oxjs * Additional pandora tools: - You need current versions of mkvtoolnix, oxframe, oxtimeline installed. + You need current versions of oxframe, oxtimeline installed. For Ubuntu we provide these packages in a ppa: - sudo apt-get install python-software-properties - sudo add-apt-repository ppa:j/pandora - sudo add-apt-repository ppa:gstreamer-developers/ppa - sudo apt-get update - sudo apt-get install oxframe oxtimeline mkvtoolnix + apt-get install python-software-properties + add-apt-repository ppa:j/pandora + apt-get update + apt-get install oxframe oxtimeline * Database We use postgresql but other databases might also work diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 0d92e60f..57ff9378 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -233,7 +233,8 @@ class File(models.Model): return srt def editable(self, user): - return self.instances.filter(volume__user=user).count() > 0 + return user.get_profile().get_level() == 'admin' or \ + self.instances.filter(volume__user=user).count() > 0 def save_chunk(self, chunk, chunk_id=-1, done=False): if not self.available: diff --git a/pandora/item/models.py b/pandora/item/models.py index ff60fd8c..40a7bc29 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -70,8 +70,8 @@ def get_item(info, user=None, async=False): season, episode, episodeTitle, episodeDirector, episodeYear ''' item_data = { - 'title': info['title'], - 'director': info['director'], + 'title': info.get('title', ''), + 'director': info.get('director', []), 'year': info.get('year', '') } for key in ('episodeTitle', 'episodeDirector', 'episodeYear', @@ -760,8 +760,15 @@ class Item(models.Model): def update_selected(self): for s in self.sets(): if s.filter(Q(is_video=True)|Q(is_audio=True)).filter(available=False).count() == 0: + update = False + deselect = self.files.filter(selected=True).exclude(id__in=s) + if deselect.count() > 0: + deselect.update(selected=False) + update = True if s.filter(selected=False).count() > 0: s.update(selected=True, wanted=False) + update = True + if update: self.rendered = False self.save() self.update_timeline() @@ -1117,18 +1124,3 @@ class Facet(models.Model): self.value_sort = utils.sort_string(self.value) super(Facet, self).save(*args, **kwargs) - -class PosterUrl(models.Model): - - class Meta: - unique_together = ("item", "service", "url") - ordering = ('-height', ) - - item = models.ForeignKey(Item, related_name='poster_urls') - url = models.CharField(max_length=1024) - service = models.CharField(max_length=1024) - width = models.IntegerField(default=80) - height = models.IntegerField(default=128) - - def __unicode__(self): - return u'%s %s %dx%d' % (unicode(self.item), self.service, self.width, self.height) diff --git a/pandora/item/timelines.py b/pandora/item/timelines.py index fa4e7049..3d8af150 100644 --- a/pandora/item/timelines.py +++ b/pandora/item/timelines.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 - from __future__ import division, with_statement - +import os from glob import glob import Image +import ox + def loadTimeline(timeline_prefix, height=64): files = sorted(glob('%s%sp*.png' % (timeline_prefix, height))) f = Image.open(files[0]) @@ -98,6 +99,7 @@ def join_timelines(timelines, prefix): timeline_name = '%s%sp%04d.png' % (prefix, height, i) timeline.crop((0, 0, pos, height)).save(timeline_name) + ox.makedirs(os.path.dirname(prefix)) makeTiles(prefix, 16, 3600) makeTimelineOverview(prefix, 1920, height=16) makeTimelineOverview(prefix, 1920, height=64)