public ActionResult SetScreens()
        {
            var collections = db.FilmCollections.ToList();

            int count = 0;

            foreach (var col in collections)
            {
                FilmDetails details = db.FilmDetails.Where(fd => fd.FilmID == col.FilmID).FirstOrDefault();

                if (details != null)
                {
                    Screen screen = details.Screen;

                    var films = db.Films.Where(f => f.FilmCollectionID == col.FilmCollectionID).ToList();

                    foreach (var film in films)
                    {
                        FilmDetails filmDetails = db.FilmDetails.Where(fd => fd.FilmID == film.FilmID).FirstOrDefault();

                        if (filmDetails != null)
                        {
                            filmDetails.Screen = screen;
                            count++;
                        }
                    }
                }
            }

            db.SaveChanges();

            return(Content("OK: " + count.ToString()));
        }
Ejemplo n.º 2
0
        public List <FilmDetails> GetFilmDetails(string cs, int FilmID)
        {
            using var con = new MySqlConnection(cs);
            con.Open();

            using (MySqlCommand cmd = new MySqlCommand())
            {
                cmd.Connection  = con;
                cmd.CommandText = "spGetFilmDetails";          // The name of the Stored Proc
                cmd.CommandType = CommandType.StoredProcedure; // It is a Stored Proc

                cmd.Parameters.AddWithValue("@FilmID", FilmID);
                IList <FilmDetails> wsl = new List <FilmDetails>();
                var reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    var ws = new FilmDetails();
                    ws.FilmID      = reader.GetInt32("FilmID");
                    ws.FilmName    = reader.GetString("FilmName");
                    ws.ReleaseDate = reader.GetDateTime("ReleaseDate");
                    ws.GenreID     = reader.GetInt32("GenreID");
                    ws.DirectorID  = reader.GetInt32("DirectorID");
                    ws.Watched     = reader.GetBoolean("Watched");
                    ws.AddedByID   = reader.GetInt32("AddedByID");
                    wsl.Add(ws);
                }
                reader.Close();
                return((List <FilmDetails>)wsl);
            }
        }
Ejemplo n.º 3
0
        public static IEnumerable <RemoteImageInfo> ToRemoteImageInfos(this FilmDetails src)
        {
            var res = Enumerable.Empty <RemoteImageInfo>();

            if (src is null)
            {
                return(res);
            }

            if (src?.Data?.PosterUrl != null)
            {
                var mainPoster = new RemoteImageInfo()
                {
                    Type         = ImageType.Primary,
                    Url          = src.Data.PosterUrl,
                    Language     = Utils.ProviderMetadataLanguage,
                    ProviderName = Utils.ProviderName
                };
                res = res.Concat(Enumerable.Repeat(mainPoster, 1));
            }

            if (src.Images != null)
            {
                if (src.Images.Posters != null)
                {
                    res = res.Concat(src.Images.Posters.ToRemoteImageInfos(ImageType.Primary));
                }
                if (src.Images.Backdrops != null)
                {
                    res = res.Concat(src.Images.Backdrops.ToRemoteImageInfos(ImageType.Backdrop));
                }
            }

            return(res);
        }
        public ActionResult Detail(int id)
        {
            var filmDetails = new FilmDetails();

            filmDetails.Genre = service.GetGenre(id);
            filmDetails.Films = service.GetAlleFilmsPerGenre(id);
            return(View(filmDetails));
        }
Ejemplo n.º 5
0
        private static void GetFilm()
        {
            var film = new FilmDetails("Wiedźmin-2001-1281");

            film.Download();

            var result = film.Details;
        }
        public string UpdateFilmDetails([FromBody] FilmDetails filmDetails)
        {
            FilmDetails original = db.FilmDetails.Find(filmDetails.FilmDetailsID);

            db.Entry(original).CurrentValues.SetValues(filmDetails);
            db.SaveChanges();

            return(filmDetails.FilmDetailsID.ToString());
        }
