dont set task_id, only create poster if timeline exists, do not update poster in update_imdb

This commit is contained in:
j 2010-12-25 19:15:19 +05:30
parent af3625617d
commit 1f4d6e546f
5 changed files with 30 additions and 24 deletions

View file

@ -15,6 +15,9 @@ env HOME=/home/pandora
script script
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora)
cd $VENV/pandora cd $VENV/pandora
exec /usr/bin/sudo -u pandora $VENV/bin/python $VENV/pandora/manage.py celeryd \ exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \
-Q encoding -f /var/log/pandora/pandora-encoding.log -l INFO -Q encoding \
-n pandora-encoding \
-f /var/log/pandora/pandora-encoding.log \
-l INFO
end script end script

View file

@ -16,5 +16,8 @@ script
test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora) test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var/log/pandora)
cd $VENV/pandora cd $VENV/pandora
exec /usr/bin/sudo -u pandora $VENV/bin/python $VENV/pandora/manage.py celeryd \ exec /usr/bin/sudo -u pandora $VENV/bin/python $VENV/pandora/manage.py celeryd \
-Q default -f /var/log/pandora/pandora-tasks.log -l INFO -Q default \
-n pandora-default \
-f /var/log/pandora/pandora-tasks.log \
-l INFO
end script end script

View file

@ -80,8 +80,7 @@ def update(request):
if 'files' in data: if 'files' in data:
#update files info async, this takes to long otherwise #update files info async, this takes to long otherwise
#FIXME: how can client know if update is done? possibly with taksStatus? #FIXME: how can client know if update is done? possibly with taksStatus?
task_id = '_'.join(['update', user.username, data['volume']]) t = tasks.update_files.delay(user.username, data['volume'], data['files'])
t = tasks.update_files.apply_async(args=[user.username, data['volume'], data['files']], task_id=task_id)
response['data']['taskId'] = t.task_id response['data']['taskId'] = t.task_id
user_profile = user.get_profile() user_profile = user.get_profile()
@ -189,8 +188,7 @@ def firefogg_upload(request):
f.save() f.save()
#FIXME: this fails badly if rabbitmq goes down #FIXME: this fails badly if rabbitmq goes down
try: try:
taks_id = 'update_streams_%s' % f.item.itemId t = item.tasks.update_streams.delay((f.item.itemId))
t = item.tasks.update_streams.apply_async(args=[f.item.itemId], task_id=task_id)
data['resultUrl'] = t.task_id data['resultUrl'] = t.task_id
except: except:
pass pass

View file

@ -21,6 +21,7 @@ from django.conf import settings
from ox.django import fields from ox.django import fields
import ox import ox
from ox import stripTags from ox import stripTags
import ox.web.imdb
from ox.normalize import canonicalTitle, canonicalName from ox.normalize import canonicalTitle, canonicalName
from firefogg import Firefogg from firefogg import Firefogg
@ -572,6 +573,7 @@ class Item(models.Model):
s.color = int(sum(self.data.get('color', []))) s.color = int(sum(self.data.get('color', [])))
s.cuts = len(self.data.get('cuts', [])) s.cuts = len(self.data.get('cuts', []))
if s.duration:
s.cutsperminute = s.cuts / (s.duration/60) s.cutsperminute = s.cuts / (s.duration/60)
for key in ('title', 'language', 'country') + self.person_keys: for key in ('title', 'language', 'country') + self.person_keys:
setattr(s, '%s_desc'%key, getattr(s, key)) setattr(s, '%s_desc'%key, getattr(s, key))
@ -758,6 +760,7 @@ class Item(models.Model):
frame = posters[poster] frame = posters[poster]
timeline = self.path('timeline.64.png') timeline = self.path('timeline.64.png')
timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline)) timeline = os.path.abspath(os.path.join(settings.MEDIA_ROOT, timeline))
if os.path.exists(timeline):
cmd = [settings.ITEM_POSTER, cmd = [settings.ITEM_POSTER,
'-t', self.get('title'), '-t', self.get('title'),
'-d', ', '.join(self.get('directors', ['Unknown Director'])), '-d', ', '.join(self.get('directors', ['Unknown Director'])),

View file

@ -17,10 +17,9 @@ def update_poster(itemId):
item.make_poster(True) item.make_poster(True)
@task(ignore_resulsts=True, queue='default') @task(ignore_resulsts=True, queue='default')
def update_imdb(imdbId): def update_imdb(itemId):
item = models.Item.objects.get(itemId=imdbId) item = models.Item.objects.get(itemId=itemId)
item.update_imdb() item.update_imdb()
update_poster(itemId)
@task(queue="encoding") @task(queue="encoding")
def update_streams(itemId): def update_streams(itemId):