#!/usr/bin/env python import sys,os filmname = ' '.join(sys.argv[1:]) sys.path.append("/home/aquarius/src/python/pyimdb-0.1.2") from IMDb.imdb import IMDb imdb = IMDb() films = imdb.search(filmname) if not films: print "No films matching '%s' found" % filmname sys.exit(0) if len(films) == 1: film = films[0] else: c = 0 for f in films: print "%s. %s" % (c,f.title()) c += 1 print "%s. Exit" % c while 1: v = raw_input(" -> ") try: iv = int(v) break except: pass if iv == c: sys.exit(0) film = films[iv] # Get and convert border image os.system('wget --quiet -O - "%s" | convert - -bordercolor "#000000" -border 2x2 -resize 158x280 /tmp/dvd-cover.eps' % film.poster_image_url()) cast = '%'.join(["%s - %s" % x for x in film.cast()]) # Generate and view cover os.system('cdlabelgen --create-dvd-outside -c "%s" -i "%s" -d "%s" -e /tmp/dvd-cover.eps -y 1.5 -S 1,-1.6,2 | gv -' % (film.title(),cast,film.year())) # Print if OK while 1: v = raw_input("Print [Y/n] ") if v.lower() == "n": break elif v.lower() == "y" or v == "": os.system('cdlabelgen --create-dvd-outside -c "%s" -i "%s" -d "%s" -e /tmp/dvd-cover.eps -y 1.5 -S 1,-1.6,2 | lpr' % (film.title(),cast,film.year())) break os.remove('/tmp/dvd-cover.eps')