if not os.path.exists(CFG_DIR): os.mkdir(CFG_DIR) dummy_config = file(CFG_FILE, 'w') dummy_config.write('[shores]\ntargetDir = %s' % os.path.expandvars('$HOME')) dummy_config.close() config = ConfigParser.ConfigParser() config.read(CFG_FILE) targetDir = config.get('shores', 'targetDir') cache = load_cache() listOfShows = list_shows() if len(sys.argv) == 1: try: watchedLiUser = config.get('shores', 'watchedLiUser') watchedLiPass = config.get('shores', 'watchedLiPass') watched = WatchedLi(watchedLiUser, watchedLiPass) for show in watched.shows(): handle_show(show, listOfShows, targetDir) except: print 'Available shows:' for show in listOfShows: print '\t%s' % show.keys()[0] else: showName = ' '.join(sys.argv[1:]) handle_show(showName, listOfShows, targetDir)
debug(video_info) print '%s is not playing a TV show episode.' % video_player sys.exit(1) show = video_info['series'] episode_id = 'S%02dE%02d' % (int(video_info['season']), int(video_info['episodeNumber'])) debug(show + ' ' + episode_id) # FIXME: Workaround for 'Rizzoli & Isles', need a better solution show = show.replace('and ', '') credentials = get_credentials() try: client = WatchedLi(credentials[0], credentials[1]) episodes = client.episodes(show) except BaseException, e: print e sys.exit(1) for episode in episodes: if episode['id'] == episode_id: debug('marking ' + episode['wid']) try: if client.markEpisode(episode): print 'Done.' sys.exit(0) except Exception, e: print e sys.exit(1)