This commit is contained in:
rolux 2011-10-18 02:51:21 +00:00
commit f7e49bce00
4 changed files with 23 additions and 28 deletions

16
README
View file

@ -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: you need python, bazaar, pip and virtualenv and several other python modules:
* Packages * Packages
apt-get install python-setuptools python-pip python-virtualenv ipython apt-get install bzr git subversion mercurial \
apt-get install python-dev python-imaging python-numpy python-psycopg2 python-setuptools python-pip python-virtualenv ipython \
python-dev python-imaging python-numpy python-psycopg2
bzr branch http://code.0x2620.org/pandora pandora bzr branch http://code.0x2620.org/pandora pandora
cd 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 bzr branch http://code.0x2620.org/oxjs
* Additional pandora tools: * 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: For Ubuntu we provide these packages in a ppa:
sudo apt-get install python-software-properties apt-get install python-software-properties
sudo add-apt-repository ppa:j/pandora add-apt-repository ppa:j/pandora
sudo add-apt-repository ppa:gstreamer-developers/ppa apt-get update
sudo apt-get update apt-get install oxframe oxtimeline
sudo apt-get install oxframe oxtimeline mkvtoolnix
* Database * Database
We use postgresql but other databases might also work We use postgresql but other databases might also work

View file

@ -233,7 +233,8 @@ class File(models.Model):
return srt return srt
def editable(self, user): 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): def save_chunk(self, chunk, chunk_id=-1, done=False):
if not self.available: if not self.available:

View file

@ -70,8 +70,8 @@ def get_item(info, user=None, async=False):
season, episode, episodeTitle, episodeDirector, episodeYear season, episode, episodeTitle, episodeDirector, episodeYear
''' '''
item_data = { item_data = {
'title': info['title'], 'title': info.get('title', ''),
'director': info['director'], 'director': info.get('director', []),
'year': info.get('year', '') 'year': info.get('year', '')
} }
for key in ('episodeTitle', 'episodeDirector', 'episodeYear', for key in ('episodeTitle', 'episodeDirector', 'episodeYear',
@ -760,8 +760,15 @@ class Item(models.Model):
def update_selected(self): def update_selected(self):
for s in self.sets(): for s in self.sets():
if s.filter(Q(is_video=True)|Q(is_audio=True)).filter(available=False).count() == 0: 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: if s.filter(selected=False).count() > 0:
s.update(selected=True, wanted=False) s.update(selected=True, wanted=False)
update = True
if update:
self.rendered = False self.rendered = False
self.save() self.save()
self.update_timeline() self.update_timeline()
@ -1117,18 +1124,3 @@ class Facet(models.Model):
self.value_sort = utils.sort_string(self.value) self.value_sort = utils.sort_string(self.value)
super(Facet, self).save(*args, **kwargs) 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)

View file

@ -1,12 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4 # vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement from __future__ import division, with_statement
import os
from glob import glob from glob import glob
import Image import Image
import ox
def loadTimeline(timeline_prefix, height=64): def loadTimeline(timeline_prefix, height=64):
files = sorted(glob('%s%sp*.png' % (timeline_prefix, height))) files = sorted(glob('%s%sp*.png' % (timeline_prefix, height)))
f = Image.open(files[0]) f = Image.open(files[0])
@ -98,6 +99,7 @@ def join_timelines(timelines, prefix):
timeline_name = '%s%sp%04d.png' % (prefix, height, i) timeline_name = '%s%sp%04d.png' % (prefix, height, i)
timeline.crop((0, 0, pos, height)).save(timeline_name) timeline.crop((0, 0, pos, height)).save(timeline_name)
ox.makedirs(os.path.dirname(prefix))
makeTiles(prefix, 16, 3600) makeTiles(prefix, 16, 3600)
makeTimelineOverview(prefix, 1920, height=16) makeTimelineOverview(prefix, 1920, height=16)
makeTimelineOverview(prefix, 1920, height=64) makeTimelineOverview(prefix, 1920, height=64)