make systems without imdb work

This commit is contained in:
j 2011-01-28 14:18:38 +05:30
commit 200741445f
10 changed files with 76 additions and 36 deletions

View file

@ -77,7 +77,8 @@ class File(models.Model):
for key in ('duration', 'size'):
setattr(self, key, self.info.get(key, 0))
if 'video' in self.info and self.info['video']:
if 'video' in self.info and self.info['video'] and \
'width' in self.info['video'][0]:
video = self.info['video'][0]
self.video_codec = video['codec']
self.width = video['width']

View file

@ -6,6 +6,7 @@ from celery.decorators import task
from item.utils import parse_path
from item.models import get_item
from django.conf import settings
import models
@ -55,7 +56,10 @@ def update_files(user, volume, files):
#new oshash, add to database
else:
if not i:
item_info = parse_path(folder)
if settings.USE_IMDB:
item_info = parse_path(folder)
else:
item_info = parse_path(path)
i = get_item(item_info)
file_object = models.File()
file_object.oshash = oshash