Ejemplo n.º 7
0
        private static void LayoutPage(PdfContentByte content, List <FilmDetails> pageFilms, string runName)
        {
            double num1 = 70.0;
            double num2 = 800.0;
            double num3 = 400.0;

            for (int index = 0; index < pageFilms.Count; ++index)
            {
                FilmDetails filmDetails = pageFilms[index];
                bool        flag        = false;
                if (filmDetails.RunTime == 0)
                {
                    flag = true;
                    filmDetails.RunTime = 120;
                }
                double    num4      = 0.0491666666666667 * (double)filmDetails.RunTime * 30.0;
                double    num5      = num1 + (double)(index % 5 * 90);
                double    num6      = num5 + 90.0;
                double    num7      = index >= 5 ? num3 : num2;
                double    num8      = index >= 5 ? num3 - num4 : num2 - num4;
                Rectangle rectangle = new Rectangle((float)num5, (float)num8, (float)num6, (float)num7);
                rectangle.BorderColor       = Color.BLACK;
                rectangle.BorderWidthBottom = 1f;
                rectangle.BorderWidthLeft   = 1f;
                rectangle.BorderWidthRight  = 1f;
                rectangle.BorderWidthTop    = 1f;
                if (flag)
                {
                    rectangle.BackgroundColor = Color.RED;
                }
                content.Rectangle(rectangle);
                ColumnText columnText1 = new ColumnText(content);
                columnText1.SetSimpleColumn((float)num5, (float)num8, (float)num6, (float)num7, 15f, 1);

                columnText1.AddText(new Phrase(FormatTitle(filmDetails.Title, filmDetails.RunTime), FormatTitleFont(filmDetails.RunTime)));
                columnText1.Go();
                columnText1.AddText(new Phrase(string.Format("{0} min", (object)filmDetails.RunTime), FontFactory.GetFont("Arial", 9f)));
                columnText1.Go();
                ColumnText columnText2 = columnText1;

                String l = FormatLanguage(filmDetails.Language, filmDetails.Country);
                String c = FormatCountry(filmDetails.Language, filmDetails.Country);

                columnText1.AddText(FormatLanguageAndCountry(l, c, filmDetails.RunTime));
                columnText1.Go();

                //Resolution/ratio
                columnText1.AddText(new Phrase(string.Format("{0} / {1}", (object)filmDetails.Resolution, (object)filmDetails.Ratio), FontFactory.GetFont("Arial", 8f)));
                columnText1.Go();

                columnText1.AddText(new Phrase(string.Format("{0} / {1}", (object)filmDetails.AucklandScreeningNo, (object)filmDetails.WellingtonScreeningNo), FontFactory.GetFont("Arial", 8f)));
                columnText1.Go();

                columnText1.AddText(new Phrase(runName, FontFactory.GetFont("Arial", 16f)));
                columnText1.Go();
            }
        }
Ejemplo n.º 8
0
        public static string GetLocalName(this FilmDetails src)
        {
            var res = src?.Data?.NameRu;

            if (string.IsNullOrWhiteSpace(res))
            {
                res = src?.Data?.NameEn;
            }
            return(res);
        }
Ejemplo n.º 9
0
        public IActionResult MovieDetails(int id)
        {
            Film data = _movieRepository.getByID(id);

            FilmDetails model = new FilmDetails {
                Title = data.Title, Description = data.Description, Language = data.Language.Name, Rating = data.Rating
            };

            return(View(model));
        }
Ejemplo n.º 10
0
        public static string GetOriginalNameIfNotSame(this FilmDetails src)
        {
            var localName    = src.GetLocalName();
            var originalName = src.GetOriginalName();

            if (!string.IsNullOrWhiteSpace(originalName) && !string.Equals(localName, originalName))
            {
                return(originalName);
            }

            return(string.Empty);
        }
