2010-09-17 14:40:10 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from optparse import OptionParser
|
|
|
|
from imagetools import render_oxdb_poster
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = OptionParser()
|
|
|
|
parser.add_option('-o', '--oxdbid', dest='oxdb_id', help='0xDB Id')
|
|
|
|
parser.add_option('-i', '--imdbid', dest='imdb_id', help='IMDb Id')
|
|
|
|
parser.add_option('-t', '--title', dest='title', help='Title')
|
2010-09-17 15:43:01 +00:00
|
|
|
parser.add_option('-d', '--director', dest='director', help='Director(s)', default='')
|
2010-09-17 14:40:10 +00:00
|
|
|
parser.add_option('-y', '--year', dest='year', help='Year')
|
|
|
|
parser.add_option('-s', '--series', dest='series', help='Movie is an episode of a series', action='store_true')
|
|
|
|
parser.add_option('-f', '--frame', dest='frame', help='Poster frame (image file to be read)')
|
2010-09-17 15:06:30 +00:00
|
|
|
parser.add_option('-l', '--timeline', dest='timeline', help='Timeline (image file to be read)')
|
2010-09-17 14:40:10 +00:00
|
|
|
parser.add_option('-p', '--poster', dest='poster', help='Poster (image file to be written)')
|
|
|
|
(options, args) = parser.parse_args()
|
2010-09-17 15:43:01 +00:00
|
|
|
|
|
|
|
if None in (options.oxdb_id, options.title, options.poster):
|
2010-09-17 14:40:10 +00:00
|
|
|
parser.print_help()
|
|
|
|
sys.exit()
|
2010-09-17 15:43:01 +00:00
|
|
|
|
|
|
|
opt = {}
|
|
|
|
for key in ('oxdb_id', 'imdb_id', 'title', 'director', 'year', 'series', 'frame', 'poster'):
|
|
|
|
opt[key] = getattr(options, key)
|
|
|
|
|
|
|
|
opt['title'] = opt['title'].decode('utf-8')
|
|
|
|
opt['director'] = opt['director'].decode('utf-8')
|
|
|
|
|
|
|
|
render_oxdb_poster(**opt)
|