deselect, make sure target folder exists

This commit is contained in:
j 2011-10-18 11:08:09 +02:00
parent 63aee8e010
commit a9165e7230
3 changed files with 19 additions and 25 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

@ -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)