public async Task <IActionResult> PutTrailerType(int id, TrailerType trailerType) { if (id != trailerType.Id) { return(BadRequest()); } _context.Entry(trailerType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrailerTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TrailerType> > PostTrailerType(TrailerType trailerType) { _context.TrailerTypes.Add(trailerType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTrailerType", new { id = trailerType.Id }, trailerType)); }
private async Task<ChannelItemInfo> GetTrailerFromUrl(string url, TrailerType type, CancellationToken cancellationToken) { var html = await EntryPoint.Instance.GetAndCacheResponse(url, TimeSpan.FromDays(14), cancellationToken) .ConfigureAwait(false); var document = new HtmlDocument(); document.LoadHtml(html); var titleElement = document.DocumentNode.SelectSingleNode("//h1"); var links = document.DocumentNode.SelectNodes("//a"); var linksList = links == null ? new List<HtmlNode>() : links.ToList(); var info = new ChannelItemInfo { ContentType = ChannelMediaContentType.MovieExtra, ExtraType = ExtraType.Trailer, TrailerTypes = new List<TrailerType> { type }, Id = url, MediaType = ChannelMediaType.Video, Type = ChannelItemType.Media, Name = titleElement == null ? null : titleElement.InnerText, MediaSources = GetMediaInfo(linksList, html), DateCreated = DateTime.UtcNow }; // For older trailers just rely on core image providers if (TrailerType != TrailerType.ComingSoonToTheaters) { info.ImageUrl = null; } return info; }
public ActionResult Edit(int guid) { TrailerType model = CarraraSQL.TrailerTypes.Find(guid); RouteValueDictionary parameters = Request.QueryString.ToRouteValues(); if (model == null) { TempData["Page.Title"] = "Unable to Locate Trailer Type with Id " + guid.ToString() + "!"; return(RedirectToAction("Index", parameters)); } Page.Title = TempData["Page.Title"] != null ? TempData["Page.Title"].ToString() : "Edit " + model.TrailerTypeName; return(View("Manage", model)); }
public JsonResult GetTrailerTypeDetails(int TrailerTypeID) { try { TrailerType response = DBHelper.GetTrailerTypeDetails(TrailerTypeID); return(response == null?Json("NoRecordsFound") : Json(response)); } catch (System.Exception) { throw; } }
public ActionResult Add(TrailerType model) { RouteValueDictionary parameters = Request.QueryString.ToRouteValues(); if (ModelState.IsValid) { CarraraSQL.TrailerTypes.Add(model); CarraraSQL.SaveChanges(); HttpContext.Cache.Remove("TrailerTypesSelectList"); TempData["Page.Title"] = "The Trailer Type Was Added Successfully!"; return(RedirectToAction("Index", parameters)); } // Failure is always an option... Page.Title = "The Trailer Type Was NOT Added!"; Page.Message = "Please correct the following errors:"; return(View("Manage", model)); }
public InternalItemsQuery() { MinSimilarityScore = 20; GroupByPresentationUniqueKey = true; EnableTotalRecordCount = true; DtoOptions = new DtoOptions(); AlbumNames = new string[] { }; ArtistIds = new string[] { }; ExcludeArtistIds = new string[] { }; ExcludeProviderIds = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); BlockUnratedItems = new UnratedItem[] { }; Tags = new string[] { }; OfficialRatings = new string[] { }; SortBy = new string[] { }; MediaTypes = new string[] { }; Keywords = new string[] { }; IncludeItemTypes = new string[] { }; ExcludeItemTypes = new string[] { }; Genres = new string[] { }; StudioIds = new string[] { }; GenreIds = new string[] { }; ImageTypes = new ImageType[] { }; VideoTypes = new VideoType[] { }; Years = new int[] { }; PersonTypes = new string[] { }; PersonIds = new string[] { }; ChannelIds = new string[] { }; ItemIds = new string[] { }; ExcludeItemIds = new string[] { }; AncestorIds = new string[] { }; TopParentIds = new string[] { }; ExcludeTags = new string[] { }; ExcludeInheritedTags = new string[] { }; LocationTypes = new LocationType[] { }; PresetViews = new string[] { }; SourceTypes = new SourceType[] { }; ExcludeSourceTypes = new SourceType[] { }; TrailerTypes = new TrailerType[] { }; AirDays = new DayOfWeek[] { }; SeriesStatuses = new SeriesStatus[] { }; OrderBy = new List <Tuple <string, SortOrder> >(); }
public InternalItemsQuery() { MinSimilarityScore = 20; GroupByPresentationUniqueKey = true; EnableTotalRecordCount = true; DtoOptions = new DtoOptions(); AlbumIds = Array.Empty <Guid>(); ArtistIds = Array.Empty <Guid>(); AlbumArtistIds = Array.Empty <Guid>(); ContributingArtistIds = Array.Empty <Guid>(); ExcludeArtistIds = Array.Empty <Guid>(); ExcludeProviderIds = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); HasAnyProviderId = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); BlockUnratedItems = new UnratedItem[] { }; Tags = Array.Empty <string>(); OfficialRatings = Array.Empty <string>(); MediaTypes = Array.Empty <string>(); IncludeItemTypes = Array.Empty <string>(); ExcludeItemTypes = Array.Empty <string>(); Genres = Array.Empty <string>(); StudioIds = Array.Empty <Guid>(); GenreIds = Array.Empty <Guid>(); BoxSetLibraryFolders = Array.Empty <Guid>(); ImageTypes = new ImageType[] { }; VideoTypes = new VideoType[] { }; Years = Array.Empty <int>(); PersonTypes = Array.Empty <string>(); PersonIds = Array.Empty <Guid>(); ChannelIds = Array.Empty <Guid>(); ItemIds = Array.Empty <Guid>(); ExcludeItemIds = Array.Empty <Guid>(); AncestorIds = Array.Empty <Guid>(); TopParentIds = Array.Empty <Guid>(); ExcludeTags = Array.Empty <string>(); ExcludeInheritedTags = Array.Empty <string>(); PresetViews = Array.Empty <string>(); TrailerTypes = new TrailerType[] { }; SourceTypes = new SourceType[] { }; SeriesStatuses = new SeriesStatus[] { }; OrderBy = Array.Empty <ValueTuple <string, SortOrder> >(); }
public ActionResult Edit(TrailerType model) { RouteValueDictionary parameters = Request.QueryString.ToRouteValues(); if (model.Action == "Delete") { TrailerType entity = CarraraSQL.TrailerTypes.Find(model.TrailerTypeID); if (entity.Loads.Any() || entity.Vehicles.Any()) { Page.Title = "The Trailer Type Is In Use And Was NOT Deleted!"; Page.Message = "Set the Trailer Type to Inactive if you do not intend to use this Trailer Type again."; return(View("Manage", model)); } try { CarraraSQL.TrailerTypes.Attach(model); CarraraSQL.TrailerTypes.Remove(model); CarraraSQL.SaveChanges(); HttpContext.Cache.Remove("TrailerTypesSelectList"); TempData["Page.Title"] = "The Trailer Type Was Deleted Successfully"; return(RedirectToAction("Index", parameters)); } catch (Exception ex) { Page.Title = "The Trailer Type Was NOT Deleted! " + ex.Message; return(View("Manage", model)); } } if (ModelState.IsValid) { CarraraSQL.Entry(model).State = EntityState.Modified; CarraraSQL.SaveChanges(); HttpContext.Cache.Remove("TrailerTypesSelectList"); TempData["Page.Title"] = "The Trailer Type Was Updated Successfully"; return(RedirectToAction("Index", parameters)); } Page.Title = "The Trailer Type Was NOT Updated!"; Page.Message = "Please correct the following errors:"; return(View("Manage", model)); }
public InternalItemsQuery() { GroupByPresentationUniqueKey = true; EnableTotalRecordCount = true; AlbumNames = new string[] { }; ArtistNames = new string[] { }; BlockUnratedItems = new UnratedItem[] { }; Tags = new string[] { }; OfficialRatings = new string[] { }; SortBy = new string[] { }; MediaTypes = new string[] { }; IncludeItemTypes = new string[] { }; ExcludeItemTypes = new string[] { }; Genres = new string[] { }; Studios = new string[] { }; StudioIds = new string[] { }; GenreIds = new string[] { }; ImageTypes = new ImageType[] { }; VideoTypes = new VideoType[] { }; Years = new int[] { }; PersonTypes = new string[] { }; PersonIds = new string[] { }; ChannelIds = new string[] { }; ItemIds = new string[] { }; AncestorIds = new string[] { }; TopParentIds = new string[] { }; ExcludeTags = new string[] { }; ExcludeInheritedTags = new string[] { }; LocationTypes = new LocationType[] { }; ExcludeLocationTypes = new LocationType[] { }; PresetViews = new string[] { }; SourceTypes = new SourceType[] { }; ExcludeSourceTypes = new SourceType[] { }; TrailerTypes = new TrailerType[] { }; AirDays = new DayOfWeek[] { }; SeriesStatuses = new SeriesStatus[] { }; }
private async Task <ChannelItemInfo> GetTrailerFromUrl(string url, TrailerType type, CancellationToken cancellationToken) { var html = await EntryPoint.Instance.GetAndCacheResponse(url, TimeSpan.FromDays(14), cancellationToken) .ConfigureAwait(false); var document = new HtmlDocument(); document.LoadHtml(html); var titleElement = document.DocumentNode.SelectSingleNode("//h1"); var links = document.DocumentNode.SelectNodes("//a"); var linksList = links == null ? new List <HtmlNode>() : links.ToList(); var info = new ChannelItemInfo { ContentType = ChannelMediaContentType.MovieExtra, ExtraType = ExtraType.Trailer, TrailerTypes = new List <TrailerType> { type }, Id = url, MediaType = ChannelMediaType.Video, Type = ChannelItemType.Media, Name = titleElement == null ? null : titleElement.InnerText, MediaSources = GetMediaInfo(linksList, html), DateCreated = DateTime.UtcNow }; // For older trailers just rely on core image providers if (TrailerType != TrailerType.ComingSoonToTheaters) { info.ImageUrl = null; } return(info); }
public async Task<IEnumerable<ChannelItemInfo>> GetChannelItems(ChannelMediaContentType contentType, ExtraType extraType, TrailerType trailerType, CancellationToken cancellationToken) { var items = await GetAllItems(false, cancellationToken).ConfigureAwait(false); return items .Where(i => i.ContentType == contentType && i.ExtraType == extraType && i.TrailerTypes.Contains(trailerType)); }
public async Task <IEnumerable <ChannelItemInfo> > GetChannelItems(ChannelMediaContentType contentType, ExtraType extraType, TrailerType trailerType, CancellationToken cancellationToken) { var items = await GetAllItems(false, cancellationToken).ConfigureAwait(false); return(items .Where(i => i.ContentType == contentType && i.ExtraType == extraType && i.TrailerTypes.Contains(trailerType))); }
public ActionResult Vehicles() { int found = 0; int imported = 0; StringBuilder errors = new StringBuilder(); using (OldDataManager.Models.OldDataManager context = new OldDataManager.Models.OldDataManager()) { var items = context.Vehicles.ToList(); found = items.Count(); foreach (var item in items) { Vehicle existing = DataContext.Vehicles.FirstOrDefault(x => x.OriginalId == item.VehicleID); if (existing == null) { int?locationId = null; if (item.LocationID.HasValue) { Location type = DataContext.Locations.FirstOrDefault(x => x.OriginalId.Value == item.LocationID); if (type != null) { locationId = type.LocationId; } } int?trailerTypeId = null; if (item.LocationID.HasValue) { TrailerType type = DataContext.TrailerTypes.FirstOrDefault(x => x.OriginalId.Value == item.TrailerTypeID); if (type != null) { trailerTypeId = type.TrailerTypeId; } } int?vehicleTypeId = null; if (item.LocationID.HasValue) { VehicleType type = DataContext.VehicleTypes.FirstOrDefault(x => x.OriginalId.Value == item.VehicleTypeID); if (type != null) { vehicleTypeId = type.VehicleTypeId; } } try { DataContext.Vehicles.Add(new Vehicle { Active = item.IsActive, CurrentMeterReading = item.CurrentMeterReading, DefaultDriverId = item.DefaultDriverID.ToString(), EZPass = item.EZPass, GrossAxleWeightRating = item.GrossAxleWeightRating, GrossVehicleWeightRating = item.GrossVehicleWeightRating, IsOnRoad = item.IsOnRoad, LastGrease = item.LastGrease, LastOil = item.LastOil, LastService = item.LastService, LastUpdated = DateTime.Now, Length = item.Length, Make = item.Make, Name = item.VehicleName, NextGrease = item.NextGrease, NextOil = item.NextOil, NextService = item.NextService, Number = item.VehicleNumber, NumberOfAxles = item.NumberOfAxles, Registration = item.Registration, RegistrationDate = item.RegistrationDate, RegistrationExpiration = item.RegistrationExpiration, ShouldExportUsage = item.ShouldExportUsage, VehicleCode = item.VehicleCode, VIN = item.VIN, Weight = item.Weight, Year = item.Year, LocationId = locationId, OriginalId = item.VehicleID, TrailerTypeId = trailerTypeId, VehicleTypeId = vehicleTypeId }); DataContext.SaveChanges(); imported++; } catch (Exception ex) { errors.AppendLine(item.VehicleTypeID + " error: " + ex.Message); } } } } return(Content("Found " + found + ", imported " + imported + " Vehicles." + Environment.NewLine + errors.ToString(), "text/plain")); }
public Trailer() { TrailerTypes = new TrailerType[] { }; }
private async Task<ChannelItemInfo> GetTrailerFromUrl(string url, TrailerType type, CancellationToken cancellationToken) { var html = await EntryPoint.Instance.GetAndCacheResponse(url, TimeSpan.FromDays(14), cancellationToken) .ConfigureAwait(false); var document = new HtmlDocument(); document.LoadHtml(html); var titleElement = document.DocumentNode.SelectSingleNode("//title"); var name = titleElement == null ? string.Empty : (titleElement.InnerText ?? string.Empty); name = name.Replace("Movie Trailer", string.Empty, StringComparison.OrdinalIgnoreCase) .Replace("Movie-List.com", string.Empty, StringComparison.OrdinalIgnoreCase) .Replace("Movie-List", string.Empty, StringComparison.OrdinalIgnoreCase) .Replace("|", string.Empty, StringComparison.OrdinalIgnoreCase) .Trim(); var posterElement = document.DocumentNode.SelectSingleNode("//a[@rel='prettyPhoto[posters]']//img"); if (posterElement == null) { posterElement = document.DocumentNode.SelectSingleNode("//section[@class='content-box']//img"); } var imageSrc = posterElement == null ? null : posterElement.GetAttributeValue("src", null); var links = document.DocumentNode.SelectNodes("//a"); var linksList = links == null ? new List<HtmlNode>() : links.ToList(); var info = new ChannelItemInfo { ContentType = ChannelMediaContentType.MovieExtra, ExtraType = ExtraType.Trailer, TrailerTypes = new List<TrailerType> { type }, Id = url, MediaType = ChannelMediaType.Video, Type = ChannelItemType.Media, Name = name, ImageUrl = string.IsNullOrWhiteSpace(imageSrc) ? null : (BaseUrl + imageSrc.TrimStart('/')), MediaSources = GetMediaInfo(linksList, html), DateCreated = DateTime.UtcNow }; // For older trailers just rely on core image providers if (TrailerType != TrailerType.ComingSoonToTheaters) { info.ImageUrl = null; } var metadataElements = document.DocumentNode.SelectNodes("//*[contains(@class,'cast-meta')]"); if (metadataElements != null) { foreach (var elem in metadataElements) { FillMetadataFromElement(elem, info); } } var imdbId = GetImdbId(linksList); if (!string.IsNullOrWhiteSpace(imdbId)) { info.SetProviderId(MetadataProviders.Imdb, imdbId); } return info; }
private async Task <ChannelItemInfo> GetTrailerFromUrl(string url, TrailerType type, CancellationToken cancellationToken) { var html = await EntryPoint.Instance.GetAndCacheResponse(url, TimeSpan.FromDays(14), cancellationToken) .ConfigureAwait(false); var document = new HtmlDocument(); document.LoadHtml(html); var titleElement = document.DocumentNode.SelectSingleNode("//title"); var name = titleElement == null ? string.Empty : (titleElement.InnerText ?? string.Empty); name = name.Replace("Movie Trailer", string.Empty, StringComparison.OrdinalIgnoreCase) .Replace("Movie-List.com", string.Empty, StringComparison.OrdinalIgnoreCase) .Replace("Movie-List", string.Empty, StringComparison.OrdinalIgnoreCase) .Replace("|", string.Empty, StringComparison.OrdinalIgnoreCase) .Trim(); var posterElement = document.DocumentNode.SelectSingleNode("//a[@rel='prettyPhoto[posters]']//img"); if (posterElement == null) { posterElement = document.DocumentNode.SelectSingleNode("//section[@class='content-box']//img"); } var imageSrc = posterElement == null ? null : posterElement.GetAttributeValue("src", null); var links = document.DocumentNode.SelectNodes("//a"); var linksList = links == null ? new List <HtmlNode>() : links.ToList(); var info = new ChannelItemInfo { ContentType = ChannelMediaContentType.MovieExtra, ExtraType = ExtraType.Trailer, TrailerTypes = new List <TrailerType> { type }, Id = url, MediaType = ChannelMediaType.Video, Type = ChannelItemType.Media, Name = name, ImageUrl = string.IsNullOrWhiteSpace(imageSrc) ? null : (BaseUrl + imageSrc.TrimStart('/')), MediaSources = GetMediaInfo(linksList, html), DateCreated = DateTime.UtcNow }; // For older trailers just rely on core image providers if (type != TrailerType.ComingSoonToTheaters) { info.ImageUrl = null; } if (random.Next(1, 10) < 2) { info.TrailerTypes.Add(TrailerType.ComingSoonToStreaming); } var metadataElements = document.DocumentNode.SelectNodes("//*[contains(@class,'cast-meta')]"); if (metadataElements != null) { foreach (var elem in metadataElements) { FillMetadataFromElement(elem, info); } } var imdbId = GetImdbId(linksList); if (!string.IsNullOrWhiteSpace(imdbId)) { info.SetProviderId(MetadataProviders.Imdb, imdbId); } return(info); }
public Trailer(TrailerType type) { TrailerType = type; }
public InternalItemsQuery() { GroupByPresentationUniqueKey = true; EnableTotalRecordCount = true; DtoOptions = new DtoOptions(); AlbumNames = new string[] { }; ArtistNames = new string[] { }; ExcludeArtistIds = new string[] { }; ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); BlockUnratedItems = new UnratedItem[] { }; Tags = new string[] { }; OfficialRatings = new string[] { }; SortBy = new string[] { }; MediaTypes = new string[] { }; Keywords = new string[] { }; IncludeItemTypes = new string[] { }; ExcludeItemTypes = new string[] { }; Genres = new string[] { }; Studios = new string[] { }; StudioIds = new string[] { }; GenreIds = new string[] { }; ImageTypes = new ImageType[] { }; VideoTypes = new VideoType[] { }; Years = new int[] { }; PersonTypes = new string[] { }; PersonIds = new string[] { }; ChannelIds = new string[] { }; ItemIds = new string[] { }; ExcludeItemIds = new string[] { }; AncestorIds = new string[] { }; TopParentIds = new string[] { }; ExcludeTags = new string[] { }; ExcludeInheritedTags = new string[] { }; LocationTypes = new LocationType[] { }; ExcludeLocationTypes = new LocationType[] { }; PresetViews = new string[] { }; SourceTypes = new SourceType[] { }; ExcludeSourceTypes = new SourceType[] { }; TrailerTypes = new TrailerType[] { }; AirDays = new DayOfWeek[] { }; SeriesStatuses = new SeriesStatus[] { }; OrderBy = new List<Tuple<string, SortOrder>>(); }