Ejemplo n.º 11
0
        public static Movie ToMovie(this FilmDetails src)
        {
            if (src?.Data is null)
            {
                return(null);
            }

            var res = new Movie();

            FillCommonFilmInfo(src, res);

            return(res);
        }
        private string EmitTransitDetails(FilmDetails film)
        {
            TransitTime transitTime1 = Enumerable.SingleOrDefault <TransitTime>((IEnumerable <TransitTime>) this._transitTable, (Func <TransitTime, bool>)(t => t.Origin == film.OriginatingRegion));
            int         transitTime2 = 99;

            if (transitTime1 != null)
            {
                transitTime2 = transitTime1.DaysInTransit + transitTime1.ExpectedDelay;
            }
            DateTime dateTime = ShippingCalculator.CalculateTransitInWorkingDays(film.Leaving, transitTime2);

            return(string.Format("\"{0}\",{1},{2}", (object)film.Title, (object)transitTime2, (object)dateTime.ToString("dd/MM/yyyy")));
        }
      public ActionResult Details(int id)
      {
          ViewBag.Message = "Your contact page.";

          var         filmJanr    = context.FilmJanr.Include("Films").Include("Janrs").Where(filmJ => filmJ.FilmId == id).ToList();
          var         filmCountry = context.FilmCountry.Include("Films").Include("Countries").Where(filmC => filmC.FilmId == id).ToList();
          var         films       = context.Film.Where(x => x.Id == id).FirstOrDefault();
          FilmDetails filmDetails = new FilmDetails();

          filmDetails.FilmCountry = filmCountry;
          filmDetails.FilmJanr    = filmJanr;
          filmDetails.Films       = films;
          return(View(filmDetails));
      }
Ejemplo n.º 14
0
        public IActionResult Film(string partUri)
        {
            if (string.IsNullOrWhiteSpace(partUri))
            {
                return(new StatusCodeResult(400));
            }

            var film = new FilmDetails(partUri);

            film.Download();

            var filmDetails = film.Details;

            return(new JsonResult(filmDetails.Adapt <FilmDetailsViewModel>()));
        }
Ejemplo n.º 15
0
        public static Series ToSeries(this FilmDetails src)
        {
            if (src?.Data is null)
            {
                return(null);
            }

            var res = new Series();

            FillCommonFilmInfo(src, res);

            res.EndDate = src.Data.GetEndDate();
            res.Status  = src.Data.IsContinuing()
                ? SeriesStatus.Continuing
                : SeriesStatus.Ended;

            return(res);
        }
Ejemplo n.º 16
0
        public void CheckResponse()
        {
            //Arrange
            var fakeWebResponse = WebResponseBuilder.Create(null, request: new FakeRequest());
            var filmDetails     = new FilmDetails(null, fakeWebResponse);

            //Act
            filmDetails.Download();
            var model = filmDetails.Details;

            //Assert
            Assert.Equal(CREATOR, model.Creator);
            Assert.Equal(DIRECTOR, model.Directior);
            Assert.Equal(DURATION, model.Duration);
            Assert.Equal(GENRE, model.Genre);
            Assert.Equal(RATING, model.Rating);
            Assert.Equal(TITLE, model.Title);
        }
Ejemplo n.º 17
0
        private static void FillCommonFilmInfo(FilmDetails src, BaseItem dst)
        {
            dst.SetProviderId(Utils.ProviderId, Convert.ToString(src.Data.FilmId));
            dst.Name          = src.GetLocalName();
            dst.OriginalTitle = src.GetOriginalNameIfNotSame();
            dst.PremiereDate  = src.Data.GetPremiereDate();
            dst.Overview      = src.Data.Description;
            if (src.Data.Countries != null)
            {
                dst.ProductionLocations = src.Data.Countries.Select(c => c.Country).ToArray();
            }
            if (src.Data.Genres != null)
            {
                foreach (var genre in src.Data.Genres.Select(c => c.Genre))
                {
                    dst.AddGenre(genre);
                }
            }
            if (src.Data.RatingAgeLimits.HasValue)
            {
                dst.OfficialRating = $"{src.Data.RatingAgeLimits}+";
            }
            else
            {
                dst.OfficialRating = src.Data.RatingMpaa;
            }

            if (src.Rating != null)
            {
                dst.CommunityRating = src.Rating.Rating > 0
                    ? src.Rating.Rating
                    : src.Rating.RatingImdb;
                dst.CriticRating = src.Rating.GetCriticRatingAsTenPointBased();
            }

            if (src.ExternalId != null)
            {
                if (!string.IsNullOrWhiteSpace(src.ExternalId.ImdbId))
                {
                    dst.SetProviderId(MetadataProvider.Imdb, src.ExternalId.ImdbId);
                }
            }
        }
