コード例 #1
0
ファイル: meliman.py プロジェクト: masterweb121/meliman
def do_clear_movie(movie_id_str, config, debug):
    try:
        database = Database(config, debug)

        try:
            movie_id = int(movie_id_str)
        except:
            print "Argument is not a valid movie id: %s" % (movie_id_str, )
            return 1

        movie = database.get_movie(movie_id)
        if not movie is None:
            database.clear_movie(movie.id)
            print "Metadata for movie '%s' has been cleared from the local cache." % (movie.title, )
            return 0
        else:
            print "No movie with id '%i' exists in the local cache." % (movie_id,)
            return 3
    except:
        traceback.print_exc()
        return 11
コード例 #2
0
ファイル: meliman.py プロジェクト: masterweb121/meliman
def do_refresh_movie(movie_id_str, config, debug):
    try:
        moviedb = MovieDB(config, debug)
        database = Database(config, debug)

        try:
            movie_id = int(movie_id_str)
        except:
            print "Argument is not a valid movie id: %s" % (movie_id_str, )
            return 1

        database.clear_movie(movie_id)
        new_movie = get_movie_by_id(movie_id, moviedb, database)

        if new_movie is not None:
            print "Metadata for movie '%s' has been cleared from the local cache and reloaded from IMDb.com." % (new_movie.title, )
            return 0
        else:
            print "No movie with id '%i' could be found on IMDb." % (movie_id,)
            return 3
    except:
        traceback.print_exc()
        return 11