def addSerie(request, identifier): # Comprobar si el usuario esta autenticado if not request.user.is_authenticated(): return redirect('index') # Comprobar si la serie ya está en la base de datos try: s = Serie.objects.get(theTvdbID=identifier) userSerie = UserSerie.objects.get(serie=s) # Si la serie ya existe para ese usuario devolver un warning series = getSeriesForUser(request) context = generateContext(request=request, title="Control panel", series=series) setContextWarning(context, "You already have that show") return render(request, 'series/index-message.html', context) except Serie.DoesNotExist: # Si no está -> añadir a la base de datos y al usuario api = APIseries() data = api.getDictSerie(identifier) # Añadir serie a la base de datos s = Serie(theTvdbID = identifier, nombre = data['title'], descripcion = data['overview'], imagen = data['banner'], \ genero = data['genre'], fechaEmision = data['Airs_DayOfWeek'], estado = data['status'], \ tiempoAnalisis = 24, numeroTorrents = 5, limiteSubida = 64, limiteBajada = 1024) s.save() # Añadir capítulos a la base de datos episodeData = api.getStructuredEpisodes(identifier) for episodeId, title, season, number, airdate in episodeData: c = Capitulo(serie=s, theTvdbID=episodeId, temporada=season, numero=number, titulo=title, estado=-1, airDate=airdate) c.save() crontab.setAnalysisSchedule(c) crontab.saveTempChanges(crontab.path) # Añadir serie al usuario correspondiente userSerie = UserSerie(user=auth.get_user(request), serie=s) userSerie.save() except UserSerie.DoesNotExist: # La serie existe en la base de datos, pero no está asociada al usuario userSerie = UserSerie(user=auth.get_user(request), serie=s) userSerie.save() series = getSeriesForUser(request) context = generateContext(request=request, title="Control panel", series=series) setContextSuccess(context, "Show was added to your account") return render(request, 'series/index-message.html', context)
def cargar_datos(shows): import imdb from series.models import Serie, Genero from utils.slugify import slugify api = imdb.IMDb() for show in shows: try: try: datos = api.get_movie( show["imdb"].movieID ) except: continue s = Serie() s.titulo = datos.get("title") print s.titulo s.slug = slugify(s.titulo) try: s.productora = (",".join( [c.get("name") for c in datos.get("production companies")] ))[:255] except: pass s.director = datos.get("director") s.estado = show["status"] try: s.plot = datos.get("plot")[0] except: pass s.mini_plot = datos.get("plot outline") s.year = datos.get("year") s.cover = datos.get("full-size cover url") s.min_cover = datos.get("cover url") s.rating = datos.get("rating") if not s.rating: s.rating = 0 s.imdb_id = show["imdb"].movieID s.save() for g in datos.get("genres"): gen, created = Genero.objects.get_or_create(nombre=g) s.genero.add( gen ) except: pass
def create_initial_data(request): #usuarios Admin userAndy = User(username="******", password="******", first_name="Andy", last_name="Castillo", email="*****@*****.**", is_staff=True) userAndy.save() userAndy.set_password("12345") userAndy.save() userMarco = User(username="******", password="******", first_name="Marco", last_name="Fuentes", email="*****@*****.**", is_staff=True) userMarco.save() userMarco.set_password("12345678") userMarco.save() #Awards awardGoty = Award(name="Game Award", entity="The Game Awards", category="Juego del año", year=2019) awardGoty.save() awardBestMovie = Award(name="Oscar", entity="The Academy", category="Mejor película", year=2019) awardBestMovie.save() awardBestActionMovie = Award(name="Oscar", entity="The Academy", category="Mejor película de acción", year=2019) awardBestActionMovie.save() awardBestSerie = Award(name="Emmy", entity="Television Academy", category="Mejor serie", year=2019) awardBestSerie.save() awardBestActor2019 = Award(name="Oscar", entity="The Academy", category="Mejor actor", year=2019) awardBestActor2019.save() awardBestActress2019 = Award(name="Oscar", entity="The Academy", category="Mejor actriz", year=2019) awardBestActress2019.save() awardBestShooter = Award(name="Game Award", entity="The Game Awards", category="Mejor shooter", year=2019) awardBestShooter.save() awardBestDirector = Award(name="Oscar", entity="The Academy", category="Mejor director", year=2019) awardBestDirector.save() awardBestActor2018 = Award(name="Oscar", entity="The Academy", category="Mejor actor", year=2019) awardBestActor2018.save() awardBestActress2018 = Award(name="Oscar", entity="The Academy", category="Mejor actriz", year=2018) awardBestActress2018.save() #Consoles consoleXboxOne = Console(name="Xbox One",release_date="2013-11-22", brand="Microsoft") consoleXboxOne.save() consolePS4 = Console(name="PlayStation 4",release_date="2013-11-15", brand="Sony") consolePS4.save() consoleSwitch = Console(name="Switch",release_date="2017-03-03", brand="Nintendo") consoleSwitch.save() console64 = Console(name="Nintendo 64",release_date="1996-06-23", brand="Nintendo") console64.save() consoleXbox360 = Console(name="Xbox 360",release_date="2005-11-22", brand="Microsoft") consoleXbox360.save() consolePS3 = Console(name="PlayStation 3",release_date="2006-11-11", brand="Sony") consolePS3.save() consolePc = Console(name="PC",release_date="1950-09-21", brand="Variado") consolePc.save() #Géneros genreAction = Genre(name="Acción") genreAction.save() genreThriller = Genre(name="Thriller") genreThriller.save() genreAdventure = Genre(name="Aventura") genreAdventure.save() genreHorror = Genre(name="Horror") genreHorror.save() genreComedy = Genre(name="Comedia") genreComedy.save() genreRomantic = Genre(name="Romance") genreRomantic.save() genreShooter = Genre(name="Disparos") genreShooter.save() genrePlatform = Genre(name="Plataformas") genrePlatform.save() genreMusical = Genre(name="Musical") genreMusical.save() genreDrama = Genre(name="Drama") genreDrama.save() genreSport = Genre(name="Deporte") genreSport.save() #Developers developerActivision= Developer(name="Activision", country="Estados Unidos", year_founded=1979) developerActivision.save() developerBlizzard= Developer(name="Blizzard", country="Estados Unidos", year_founded=1991) developerBlizzard.save() developerEA= Developer(name="Electronic Arts", country="Estados Unidos", year_founded=1982) developerEA.save() developerUbisoft= Developer(name="Ubisoft", country="Francia", year_founded=1986) developerUbisoft.save() developerNintendo= Developer(name="Nintendo", country="Japón", year_founded=1889) developerNintendo.save() developerRockstar= Developer(name="Rockstar Games", country="Estados Unidos", year_founded=1998) developerRockstar.save() developerNaughty= Developer(name="Naughty Dog", country="Estados Unidos", year_founded=1986) developerNaughty.save() developerSquareEnix= Developer(name="Square Enix", country="Japón", year_founded=1975) developerSquareEnix.save() developerBethesda= Developer(name="Bethesda Game Studios", country="Estados Unidos", year_founded=2001) developerBethesda.save() #Movie producers movieProducerLucasfilm = MovieProducer(name="Lucasfilm", country="Estados Unidos", year_founded=1971) movieProducerLucasfilm.save() movieProducerMarvel = MovieProducer(name="Marvel Studios", country="Estados Unidos", year_founded=2007) movieProducerMarvel.save() movieProducerDisney = MovieProducer(name="Walt Disney Pictures", country="Estados Unidos", year_founded=1923) movieProducerDisney.save() movieProducerUniversal = MovieProducer(name="Universal Studios", country="Estados Unidos", year_founded=1912) movieProducerUniversal.save() movieProducerFox = MovieProducer(name="20th Century Fox", country="Estados Unidos", year_founded=1935) movieProducerFox.save() movieProducerColumbia = MovieProducer(name="Columbia Pictures", country="Estados Unidos", year_founded=1924) movieProducerColumbia.save() #Directores directorAnthony = Director(name="Anthony", lastName="Russo",birthDate="1970-02-03", birthPlace="Estados Unidos", netWorth="500000", height=1.70, nickname="Rus") directorAnthony.save() directorAnthony.awards.add(awardBestDirector) directorAnthony.save() directorSpielberg = Director(name="Steven", lastName="Spielberg",birthDate="1946-12-18", birthPlace="Estados Unidos", netWorth="1000000", height=1.80, nickname="Steve") directorSpielberg.save() directorSpielberg.awards.add(awardBestDirector) directorSpielberg.save() directorMartin = Director(name="Martin", lastName="Scorsese",birthDate="1942-11-17", birthPlace="Estados Unidos", netWorth="250000", height=1.75, nickname="Bart") directorMartin.save() directorLucas = Director(name="George", lastName="Lucas",birthDate="1944-05-14", birthPlace="Estados Unidos", netWorth="1100000", height=1.85, nickname="Luke") directorLucas.save() directorJohn = Director(name="John", lastName="Lasseter",birthDate="1957-01-12", birthPlace="Estados Unidos", netWorth="300000", height=1.77, nickname="Johnny") directorJohn.save() #Actores actorDiCaprio = Actor(name="Leonardo", lastName="DiCaprio", birthDate="1974-11-11", birthPlace="Estados Unidos", netWorth=1000000, height=1.85, nickname="Leo") actorDiCaprio.save() actorDiCaprio.awards.add(awardBestActor2018) actorDiCaprio.save() actorIronMan = Actor(name="Robert", lastName="Downey Jr", birthDate="1965-04-04", birthPlace="Estados Unidos", netWorth=900000, height=1.82, nickname="Iron Man") actorIronMan.save() actorIronMan.awards.add(awardBestActor2019) actorIronMan.save() actorRey = Actor(name="Daisy", lastName="Ridley", birthDate="1992-04-10", birthPlace="Inglaterra", netWorth=800000, height=1.80, nickname="Rey") actorRey.save() actorRey.awards.add(awardBestActress2018, awardBestActor2019) actorRey.save() actorOwen = Actor(name="Owen", lastName="Wilson", birthDate="1968-11-18", birthPlace="Estados Unidos", netWorth=750000, height=1.81, nickname="Wil") actorOwen.save() actorPratt = Actor(name="Chris", lastName="Pratt", birthDate="1979-06-21", birthPlace="Estados Unidos", netWorth=600000, height=1.90, nickname="Star Lord") actorPratt.save() actorSpiderMan = Actor(name="Tom", lastName="Holland", birthDate="1996-06-01", birthPlace="Inglaterra", netWorth=800000, height=1.73, nickname="Spider Man") actorSpiderMan.save() actorJennifer = Actor(name="Jennifer", lastName="Aniston", birthDate="1969-02-11", birthPlace="Estados Unidos", netWorth=600000, height=1.75, nickname="Jen") actorJennifer.save() actorJennifer.awards.add(awardBestActress2018) actorJennifer.save() actorSpiderMan = Actor(name="Tom", lastName="Holland", birthDate="1996-06-01", birthPlace="Inglaterra", netWorth=800000, height=1.73, nickname="Spider Man") actorSpiderMan.save() actorSandraBullock = Actor(name="Sandra", lastName="Bullock", birthDate="1964-07-26", birthPlace="Estados Unidos", netWorth=840000, height=1.78, nickname="Sandy") actorSandraBullock.save() actorPhoenix = Actor(name="Joaquin", lastName="Phoenix", birthDate="1974-10-28", birthPlace="Puerto Rico", netWorth=600400, height=1.81, nickname="Joker") actorPhoenix.save() actorTheRock = Actor(name="Dwayne", lastName="Johnson", birthDate="1972-05-02", birthPlace="Estados Unidos", netWorth=900000, height=1.93, nickname="The Rock") actorTheRock.save() actorIt = Actor(name="Bill", lastName="Sakrsgard", birthDate="1990-08-06", birthPlace="Suecia", netWorth=300000, height=1.78, nickname="Clown") actorIt.save() actorBlunt = Actor(name="Emily", lastName="Blunt", birthDate="1983-02-23", birthPlace="Inglaterra", netWorth=600000, height=1.70, nickname="Emmy") actorBlunt.save() actorTroy = Actor(name="Zac", lastName="Efron", birthDate="1987-10-18", birthPlace="Estados Unidos", netWorth=600000, height=1.83, nickname="Troy") actorTroy.save() actorWolverine = Actor(name="Hugh", lastName="Jackman", birthDate="1968-10-12", birthPlace="Australia", netWorth=580000, height=1.82, nickname="Logan") actorWolverine.save() actorZendaya = Actor(name="Zendaya", lastName=".", birthDate="1996-09-01", birthPlace="Estados Unidos", netWorth=700000, height=1.80, nickname="MJ") actorZendaya.save() actorFlash = Actor(name="Grant", lastName="Gustin", birthDate="1990-01-14", birthPlace="Estados Unidos", netWorth=600000, height=1.84, nickname="Flash") actorFlash.save() actorDark = Actor(name="Louis", lastName="Hofmann", birthDate="1997-01-03", birthPlace="Alemania", netWorth=400000, height=1.82, nickname="Lou") actorDark.save() actorBreaking = Actor(name="Bryan", lastName="Cranston", birthDate="1956-03-07", birthPlace="Estados Unidos", netWorth=750000, height=1.88, nickname="Walter") actorBreaking.save() actorTWD = Actor(name="Andrew", lastName="Lincoln", birthDate="1973-09-14", birthPlace="Inglaterra", netWorth=540000, height=1.87, nickname="Rick") actorTWD.save() actorStranger = Actor(name="Millie", lastName="Bobby Brown", birthDate="2004-02-19", birthPlace="Inglaterra", netWorth=500000, height=1.68, nickname="Eleven") actorStranger.save() actorGlee = Actor(name="Lea", lastName="Michele", birthDate="1986-08-29", birthPlace="Estados Unidos", netWorth=700000, height=1.78, nickname="Rachel") actorGlee.save() actorPhineas = Actor(name="Vincent", lastName="Martella", birthDate="1992-10-15", birthPlace="Estados Unidos", netWorth=500000, height=1.79, nickname="Phineas") actorPhineas.save() actorHIMYM = Actor(name="Josh", lastName="Radnor", birthDate="1974-07-29", birthPlace="Estados Unidos", netWorth=750000, height=1.84, nickname="Ted") actorHIMYM.save() actorArrow = Actor(name="Stephen", lastName="Amell", birthDate="1981-05-08", birthPlace="Canada", netWorth=790000, height=1.87, nickname="Oliver") actorArrow.save() actorWitcher = Actor(name="Henry", lastName="Cavill", birthDate="1983-05-05", birthPlace="Inglaterra", netWorth=750000, height=1.89, nickname="Superman") actorWitcher.save() actorDrake = Actor(name="Drake", lastName="Bell", birthDate="1986-06-27", birthPlace="Estados Unidos", netWorth=650000, height=1.80, nickname="Drake Campana") actorDrake.save() actorGreys = Actor(name="Ellen", lastName="Pompeo", birthDate="1969-11-10", birthPlace="Estados Unidos", netWorth=700000, height=1.80, nickname="Meredith") actorGreys.save() #Comentarios peliculas commentAndy = MovieComment(text="Yo soy Iron Man", author=userAndy) commentAndy.save() commentMarco = MovieComment(text="Buenísima 4.5 ducks", author=userMarco) commentMarco.save() commentMarcoEndgame = MovieComment(text="Buenísima, Capitán América for life", author=userMarco) commentMarcoEndgame.save() #Películas movieEndgame = Movie(name="Avengers: Endgame", rating=5.0, budget=3.5, duration=180.0, classification="PG-13", director= directorAnthony, producer=movieProducerMarvel, imageUrl="https://static.claro.com.pe/img/otros/avengersv1.jpg") movieEndgame.save() movieEndgame.award.add(awardBestMovie, awardBestActionMovie) movieEndgame.save() movieEndgame.genres.add(genreAction) movieEndgame.save() movieEndgame.comments.add(commentAndy, commentMarcoEndgame) movieEndgame.save() movieEndgame.actors.add(actorPratt, actorIronMan, actorSpiderMan) movieEndgame.save() movieStarWars9 = Movie(name="Star Wars: Episodio IX", rating=5.0, budget=3.0, duration=150.0, classification="PG-13", director= directorLucas, producer=movieProducerLucasfilm, imageUrl="https://www.estrategiaynegocios.net/csp/mediapool/sites/dt.common.streams.StreamServer.cls?STREAMOID=STh$0zrY6CxCC7NYOjHabs$daE2N3K4ZzOUsqbU5sYs4oWYPNPFH379oUI4EQNGe6FB40xiOfUoExWL3M40tfzssyZqpeG_J0TFo7ZhRaDiHC9oxmioMlYVJD0A$3RbIiibgT65kY_CSDiCiUzvHvODrHApbd6ry6YGl5GGOZrs-&CONTENTTYPE=image/jpeg") movieStarWars9.save() movieStarWars9.award.add(awardBestMovie) movieStarWars9.save() movieStarWars9.genres.add(genreAction,genreAdventure) movieStarWars9.save() movieStarWars9.comments.add(commentMarco) movieStarWars9.save() movieStarWars9.actors.add(actorRey) movieStarWars9.save() movieCars = Movie(name="Cars", rating=5.0, budget=2.0, duration=90.0, classification="G", director= directorJohn, producer=movieProducerDisney, imageUrl="https://steamcdn-a.akamaihd.net/steam/apps/331160/header.jpg?t=1571775429") movieCars.save() movieCars.actors.add(actorOwen) movieCars.save() movieCars.genres.add(genreComedy) movieCars.save() movieWallStreet = Movie(name="The Wolf of Wall Street", rating=5.0, budget=1.0, duration=180.0, classification="R", director= directorMartin, producer=movieProducerFox, imageUrl="https://lifestyle.americaeconomia.com/sites/lifestyle.americaeconomia.com/files/styles/gallery_image/public/theres-a-free-screening-of-the-wolf-of-wall-street-near-goldman-sachs-tomorrow-night-jpg.png?itok=dAk7r_Pk") movieWallStreet.save() movieWallStreet.actors.add(actorDiCaprio) movieWallStreet.save() movieWallStreet.genres.add(genreComedy) movieWallStreet.save() movieJurassicPark = Movie(name="Jurassic World", rating=5.0, budget=1.5, duration=124.0, classification="PG-13", director= directorSpielberg, producer=movieProducerUniversal, imageUrl="https://cine3-media.s3-accelerate.amazonaws.com/2014/11/teaser-jurassic-world.jpg") movieJurassicPark.save() movieJurassicPark.actors.add(actorPratt) movieJurassicPark.save() movieJurassicPark.genres.add(genreAction, genreThriller) movieJurassicPark.save() movieSpiderMan = Movie(name="Spider-Man: Homecoming", rating=5.0, budget=2.5, duration=133.0, classification="PG-13", director= directorAnthony, producer=movieProducerMarvel, imageUrl ="https://i.blogs.es/910958/nyc/450_1000.jpg") movieSpiderMan.save() movieSpiderMan.genres.add(genreAction, genreAdventure) movieSpiderMan.save() movieSpiderMan.actors.add(actorSpiderMan, actorZendaya) movieSpiderMan.save() movieBirdBox = Movie(name="Bird Box", rating=2.0, budget=1.3, duration=124.0, classification="R", director=directorMartin, producer=movieProducerUniversal, imageUrl="https://i.blogs.es/75c686/a-ciegas-cartel/1366_2000.jpg") movieBirdBox.save() movieBirdBox.genres.add(genreThriller, genreHorror) movieBirdBox.save() movieBirdBox.actors.add(actorSandraBullock) movieBirdBox.save() movieJoker = Movie(name="Joker", rating=4.0, budget=2.0, duration=122.0, classification="R", director=directorJohn, producer=movieProducerColumbia, imageUrl="https://diablorock.com/wp-content/uploads/2019/10/joker-2019-diablorock-1280x720.jpg") movieJoker.save() movieJoker.genres.add(genreThriller, genreDrama) movieJoker.save() movieJoker.actors.add(actorPhoenix) movieJoker.save() movieJumanji = Movie(name="Jumanji", rating=3.0, budget=1.5, duration=119.0, classification="PG-13", director=directorAnthony, producer=movieProducerColumbia, imageUrl="https://cdn.shopify.com/s/files/1/0747/3829/products/mL0293.jpg?v=1571444811") movieJumanji.save() movieJumanji.genres.add(genreAdventure, genreAction, genreComedy) movieJumanji.save() movieJumanji.actors.add(actorTheRock) movieJumanji.save() movieIt = Movie(name="It", rating=2.0, budget=1.9, duration=135.0, classification="R", director=directorAnthony, producer=movieProducerFox, imageUrl="https://images3.alphacoders.com/817/817146.jpg") movieIt.save() movieIt.genres.add(genreHorror) movieIt.save() movieIt.actors.add(actorIt) movieIt.save() movieQuietPlace = Movie(name="A Quiet Place", rating=4.0, budget=2.9, duration=90.0, classification="PG-13", director=directorSpielberg, producer=movieProducerUniversal, imageUrl="https://static-1.ivoox.com/audios/0/1/0/7/2781578057010_XXL.jpg") movieQuietPlace.save() movieQuietPlace.genres.add(genreHorror) movieQuietPlace.save() movieQuietPlace.actors.add(actorBlunt) movieQuietPlace.save() movieProposal = Movie(name="The Proposal", rating=4.0, budget=1.5, duration=103.0, classification="PG-13", director=directorLucas, producer=movieProducerFox, imageUrl="https://img.allw.mn/thumbs/zj/j7/ncl13aul5d40efe897eae874583552_979x979.jpg") movieProposal.save() movieProposal.genres.add(genreComedy, genreRomantic) movieProposal.save() movieProposal.actors.add(actorSandraBullock) movieProposal.save() movieTitanic = Movie(name="Titanic", rating=5.0, budget=2.5, duration=194.0, classification="PG-13", director=directorJohn, producer=movieProducerUniversal, imageUrl="https://titanicsound.files.wordpress.com/2014/11/titanic_movie-hd-1.jpg") movieTitanic.save() movieTitanic.actors.add(actorDiCaprio) movieTitanic.save() movieTitanic.genres.add(genreRomantic, genreDrama) movieTitanic.save() movieHighSchool = Movie(name="High School Musical", rating=2.0, budget=2.5, duration=198.0, classification="PG", director=directorMartin, producer=movieProducerDisney, imageUrl="https://e.radio-studio92.io/normal/2020/04/16/210621_928888.jpg") movieHighSchool.save() movieHighSchool.genres.add(genreRomantic, genreMusical) movieHighSchool.save() movieHighSchool.actors.add(actorTroy) movieHighSchool.save() movieMiserable = Movie(name="Les Misérables", rating=3.0, budget=2.2, duration=168.0, classification="PG-13", director=directorJohn, producer=movieProducerFox, imageUrl="https://www.artrix.co.uk/UserFiles/image/whatson/Les_Miserables_Movie_Wallpaper_1600x900.jpg") movieMiserable.save() movieMiserable.genres.add(genreDrama, genreMusical) movieMiserable.save() movieMiserable.actors.add(actorWolverine) movieMiserable.save() movieShowman = Movie(name="The Greatest Showman", rating=4.0, budget=2.1, duration=165.0, classification="PG", director=directorAnthony, producer=movieProducerFox, imageUrl="https://bombanoise.com/wp-content/uploads/2019/03/the-greatest-showman.jpg") movieShowman.save() movieShowman.genres.add(genreMusical, genreDrama) movieShowman.save() movieShowman.actors.add(actorWolverine, actorZendaya, actorTroy) movieShowman.save() #Comentarios Series commentAndyFriends = SerieComment(text="The Big Bang Theory es mejor", author=userAndy) commentAndyFriends.save() commentMarcoFriends = SerieComment(text="Excelente", author=userMarco) commentMarcoFriends.save() commentAndyArrow = SerieComment(text="Muy buena serie", author=userAndy) commentAndyArrow.save() #Series serieFriends = Serie(name="Friends", rating=3.0, seasons=10, classification="TV-14", director=directorJohn, imageUrl="https://smp.vgc.no/v2/images/bafa0544-7013-4f72-a167-23e409c10485?fit=crop&h=435&w=652&s=8d721fd5084ff21e67cf253f19320df0dfacdfd3") serieFriends.save() serieFriends.comments.add(commentAndyFriends, commentMarcoFriends) serieFriends.save() serieFriends.actors.add(actorJennifer) serieFriends.save() serieFriends.genres.add(genreComedy, genreRomantic) serieFriends.save() serieFriends.awards.add(awardBestSerie) serieFriends.save() serieArrow = Serie(name="Arrow", rating=5.0, seasons=8, classification="TV-14", director=directorAnthony, imageUrl="https://depor.com/resizer/cr8Nd6FcTtLiq4SSsVDnPi6Ize8=/980x528/smart/arc-anglerfish-arc2-prod-elcomercio.s3.amazonaws.com/public/IOLVRP6FNFC4BLSNQNBVWGKXBM.jpg") serieArrow.save() serieArrow.comments.add(commentAndyArrow) serieArrow.save() serieArrow.genres.add(genreAction, genreAdventure, genreDrama) serieArrow.save() serieArrow.actors.add(actorArrow) serieArrow.save() serieWitcher = Serie(name="The Witcher", rating=2.0, seasons=1, classification="TV-MA", director=directorSpielberg, imageUrl="https://occ-0-33-37.1.nflxso.net/dnm/api/v6/X194eJsgWBDE2aQbaNdmCXGUP-Y/AAAABQYHuuRO8hPojbcDF-eNuU_PppZawwQPwA5e2GX9cNq6Cwa4B51pt1ynmeQmThZHZy6oieGg-jRbP0VdfSLO1O1N00eAY_tiez_lpEghlVr0ytaakKICyi7bZOGcfQ.jpg?r=382") serieWitcher.save() serieWitcher.genres.add(genreThriller, genreAction, genreAdventure) serieWitcher.save() serieWitcher.actors.add(actorWitcher) serieWitcher.save() serieBigBang = Serie(name="The Big Bang theory", rating=5.0, seasons=12, classification="TV-14", director=directorMartin, imageUrl="https://www.icmedianet.org/wp/ndog/wp-content/uploads/2014/06/the-big-bang-theory.jpg") serieBigBang.save() serieBigBang.genres.add(genreComedy) serieBigBang.save() serieBigBang.comments.add(commentAndyArrow) serieBigBang.save() serieBigBang.actors.add(actorOwen) serieBigBang.save() serieDrake = Serie(name="Drake & Josh", rating=5.0, seasons=4, classification="TV-Y7", director=directorMartin, imageUrl="https://dam.tvynovelas.com/us/wp-content/uploads/2019/03/drake-josh-show-nuevo-prin.jpg") serieDrake.save() serieDrake.genres.add(genreComedy) serieDrake.save() serieDrake.actors.add(actorDrake) serieDrake.save() serieGreys = Serie(name="Greys Anatomy", rating=5.0, seasons=17, classification="TV-14", director=directorJohn, imageUrl="https://live.mrf.io/statics/i/ps/d2m1kqghccc19k.cloudfront.net/wp-content/uploads/2019/02/01172709/portada3.jpg?width=1200&enable=upscale") serieGreys.save() serieGreys.genres.add(genreDrama, genreRomantic) serieGreys.save() serieGreys.actors.add(actorGreys) serieGreys.save() serieFlash = Serie(name="The Flash", rating=4.0, seasons=7, classification="TV-PG", director=directorLucas, imageUrl="https://www.bolsamania.com/seriesadictos/wp-content/uploads/2018/01/the-flash.jpg") serieFlash.save() serieFlash.genres.add(genreAction, genreAdventure, genreDrama) serieFlash.save() serieFlash.actors.add(actorFlash) serieFlash.save() serieDark = Serie(name="Dark", rating=2.0, seasons=3, classification="TV-MA", director=directorSpielberg, imageUrl="https://cdn.culturagenial.com/es/imagenes/dark-logo-cke.jpg") serieDark.save() serieDark.genres.add(genreThriller, genreHorror) serieDark.save() serieDark.actors.add(actorDark) serieDark.save() serieBreaking = Serie(name="Breaking Bad", rating=3.0, seasons=5, classification="TV-MA", director=directorAnthony, imageUrl="https://www.seriemaniac.com/wp-content/uploads/2013/10/que-significa-Breaking-Bad.jpg") serieBreaking.save() serieBreaking.genres.add(genreAction, genreThriller) serieBreaking.save() serieBreaking.actors.add(actorBreaking) serieBreaking.save() serieTWD = Serie(name="The Walking Dead", rating=4.0, seasons=11, classification="TV-MA", director=directorLucas, imageUrl="https://i2.wp.com/www.moonmagazine.info/wp-content/uploads/2017/10/the_walking_dead_claves_portada_moonmagazine.jpg?fit=1920%2C1080&ssl=1") serieTWD.save() serieTWD.genres.add(genreThriller, genreHorror) serieTWD.save() serieTWD.actors.add(actorTWD) serieTWD.save() serieStranger = Serie(name="Stranger Things", rating=5.0, seasons=4, classification="TV-14", director=directorMartin, imageUrl="https://upload.wikimedia.org/wikipedia/commons/3/38/Stranger_Things_logo.png") serieStranger.save() serieStranger.genres.add(genreHorror, genreThriller) serieStranger.save() serieStranger.actors.add(actorStranger) serieStranger.save() serieGlee = Serie(name="Glee", rating=2.0, seasons=6, classification="TV-PG", director=directorAnthony, imageUrl="https://vanguardia.com.mx/sites/default/files/styles/paragraph_image_large_desktop_1x/public/hkqhr3wqs_qx.jpg") serieGlee.save() serieGlee.genres.add(genreMusical, genreComedy) serieGlee.save() serieGlee.actors.add(actorGlee) serieGlee.save() seriePhineas = Serie(name="Phineas & Ferb", rating=3.0, seasons=4, classification="TV-G", director=directorMartin, imageUrl="https://fanatical.imgix.net/product/original/ed119f6b-7dfa-470a-947c-988b77362fb6.jpg?auto=compress,format&w=400&fit=max") seriePhineas.save() seriePhineas.genres.add(genreMusical) seriePhineas.save() seriePhineas.actors.add(actorPhineas) seriePhineas.save() serieHIMYM = Serie(name="How I Met Your Mother", rating=4.0, seasons=9, classification="TV-14", director=directorLucas, imageUrl="https://e.rpp-noticias.io/normal/2020/02/26/342834_905965.png") serieHIMYM.save() serieHIMYM.genres.add(genreComedy, genreRomantic) serieHIMYM.save() serieHIMYM.actors.add(actorHIMYM) serieHIMYM.save() #Comentarios juegos commentCodAndy = GameComment(text="El mejor shooter", author = userAndy) commentCodAndy.save() commentCodMarco = GameComment(text="Perfecto, muy educativo y entretenido para los pequeñines", author= userMarco) commentCodMarco.save() commentOverwatch = GameComment(text="Me encanta", author=userMarco) commentOverwatch.save() #Juegos game = Videogame(title="Call of Duty: Modern Warfare", classification="M", release_date="2019-10-25", rating=5.0, developer=developerActivision, imageUrl="https://media.redadn.es/imagenes/call-of-duty-modern-warfare-2019-pc-ps4-xbox-one_327982_pn.jpg") game.save() game.genres.add(genreAction, genreShooter) game.save() game.comments.add(commentCodMarco, commentCodAndy) game.save() game.consoles.add(consoleXboxOne, consolePS4, consolePc) game.save() game = Videogame(title="Overwatch", classification="T", release_date="2016-05-24", rating=4.0, developer=developerBlizzard, imageUrl="https://www.educo.org/Educo/media/Imagenes/Blog/%C2%BFDebo-dejar-a-mis-hijos-jugar-con-Overwatch-portada-ok.jpg") game.save() game.genres.add(genreAction, genreShooter) game.save() game.comments.add(commentOverwatch) game.save() game.consoles.add(consoleXboxOne, consolePS4, consolePc) game.save() game = Videogame(title="Super Mario Odyssey", classification="E10+", release_date="2017-10-27", rating=5.0, developer=developerNintendo, imageUrl="https://faros.hsjdbcn.org/sites/default/files/styles/shareimg/public/super-mario-odyssey-nintendo-switch_319061.jpg?itok=oYPL0vzO") game.save() game.genres.add(genrePlatform, genreAdventure) game.save() game.consoles.add(consoleSwitch) game.save() game = Videogame(title="Fifa 20", classification="E", release_date="2019-09-27", rating=5.0, developer=developerEA, imageUrl="https://www.lavanguardia.com/r/GODO/LV/p6/WebSite/2019/09/26/Recortada/img_agarcial_20190926-231319_imagenes_lv_terceros_hipertextual-fifa-20-2019472741-kjMH-U47658119552mdD-992x558@LaVanguardia-Web.jpg") game.save() game.genres.add(genreSport) game.save() game.consoles.add(consoleSwitch, consoleXboxOne, consolePS4) game.save() game = Videogame(title="GTA V", classification="M", release_date="2013-09-17", rating=5.0, developer=developerRockstar, imageUrl="https://as.com/meristation/imagenes/2020/05/15/trucos/1589544811_331717_1589544882_noticia_normal.jpg") game.save() game.genres.add(genreAction, genreShooter) game.save() game.consoles.add(consoleXboxOne, consolePS4, consolePS3, consoleXbox360, consolePc) game.save() game = Videogame(title="Assassins Creed: Odyssey", classification="M", release_date="2018-10-05", rating=2.0, developer=developerUbisoft, imageUrl="https://i.blogs.es/248355/1/450_1000.jpg") game.save() game.genres.add(genreAdventure, genreAction) game.save() game.consoles.add(consoleXboxOne, consolePS4) game.save() game = Videogame(title="Mario Kart 64", classification="E", release_date="1996-12-14", rating=2.0, developer=developerNintendo, imageUrl="https://www.nintenderos.com/wp-content/uploads/2018/10/mario-kart-64.jpg") game.save() game.genres.add(genreSport) game.save() game.consoles.add(console64) game.save() game = Videogame(title="The Last of Us", classification="M", release_date="2013-06-14", rating=4.0, developer=developerNaughty, imageUrl="https://i.pinimg.com/originals/8d/33/b0/8d33b0d0842bf507993021d9ef8b6dd2.jpg") game.save() game.genres.add(genreThriller, genreDrama) game.save() game.consoles.add(consolePS3, consolePS4) game.save() game = Videogame(title="Tomb Raider", classification="M", release_date="2018-09-14", rating=2.0, developer=developerSquareEnix, imageUrl="https://irrompibles.net/irrwp/wp-content/uploads/2018/09/images_2018_informes_shadow-tomb-raider_shadow-of-the-tomb-raider-review.jpg") game.save() game.genres.add(genreThriller, genreAdventure) game.save() game.consoles.add(consolePS4, consoleXboxOne) game.save() game = Videogame(title="Resident Evil 7", classification="M", release_date="2017-01-24", rating=3.0, developer=developerSquareEnix, imageUrl="https://static-abcblogs.abc.es/wp-content/uploads/sites/97/2018/04/resident-evil-7-biohazard-en-espanol-D_NQ_NP_990715-MLA26546800369_122017-F-516x315.jpg") game.save() game.genres.add(genreThriller, genreHorror) game.save() game.consoles.add(consolePS4, consoleXboxOne, consolePc) game.save() game = Videogame(title="Bioshock", classification="M", release_date="2007-08-21", rating=2.0, developer=developerEA, imageUrl="https://as.com/meristation/imagenes/2020/06/02/analisis/1591088622_947400_1591088960_noticia_normal.jpg") game.save() game.genres.add(genreHorror) game.save() game.consoles.add(consolePS4, consoleXboxOne, consoleXbox360, consolePS3) game.save() game = Videogame(title="Doom", classification="M", release_date="2007-08-21", rating=4.0, developer=developerBethesda, imageUrl="https://cdn02.nintendo-europe.com/media/images/10_share_images/games_15/nintendo_switch_4/H2x1_NSwitch_Doom_image1600w.jpg") game.save() game.genres.add(genreHorror, genreAction) game.save() game.consoles.add(consolePS4, consoleXboxOne, consoleSwitch) game.save() game = Videogame(title="NBA 2K20", classification="E", release_date="2019-09-06", rating=4.0, developer=developerEA, imageUrl="https://steamcdn-a.akamaihd.net/steam/apps/1089350/header.jpg?t=1573674198") game.save() game.genres.add(genreSport) game.save() game.consoles.add(consolePS4, consoleXboxOne) game.save() game = Videogame(title="Guitar Hero World Tour", classification="E", release_date="2008-10-06", rating=5.0, developer=developerActivision, imageUrl="https://images3.alphacoders.com/671/thumb-350-671832.jpg") game.save() game.genres.add(genreMusical) game.save() game.consoles.add(consolePS3, consoleXbox360, consolePc) game.save() game = Videogame(title="Rock Band 4", classification="E", release_date="2015-10-06", rating=2.0, developer=developerUbisoft, imageUrl="https://applauss.com/wp-content/uploads/2015/09/Canciones-Rock-Band-4-770x511.jpg") game.save() game.genres.add(genreMusical) game.save() game.consoles.add(consolePS4, consoleXboxOne) game.save() game = Videogame(title="Just Dance 2019", classification="E", release_date="2018-10-23", rating=3.0, developer=developerUbisoft, imageUrl="https://ubistatic19-a.akamaihd.net/ubicomstatic/es-mx/global/search-thumbnail/jd19-ubicom_search_thumbnail-750x422_325114.jpg") game.save() game.genres.add(genreMusical) game.save() game.consoles.add(consolePS4, consoleXboxOne, consoleXbox360, consoleSwitch) game.save() game = Videogame(title="Super Mario Galaxy", classification="E", release_date="2007-11-01", rating=3.0, developer=developerNintendo, imageUrl="https://cdn.startselect.com/production/products/images/cdabd/31557/1338811742-360x360.jpg") game.save() game.genres.add(genrePlatform) game.save() game.consoles.add(consoleSwitch) game.save() game = Videogame(title="Super Mario Sunshine", classification="E", release_date="2002-08-26", rating=2.0, developer=developerNintendo, imageUrl="https://f3.trucoteca.com/fotos/4307/super-mario-sunshine-3.png") game.save() game.genres.add(genrePlatform) game.save() game.consoles.add(consoleSwitch) game.save() data= { 'Status': 'Ok', 'Data': 'Data imported' } return JsonResponse(data)