Ejemplo n.º 18
0
        public static RemoteSearchResult ToRemoteSearchResult(this FilmDetails src)
        {
            if (src?.Data is null)
            {
                return(null);
            }

            var res = new RemoteSearchResult()
            {
                Name               = src.GetLocalName(),
                ImageUrl           = src.Data.PosterUrl,
                PremiereDate       = src.Data.GetPremiereDate(),
                Overview           = src.Data.Description,
                SearchProviderName = Utils.ProviderName
            };

            res.SetProviderId(Utils.ProviderId, Convert.ToString(src.Data.FilmId));

            return(res);
        }
Ejemplo n.º 19
0
 public static FilmDetailsVm Map(FilmDetails filmDetails)
 {
     return(new FilmDetailsVm
     {
         FilmId = filmDetails.FilmId,
         Title = filmDetails.Title,
         EpisodeId = filmDetails.EpisodeId,
         OpeningCrawl = FormatToHtml(filmDetails),
         Director = filmDetails.Director,
         Producer = filmDetails.Producer,
         ReleaseDate = filmDetails.ReleaseDate,
         Characters = filmDetails.Characters,
         Planets = filmDetails.Planets,
         Starships = filmDetails.Starships,
         Vehicles = filmDetails.Vehicles,
         Species = filmDetails.Species,
         Created = filmDetails.Created,
         Ratings = filmDetails.Ratings,
     });
 }
        public FilmDetails GetFilmDetails(int id)
        {
            Film        film    = db.Films.Find(id);
            FilmDetails details = db.FilmDetails.Include(fd => fd.Film).Include(fd => fd.StillUrls).Where(fd => fd.FilmID == id).FirstOrDefault();

            if (details == null)
            {
                details = new FilmDetails()
                {
                    FilmID    = id,
                    Film      = film,
                    StillUrls = new List <StillUrl>()
                };

                db.FilmDetails.Add(details);
                db.SaveChanges();
            }

            return(details);
        }
Ejemplo n.º 21
0
        public IList <ScheduleInfo> ExtractSchedule(IList <FilmDetails> films)
        {
            Application application = (Application) new ApplicationClass();

            application.Workbooks.Open(this.SpreadsheetLocation, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)this.Password, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value, (object)Missing.Value);
            Worksheet           worksheet = application.ActiveWorkbook.Worksheets[(object)2] as Worksheet;
            List <ScheduleInfo> list      = new List <ScheduleInfo>();

            for (int index = 3; index < worksheet.Rows.Count; ++index)
            {
                Range cell = worksheet.get_Range((object)(this.TitleCell + (object)index), (object)Missing.Value);
                if (!string.IsNullOrEmpty(cell.Text.ToString()))
                {
                    FilmDetails filmDetails = Enumerable.FirstOrDefault <FilmDetails>((IEnumerable <FilmDetails>)films, (Func <FilmDetails, bool>)(f => f.Title.ToLowerInvariant() == cell.Text.ToString().ToLowerInvariant()));
                    if (filmDetails != null)
                    {
                        ScheduleInfo scheduleInfo = new ScheduleInfo()
                        {
                            Film          = filmDetails,
                            ScheduledTime = DateTime.Parse((worksheet.get_Range((object)(this.DateCell + (object)index), (object)Missing.Value).Text.ToString() + " " + worksheet.get_Range((object)(this.TimeCell + (object)index), (object)Missing.Value).Text.ToString()).Trim()),
                            Venue         = worksheet.get_Range((object)(this.VenueCell + (object)index), (object)Missing.Value).Text.ToString(),
                            City          = worksheet.get_Range((object)(this.CityCell + (object)index), (object)Missing.Value).Text.ToString()
                        };
                        list.Add(scheduleInfo);
                        filmDetails.ScheduledTimes.Add(scheduleInfo);
                    }
                }
                else
                {
                    break;
                }
            }
            IntPtr hwnd = new IntPtr(application.Parent.Hwnd);

            application.ActiveWorkbook.Close((object)false, (object)this.SpreadsheetLocation, (object)Missing.Value);
            application.Quit();
            this.CheckAndForceKill(hwnd);
            return((IList <ScheduleInfo>)list);
        }
