def __init__(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = "e00b72174e4ae097af808f34a8f220fc"
     self.tv = TV()
     self.season = Season()
     self.movie = Movie()
     self.discover = Discover()
Example #2
0
    def fetchDetails(self, show, id):
        if show not in self.tvShows:
            return False

        # Fetch show information
        details = TV().details(id)
        self.tvShows[show] = details
        show.firstAirYear = int(details.first_air_date[:4])
        show.databaseId = id
        show.databaseTitle = details['name']

        # Fetch episode information
        for sNbr, season in show.seasons.items():
            if not self.__seasonAvailable__(sNbr, details):
                continue

            seasonDetails = Season().details(id, sNbr)
            for episode in season.episodes:
                episodeDetails = None

                # Check if episode exist
                for e in seasonDetails.episodes:
                    if e['episode_number'] == episode.episodeNumber:
                        episodeDetails = e
                        break

                if episodeDetails == None:
                    continue

                episode.databaseTitle = episodeDetails['name']
        return True
Example #3
0
 def setUp(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = os.environ['TMDB_API_KEY']
     self.tmdb.language = "en"
     self.tmdb.debug = True
     self.tmdb.wait_on_rate_limit = True
     self.tmdb.cache = False
     self.season = Season()
Example #4
0
 def setUp(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = os.environ['api_key']
     self.movie = Movie()
     self.discover = Discover()
     self.tv = TV()
     self.person = Person()
     self.collection = Collection()
     self.company = Company()
     self.season = Season()
Example #5
0
 def setUp(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = os.environ['TMDB_API_KEY']
     self.tmdb.language = 'en'
     self.tmdb.debug = True
     self.tmdb.wait_on_rate_limit = True
     self.movie = Movie()
     self.discover = Discover()
     self.tv = TV()
     self.person = Person()
     self.collection = Collection()
     self.company = Company()
     self.season = Season()
Example #6
0
 def setUp(self):
     self.tmdb = TMDb()
     self.tmdb.api_key = os.environ["TMDB_API_KEY"]
     self.tmdb.language = "en"
     self.tmdb.debug = True
     self.tmdb.wait_on_rate_limit = True
     self.movie = Movie()
     self.discover = Discover()
     self.tv = TV()
     self.person = Person()
     self.collection = Collection()
     self.company = Company()
     self.network = Network()
     self.search = Search()
     self.season = Season()
     self.list = List()
Example #7
0
def get_detalles(id, tipo=''):
    try:
        if id == '':
            abort(404, "Post id {0} doesn't exist.".format(id))
        if tipo == '':
            abort(403)
        detalles = ""
        if tipo == "peliculas":
            movie = Movie()
            detalles = movie.details(id)
        elif tipo == "series":
            season = Season()
            detalles = season.details(id)
        elif tipo == "tv":
            tv = TV()
            detalles = tv.details(id)

        return detalles

    except Exception as e:
        raise e
Example #8
0
def buscar():
    try:
        if request.method == 'POST':
            titulo = request.form['titulo']
            tipo = request.form['tipo']

            if not titulo:
                raise Exception('El Titulo es requerido.')

            if tipo == "peliculas":
                entidad = Movie()
            elif tipo == "series":
                entidad = Season()
            elif tipo == "tv":
                entidad = TV()

            show = entidad.search(titulo)

    except Exception as e:
        flash(str(e))
        return redirect(url_for('pagina.index'))

    return render_template('pagina/buscar.html', resultados=show)
Example #9
0
    async def hiatus(self, ctx):
        """
        Will return the number of days since the last episode of SVTFOE. The nexus of the hiatus...
        :return: Preformatted Message with calculated days
        """
        # date_of_last_episode = datetime.strptime('Apr 7 2018 01:00AM',
        #                                          '%b %d %Y %I:%M%p')  # Set from config
        # days = re.search('\d{1,3}\s', str(datetime.now() - date_of_last_episode)).group(0)
        # msg = "Days since last episode:\n\n" + "[" + days + "Days]"

        if ctx.guild.id == 593887030216228973:
            season = Season()
            latest_season = False
            season_number = 1
            while latest_season is False:
                show_season = season.details(61175, season_number)
                if "status_code" in show_season.entries and show_season.entries[
                        "status_code"] == 34:
                    show_season = season.details(61175, season_number - 1)
                    latest_season = True
                else:
                    season_number += 1
            episode = show_season.entries['episodes'][-1]
            air_date = episode['air_date']
            diffrence = datetime.now() - datetime.strptime(
                air_date, "%Y-%m-%d")
            a = datetime(2019, 9, 2)
            b = datetime.now()
            embed = discord.Embed(title="Steven Universe Hiatus Calculator")
            embed.set_thumbnail(
                url=
                'https://image.tmdb.org/t/p/w600_and_h900_bestv2/g31ZPZSjv8ySPbclyYZZU50XhZy.jpg'
            )
            embed.add_field(
                name=
                f"Days Since Season {episode['season_number']} {episode['name']}",
                value=f"{diffrence.days} Days",
                inline=False)
            embed.add_field(name=f"Days Since Season The Movie",
                            value=f"{(b-a).days} Days",
                            inline=False)
            return await ctx.channel.send(embed=embed)

        if ctx.guild.id == 448695150135345152:
            season = Season()
            latest_season = False
            season_number = 1
            while latest_season is False:
                show_season = season.details(61923, season_number)
                if "status_code" in show_season.entries and show_season.entries[
                        "status_code"] == 34:
                    show_season = season.details(61923, season_number - 1)
                    latest_season = True
                else:
                    season_number += 1
            episode = show_season.entries['episodes'][-1]
            air_date = episode['air_date']
            diffrence = datetime.now() - datetime.strptime(
                air_date, "%Y-%m-%d")
            embed = discord.Embed(
                title="Star Vs The Forces Of Evil Hiatus Calculator")
            embed.set_thumbnail(
                url=
                "https://image.tmdb.org/t/p/w600_and_h900_bestv2/dKFL1AOdKNoazqZDg1zq2z69Lx1.jpg"
            )
            embed.add_field(
                name=
                f"Days Since Season {episode['season_number']} {episode['name']}",
                value=f"{diffrence.days} Days")
            return await ctx.channel.send(embed=embed)
 def get_season_inst(self):
     return Season()
from tmdbv3api import Movie
from tmdbv3api import TMDb
from tmdbv3api import TV
from tmdbv3api import Season
import tmdbsimple
import time
import sqlite3
import requests
import json

tmdb = TMDb()
tv = TV()
season = Season()
tmdb.api_key = ''
radarr_api_key = ''
sonarr_api_key = ''
home_IP = ''
radarr_port = ':'
sonarr_port = ':'
tmdbsimple.API_KEY = tmdb.api_key
tmdb.language = 'en'
tmdb.debug = False
movie_dict = {}
tv_dict = {}
last_season = 1
season_count = 1
movie = Movie()
connection = sqlite3.connect('trakt.db')
crsr = connection.cursor()
sql_command = ''