forked from 0x2620/pandora
file import cleanup
This commit is contained in:
parent
bf9a91280e
commit
d77acd43cd
3 changed files with 11 additions and 8 deletions
|
@ -90,16 +90,18 @@ def getMovie(info):
|
||||||
info dict with:
|
info dict with:
|
||||||
imdbId, title, director, episode_title, season, series
|
imdbId, title, director, episode_title, season, series
|
||||||
'''
|
'''
|
||||||
if 'imdbId' in info:
|
if 'imdbId' in info and info['imdbId']:
|
||||||
try:
|
try:
|
||||||
movie = models.Movie.byImdbId(imdbId)
|
movie = Movie.byImdbId(info['imdbId'])
|
||||||
except models.Movie.DoesNotExist:
|
except Movie.DoesNotExist:
|
||||||
movie = load.loadIMDb(movieId==info['imdbId'])
|
movie = load.loadIMDb(info['imdbId'])
|
||||||
else:
|
else:
|
||||||
q = Movie.objects.filter(title=info['title'], year=info['director'])
|
q = Movie.objects.filter(oxdb__title=info['title'])
|
||||||
if q.count() > 1:
|
if q.count() > 1:
|
||||||
|
print "FIXME: check more than title here!!"
|
||||||
movie = q[0]
|
movie = q[0]
|
||||||
else:
|
else:
|
||||||
|
print info
|
||||||
movie = newMovie(info['title'], info['director'], '')
|
movie = newMovie(info['title'], info['director'], '')
|
||||||
updated = False
|
updated = False
|
||||||
for key in ('episode_title', 'season', 'year'):
|
for key in ('episode_title', 'season', 'year'):
|
||||||
|
|
|
@ -78,7 +78,7 @@ def oxdb_episode_title(path):
|
||||||
episodeTitle = u''
|
episodeTitle = u''
|
||||||
ep = re.compile('.Episode \d+?\.(.*?)\.[a-zA-Z]').findall(path)
|
ep = re.compile('.Episode \d+?\.(.*?)\.[a-zA-Z]').findall(path)
|
||||||
if ep:
|
if ep:
|
||||||
episodeTitle = ep[0][0]
|
episodeTitle = ep[0]
|
||||||
return episodeTitle
|
return episodeTitle
|
||||||
|
|
||||||
def oxdb_season_episode(path):
|
def oxdb_season_episode(path):
|
||||||
|
|
|
@ -11,6 +11,7 @@ from django.contrib.auth.models import User
|
||||||
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
|
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
|
from django import forms
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
try:
|
try:
|
||||||
|
@ -427,8 +428,8 @@ def update_archive(request, archive):
|
||||||
print "adding file", oshash, data['path']
|
print "adding file", oshash, data['path']
|
||||||
f = models.ArchiveFile.get_or_create(archive, oshash)
|
f = models.ArchiveFile.get_or_create(archive, oshash)
|
||||||
f.update(data)
|
f.update(data)
|
||||||
if not f.movie:
|
if not f.file.movie:
|
||||||
send_bg_message({'findMovie': f.id})
|
send_bg_message({'findMovie': f.file.id})
|
||||||
#FIXME: only add if it was not in File
|
#FIXME: only add if it was not in File
|
||||||
else:
|
else:
|
||||||
f = q[0]
|
f = q[0]
|
||||||
|
|
Loading…
Reference in a new issue