Ejemplo n.º 22
0
        private async Task <FilmDetails> MapTo(FilmDetailsResponse response)
        {
            var filmDetails = new FilmDetails()
            {
                FilmId       = ExtractFilmId(response.url),
                Title        = response.title,
                Created      = response.created,
                Director     = response.director,
                EpisodeId    = response.episode_id,
                OpeningCrawl = response.opening_crawl,
                Producer     = response.producer,
                ReleaseDate  = response.release_date
            };
            var charactersTask = Task.Factory.StartNew(() =>
            {
                filmDetails.Characters = GetNameByItemsUrls(response.characters).Result;
            });
            var speciesTask = Task.Factory.StartNew(() =>
            {
                filmDetails.Species = GetNameByItemsUrls(response.species).Result;
            });
            var vehiclesTask = Task.Factory.StartNew(() =>
            {
                filmDetails.Vehicles = GetNameByItemsUrls(response.vehicles).Result;
            });
            var planetsTask = Task.Factory.StartNew(() =>
            {
                filmDetails.Planets = GetNameByItemsUrls(response.planets).Result;
            });
            var starshipsTask = Task.Factory.StartNew(() =>
            {
                filmDetails.Starships = GetNameByItemsUrls(response.starships).Result;
            });

            Task.WaitAll(charactersTask, speciesTask, vehiclesTask, planetsTask, starshipsTask);

            return(filmDetails);
        }
Ejemplo n.º 23
0
        // Returns the film most likelyt to be the correct one.
        private FilmDetails getHighestMatched(string str, FilmInfoRaw account)
        {
            int score = 99999999;
            int num   = 0;
            int size  = account.results.Count;

            for (int i = 0; i < size; i++)
            {
                int a = levenshtein(str, (string)account.results[i]["title"]);
                if (a < score)
                {
                    score = a;
                    num   = i;
                }
            }

            if (score == 99999999)
            {
                return(null);
            }
            else
            {
                Console.WriteLine("FOUND: " + account.results[num]["title"] + " SCORE:  " + score);
                FilmDetails details = new FilmDetails();
                details.title    = account.results[num]["title"];
                details.id       = account.results[num]["id"];
                details.overview = account.results[num]["overview"];
                details.date     = account.results[num]["release_date"];
                details.poster   = account.results[num]["poster_path"];
                details.backdrop = account.results[num]["backdrop_path"];
                details.rating   = account.results[num]["vote_average"];

                details.date = getYear(details.date);

                return(details);
            }
        }
