forked from 0x2620/pandora
deselect, make sure target folder exists
This commit is contained in:
parent
63aee8e010
commit
a9165e7230
3 changed files with 19 additions and 25 deletions
16
README
16
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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue