This commit is contained in:
j 2016-04-29 13:12:05 +02:00
parent ccb54122cc
commit f6ed20d87b
4 changed files with 15 additions and 6 deletions

1
README
View file

@ -1 +0,0 @@
collection tools to create *cine.ma sites

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# collection tools to create *cine.ma sites
COUNTRY=in
python films_by_country.py $COUNTRY films_$COUNTRY.json
python add_metadata.py $COUNTRY films_$COUNTRY.json films_$COUNTRY_metadata.json

View file

@ -25,13 +25,12 @@ def add_metadata(films, country, output):
if info['imdbId'] in known_ids: if info['imdbId'] in known_ids:
continue continue
skip = False skip = False
for key in ('Mini-Series', 'TV Series', 'TV Movie', 'TV Special'): for key in ('Mini-Series', 'TV Series', 'TV Movie', 'TV Special', 'Video Game'):
if key in info['title']: if key in info['title']:
skip = True skip = True
if skip: if skip:
continue continue
keys = [
extra = api.getMetadata(id=info['imdbId'], keys=[
'language', 'productionCompany', 'director', 'language', 'productionCompany', 'director',
'runtime', 'alternativeTitles', 'runtime', 'alternativeTitles',
'color', 'sound', 'color', 'sound',
@ -39,9 +38,15 @@ def add_metadata(films, country, output):
'isSeries', 'isSeries',
'title', 'title',
'originalTitle', 'year' 'originalTitle', 'year'
])['data'] ]
extra = api.getMetadata(id=info['imdbId'], keys=keys)['data']
print info print info
print extra print extra
if not extra:
save()
print 'lets try again'
extra = api.getMetadata(id=info['imdbId'], keys=keys)['data']
print extra
if 'isSeries' in extra or ('country' in extra and not country in extra['country']): if 'isSeries' in extra or ('country' in extra and not country in extra['country']):
info['delete'] = True info['delete'] = True
print 'deleting', info['imdbId'], info.get('title') print 'deleting', info['imdbId'], info.get('title')

View file

@ -21,7 +21,7 @@ def load(data_json):
reset_table(archive.models.Volume._meta.db_table) reset_table(archive.models.Volume._meta.db_table)
reset_table(models.Item._meta.db_table) reset_table(models.Item._meta.db_table)
transaction.commit_unless_managed() transaction.commit_unless_managed()
os.system('rm -r /srv/pandora/data/files') os.system('rm -r /srv/pandora/data/media')
os.system('rm -r /srv/pandora/data/items') os.system('rm -r /srv/pandora/data/items')
films = json.load(open(data_json)) films = json.load(open(data_json))