Ejemplo n.º 24
0
        public IActionResult FilmDetails(int id)
        {
            Film        film    = db.Films.Include(f => f.FilmCategory).Where(f => f.FilmID == id).FirstOrDefault();
            FilmDetails details = db.FilmDetails.Include(fd => fd.StillUrls).Where(fd => fd.FilmID == id).FirstOrDefault();
            List <Film> films   = null;

            if (film.FilmCategory.Description == Film.SHORT_COLLECTION)
            {
                FilmCollection col = db.FilmCollections.Where(fc => fc.FilmID == id).FirstOrDefault();

                films = db.Films.Where(f => f.FilmCollectionID == col.FilmCollectionID).ToList();

                foreach (var thisfilm in films)
                {
                    thisfilm.FilmDetails = db.FilmDetails.Where(fd => fd.FilmID == thisfilm.FilmID).FirstOrDefault();
                }
            }

            FilmDetailsViewModel vm = new FilmDetailsViewModel()
            {
                Film        = film,
                FilmDetails = details,
                Films       = films
            };

            if (CurrentMember != null)
            {
                var memberFilm = db.MemberFilms.Where(mf => mf.FilmID == id && mf.MemberID == CurrentMember.MemberID).FirstOrDefault();
                ViewBag.Booked = memberFilm != null;
            }
            else
            {
                ViewBag.Booked = false;
            }

            return(View(vm));
        }
Ejemplo n.º 25
0
 private static string FormatToHtml(FilmDetails filmDetails)
 {
     return(filmDetails.OpeningCrawl.Replace("\r\n", "<br>\r\n"));
 }
 protected override Series ConvertResponseToItem(FilmDetails apiResponse)
 => apiResponse.ToSeries();
 protected override Movie ConvertResponseToItem(FilmDetails apiResponse)
 => apiResponse.ToMovie();
        public string PostFile(int id, FileType fileType)
        {
            string message = "OK";

            if (!Request.Form.Files.Any())
            {
                return("Failure");
            }

            string subFolder = "";

            try
            {
                if (fileType == FileType.Trailer)
                {
                    subFolder = "Trailers";
                }
                else if (fileType == FileType.Poster)
                {
                    subFolder = "Posters";
                }
                else if (fileType == FileType.Still)
                {
                    subFolder = "Stills";
                }
                else if (fileType == FileType.Director)
                {
                    subFolder = "Directors";
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            string myFileName = "";
            string folder     = AppDomain.CurrentDomain.BaseDirectory + "wwwroot\\" + subFolder + "\\";

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            try
            {
                IFormFile myFile = Request.Form.Files.First();

                //myFileName = myFile.Name.Replace(" ", "");
                myFileName = Guid.NewGuid().ToString() + Path.GetExtension(myFile.Name);

                FileStream stream = new FileStream(folder + myFileName, FileMode.Create);

                myFile.CopyTo(stream);

                stream.Flush();
                stream.Close();
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            Film        film    = null;
            FilmDetails details = null;

            try
            {
                film    = db.Films.Find(id);
                details = db.FilmDetails.Include(fd => fd.Film).Include(fd => fd.StillUrls).Where(fd => fd.FilmID == id).FirstOrDefault();

                if (details == null)
                {
                    details = new FilmDetails()
                    {
                        FilmID    = id,
                        Film      = film,
                        StillUrls = new List <StillUrl>()
                    };

                    db.FilmDetails.Add(details);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }

            try
            {
                if (fileType == FileType.Trailer)
                {
                    details.TrailerUrl = "/" + subFolder + "/" + myFileName;
                }
                else if (fileType == FileType.Poster)
                {
                    details.PosterUrl = "/" + subFolder + "/" + myFileName;
                }
                else if (fileType == FileType.Still)
                {
                    details.StillUrls.Add(new StillUrl()
                    {
                        Url = "/" + subFolder + "/" + myFileName
                    });
                }
                else if (fileType == FileType.Director)
                {
                    details.DirectorPicUrl = "/" + subFolder + "/" + myFileName;
                }

                message = "OK" + myFileName;

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return(message);
        }
Ejemplo n.º 29
0
 public static string GetOriginalName(this FilmDetails src)
 => src.IsRussianSpokenOriginated()
         ? src?.Data?.NameRu
         : src?.Data?.NameEn;
Ejemplo n.º 30
0
 public static bool IsRussianSpokenOriginated(this FilmDetails src)
 => src?.Data?.IsRussianSpokenOriginated() ?? false;