示例#1
0
文件: __init__.py 项目: tehron/tehbot
    def execute(self):
        if not self.args:
            return self.help(self.cmd)

        id = -1
        res = tmdb.Search().movie(query=self.args)
        if res["total_results"] > 0:
            id = res["results"][0]["id"]

        txt = "No such movie."
        if id:
            movie = tmdb.Movies(id)
            movie_info = movie.info()
            txt = "\x02%s\x02" % movie_info["title"]
            if movie_info["title"] != movie_info["original_title"]:
                txt += " (%s)" % movie_info["original_title"]
            if movie_info["release_date"]:
                txt += " | \x02Released:\x02 %s" % movie_info["release_date"]
            if movie_info["vote_count"] > 0:
                txt += " | \x02Rating:\x02 %.1f/10" % movie_info["vote_average"]
            if movie_info["homepage"]:
                txt += " | \x02Homepage:\x02 %s" % movie_info["homepage"]

            txt += "\n" + plugins.split(movie_info["overview"])

        return txt
示例#2
0
文件: __init__.py 项目: tehron/tehbot
    def execute(self):
        if not self.args:
            return self.help(self.cmd)

        id = -1
        res = tmdb.Search().tv(query=self.args)
        if res["total_results"] > 0:
            id = res["results"][0]["id"]

        txt = "No such movie."
        if id:
            movie = tmdb.TV(id)
            movie_info = movie.info()
            txt = "\x02%s\x02" % movie_info["name"]
            if movie_info["name"] != movie_info["original_name"]:
                txt += " (%s)" % movie_info["original_name"]
            if movie_info["first_air_date"]:
                txt += " | \x02First Aired:\x02 %s" % movie_info["first_air_date"]
            if movie_info["number_of_seasons"]:
                txt += " | \x02Nr. of Seasons:\x02 %d" % movie_info["number_of_seasons"]
            if movie_info["vote_count"] > 0:
                txt += " | \x02Rating:\x02 %.1f/10" % movie_info["vote_average"]
            if movie_info["homepage"]:
                txt += " | \x02Homepage:\x02 %s" % movie_info["homepage"]

            txt += "\n" + plugins.split(movie_info["overview"])

        return txt
示例#3
0
    def command(self, connection, event, extra, dbconn):
        tmdb.API_KEY = self.settings["tmdb_api_key"]

        id = -1
        res = tmdb.Search().movie(query=self.pargs.movie)
        if res["total_results"] > 0:
            id = res["results"][0]["id"]

        txt = "No such movie."
        if id != -1:
            movie = tmdb.Movies(id)
            movie_info = movie.info()
            txt = "\x02%s\x02" % movie_info["title"]
            if movie_info["title"] != movie_info["original_title"]:
                txt += " (%s)" % movie_info["original_title"]
            if movie_info["release_date"]:
                txt += " | \x02Released:\x02 %s" % movie_info["release_date"]
            if movie_info["vote_count"] > 0:
                txt += " | \x02Rating:\x02 %.1f/10" % movie_info["vote_average"]
            if movie_info["homepage"]:
                txt += " | \x02Homepage:\x02 %s" % movie_info["homepage"]

            txt += "\n" + plugins.split(movie_info["overview"])

        return txt
示例#4
0
    def command(self, connection, event, extra, dbconn):
        tmdb.API_KEY = self.settings["tmdb_api_key"]

        id = -1
        res = tmdb.Search().tv(query=self.pargs.show)
        if res["total_results"] > 0:
            id = res["results"][0]["id"]

        txt = "No such movie."
        if id != -1:
            movie = tmdb.TV(id)
            movie_info = movie.info()
            txt = "\x02%s\x02" % movie_info["name"]
            if movie_info["name"] != movie_info["original_name"]:
                txt += " (%s)" % movie_info["original_name"]
            if movie_info["first_air_date"]:
                txt += " | \x02First Aired:\x02 %s" % movie_info[
                    "first_air_date"]
            if movie_info["number_of_seasons"]:
                txt += " | \x02Nr. of Seasons:\x02 %d" % movie_info[
                    "number_of_seasons"]
            if movie_info["vote_count"] > 0:
                txt += " | \x02Rating:\x02 %.1f/10" % movie_info["vote_average"]
            if movie_info["homepage"]:
                txt += " | \x02Homepage:\x02 %s" % movie_info["homepage"]

            txt += "\n" + plugins.split(movie_info["overview"])

        return txt
示例#5
0
    def execute(self, connection, event, extra, dbconn):
        tmdb.API_KEY = self.settings["tmdb_api_key"]
        try:
            pargs = self.parser.parse_args(extra["args"])
            if self.parser.help_requested:
                return self.parser.format_help().strip()
        except Exception as e:
            return u"Error: %s" % str(e)

        id = -1
        res = tmdb.Search().tv(query=pargs.show)
        if res["total_results"] > 0:
            id = res["results"][0]["id"]

        txt = "No such movie."
        if id != -1:
            movie = tmdb.TV(id)
            movie_info = movie.info()
            txt = "\x02%s\x02" % movie_info["name"]
            if movie_info["name"] != movie_info["original_name"]:
                txt += " (%s)" % movie_info["original_name"]
            if movie_info["first_air_date"]:
                txt += " | \x02First Aired:\x02 %s" % movie_info["first_air_date"]
            if movie_info["number_of_seasons"]:
                txt += " | \x02Nr. of Seasons:\x02 %d" % movie_info["number_of_seasons"]
            if movie_info["vote_count"] > 0:
                txt += " | \x02Rating:\x02 %.1f/10" % movie_info["vote_average"]
            if movie_info["homepage"]:
                txt += " | \x02Homepage:\x02 %s" % movie_info["homepage"]

            txt += "\n" + plugins.split(movie_info["overview"])

        return txt