public TVSeriesWatch GetSeriesWatch(string urlPart) { if (IsUrlPartInvalid(urlPart)) { return(null); } return(Adapter.ReadByContext(c => { TVSeries tvSeries = GetByUrlPart(c, urlPart); if (tvSeries == null) { return null; } TVSeries parentTVSeries = GetParent(c, tvSeries.ParentId); if (parentTVSeries == null) { return null; } TVSeriesInfo coverInfo = ToCoverInfo(parentTVSeries); if (coverInfo == null) { return null; } TVSeriesWatch result = ToTVSeriesWatch(tvSeries); result.SetSeriesInfo(coverInfo); return result; })); }
private long Save(long parentId, string urlPart, string info, TVSeriesDataType tvSeriesDataType) { long result = IdValidator.INVALID_ID; Adapter.ActionByContext(c => { TVSeries tvSeries = GetByUrlPart(c, urlPart); if (tvSeries == null) { tvSeries = new TVSeries(); c.TVSeries.Add(tvSeries); } tvSeries.ParentId = parentId; tvSeries.Info = info; tvSeries.UrlPart = urlPart; tvSeries.IsVisible = true; tvSeries.LanguageId = _languageId; tvSeries.DataType = (byte)tvSeriesDataType; c.SaveChanges(); result = tvSeries.Id; }); return(result); }
public void ListViewMouseDoubleClick(TVSeries item) { TVSeriesExtended tvSeriesExtended = _model.GetExtendedTVSeriesItem(item); TVSeriesWindow tvSeriesWindow = new TVSeriesWindow(tvSeriesExtended, TVSeriesWindowMode.View, _model); tvSeriesWindow.ShowDialog(); }
private static Production GetTrimmedProduction(Production production) { ProductionFactory productionFactory = new ProductionFactory(); Production trimmedProduction = productionFactory.Build(production.ProductionType); trimmedProduction.ID = production.ID; trimmedProduction.IMDbID = production.IMDbID; trimmedProduction.Title = production.Title; trimmedProduction.Year = production.Year; trimmedProduction.ProductionType = production.ProductionType; if (trimmedProduction is Movie) { Movie movie = production as Movie; Movie trimmedMovie = trimmedProduction as Movie; trimmedMovie.Budget = movie.Budget; trimmedMovie.FilmingLocations = movie.FilmingLocations; trimmedMovie.OriginalTitle = movie.OriginalTitle; trimmedMovie.PlotSummary = movie.PlotSummary; trimmedMovie.Runtime = movie.Runtime; trimmedMovie.StoryLine = movie.StoryLine; trimmedMovie.TagLines = movie.TagLines; } if (trimmedProduction is TVSeries) { TVSeries tvSeries = production as TVSeries; TVSeries trimmedTVSeries = trimmedProduction as TVSeries; trimmedTVSeries.EndYear = tvSeries.EndYear; } return(trimmedProduction); }
public void TestFileNameCleaner() { string[] goodNames = { @"abcdefghijklmnopqrstuvwxyz", }; string[] badNames = { @"!", @"xx\\xx\\xx", @"xx/xx////xx", @"foo: bar", @"xx/xx////xx", }; foreach (string name in goodNames) { string cleanName = TVSeries.CleanName(name); Assert.That(name == cleanName, String.Format("{0} should pass", name)); } foreach (string name in badNames) { string cleanName = TVSeries.CleanName(name); Assert.That(name != cleanName, String.Format("{0} should NOT pass", name)); } }
public PerformerDetailsViewModel(Guid id) { PerformerViewModel = new PerformerVM(Performer.GetById(id)); Entertainment[] entertainmentByPerformer = Entertainment.GetEntertainmentByPerformer(PerformerViewModel.PerformerDL); if (entertainmentByPerformer != null) { AvarageCriticPoint = Entertainment.AverageCriticPointForEntertainments(entertainmentByPerformer); AvarageUserPoint = Entertainment.AverageUserPointForEntertainments(entertainmentByPerformer); } Awards = this.GetAwardByPerfomer(); EntertainmentVMs = this.GetEntertainmentVMByPerformer(); Movies = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.Movie).ToArray(); Games = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.Game).ToArray(); TVSeries = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.TVSeries).ToArray(); Albums = Array.FindAll(EntertainmentVMs, (ent) => ent.EntertainmentType == Entertainment.Type.Album).ToArray(); MoviesByDate = Movies.OrderByDescending((ent) => ent.ReleaseDate).ToArray(); GamesByDate = Games.OrderByDescending((ent) => ent.ReleaseDate).ToArray(); TVSeriesByDate = TVSeries.OrderByDescending((ent) => ent.ReleaseDate).ToArray(); AlbumsByDate = Albums.OrderByDescending((ent) => ent.ReleaseDate).ToArray(); MoviesByCriticPoint = Movies.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray(); GamesByCriticPoint = Games.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray(); TVSeriesByCriticPoint = TVSeries.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray(); AlbumsByCriticPoint = Albums.OrderByDescending((ent) => ent.EntertainmentDL.AverageCriticPointForOneEntertainment()).ToArray(); MoviesByUserPoint = Movies.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray(); GamesByUserPoint = Games.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray(); TVSeriesByUserPoint = TVSeries.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray(); AlbumsByUserPoint = Albums.OrderByDescending((ent) => ent.EntertainmentDL.AverageUserPointForOneEntertainment()).ToArray(); }
private static TVSeriesWatch ToTVSeriesWatch(TVSeries tvSeries) { var result = JsonConvert.DeserializeObject <TVSeriesWatch>(tvSeries.Info); result.SetUrlPart(tvSeries.UrlPart); result.SetIds(tvSeries.Id, tvSeries.ParentId); return(result); }
public void ButtonEdit_Click(TVSeries item) { TVSeriesExtended tvSeriesExtended = _model.GetExtendedTVSeriesItem(item); TVSeriesWindow tvSeriesWindow = new TVSeriesWindow(tvSeriesExtended, TVSeriesWindowMode.Edit, _model); tvSeriesWindow.ShowDialog(); LoadList(); }
public ActionResult DeleteConfirmed(int id) { TVSeries tVSeries = db.TVSeries.Find(id); db.TVSeries.Remove(tVSeries); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "TVSeriesID,PosterUlr,Title,ReleaseDate,Genre,NumberSeasons")] TVSeries tVSeries) { if (ModelState.IsValid) { db.Entry(tVSeries).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tVSeries)); }
public ActionResult Create([Bind(Include = "TVSeriesID,PosterUlr,Title,ReleaseDate,Genre,NumberSeasons")] TVSeries tVSeries) { if (ModelState.IsValid) { db.TVSeries.Add(tVSeries); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tVSeries)); }
private static TVSeriesInfo ToCoverInfo(TVSeries tvSeries) { var result = JsonConvert.DeserializeObject <TVSeriesInfo>(tvSeries.Info); if (result != null) { result.SetUrlPart(tvSeries.UrlPart); result.SetId(tvSeries.Id); } return(result); }
public void GetShow() { // Setup new search object TVSearcher tvSearcher = new TVSearcher(APIKEY); tvSearcher.InternetAccess = false; TVSeries tvShow = tvSearcher.GetShow("73141"); Assert.That((tvShow.Series.id == "73141")); }
public void SearchShow() { // Setup new search object TVSearcherCache tvSearcher = new TVSearcherCache(APIKEY); TVSeries tvSearch = tvSearcher.GetSeries("American Dad", @"\\jbod\video-rw\TV\Current\American Dad"); if (tvSearch.IsSearchResult()) { Assert.That(tvSearch.Series.id == "73141", "{0} should be 73141"); } }
public void SearchShow() { // Setup new search object TVSearcher tvSearcher = new TVSearcher(APIKEY); TVSeries tvSearch = tvSearcher.GetSeries("American Dad"); if (tvSearch.IsSearchResult()) { Assert.That(tvSearch.Series.id == "73141", "{0} should be 73141"); } }
public TVSeriesWatch GetSeriesWatch(long id) { return(Adapter.ReadByContext(c => { TVSeries tvSeries = c.TVSeries.FirstOrDefault(e => e.LanguageId == _languageId && e.Id == id); if (tvSeries == null) { return null; } TVSeriesWatch result = ToTVSeriesWatch(tvSeries); return result; })); }
public void Convert(ICollection <IResponseObject> objctsToConvert) { this.ConvertedObjects.Clear(); foreach (var respObj in objctsToConvert) { TVSeries newTVseries = new TVSeries() { Id = respObj.Id, Title = respObj.Title, ReleaseDate = respObj.ReleaseDate, }; ConvertedObjects.Add(newTVseries); } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TVSeries tVSeries = db.TVSeries.Find(id); if (tVSeries == null) { return(HttpNotFound()); } return(View(tVSeries)); }
private TVSeries GetParent(StudyLanguageContext c, long parentId) { TVSeries result = null; while (IdValidator.IsValid(parentId)) { result = c.TVSeries.FirstOrDefault(e => e.LanguageId == _languageId && e.Id == parentId); if (result == null || result.DataType == (byte)TVSeriesDataType.Cover) { break; } } return(result); }
public TVSeriesInfo GetSeriesInfo(string urlPart) { if (IsUrlPartInvalid(urlPart)) { return(null); } return(Adapter.ReadByContext(c => { TVSeries tvSeries = GetByUrlPart(c, urlPart); if (tvSeries == null) { return null; } var result = JsonConvert.DeserializeObject <TVSeriesInfo>(tvSeries.Info); //result.SetUrlPart(urlPart); return result; })); }
public List <TVSeriesWatch> GetSeriesWatches(string urlPart) { return(Adapter.ReadByContext(c => { TVSeries parentTVSeries = c.TVSeries.FirstOrDefault(e => e.LanguageId == _languageId && e.UrlPart == urlPart); if (parentTVSeries == null) { return new List <TVSeriesWatch>(0); } List <TVSeriesWatch> result = GetSeriesWatches(parentTVSeries.Id, IdValidator.INVALID_ID); if (EnumerableValidator.IsNotEmpty(result)) { var coverInfo = JsonConvert.DeserializeObject <TVSeriesInfo>(parentTVSeries.Info); result[0].SetSeriesInfo(coverInfo); } return result; })); }
public async Task <IActionResult> UpdateTVSeries(Guid id, TVSeries tvSeries) { if (id != tvSeries.Id) { return(BadRequest()); } try { await _seriesService.UpdateTVSeries(id, tvSeries); } catch (DbUpdateConcurrencyException) { if (!(await MovieExists(id))) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task UpdateTVSeries(Guid id, TVSeries entity) { await _seriesRepository.UpdateAsync(id, entity); }
public async Task CreateTVSeries(TVSeries entity) { await _seriesRepository.CreateAsync(entity); }
public async Task <IActionResult> CreateTVSeries(TVSeries tvSeries) { try { await _seriesService.CreateTVSeries(tvSeries); } catch (Exception) { return(BadRequest()); } return(CreatedAtAction("GetTVSeriesById", new { id = tvSeries.Id }, tvSeries)); }
public void ListViewItemRemove(TVSeries item) { _model.RemoveTvSeriesItem(item); LoadList(); }
public void updateTVSeries(TVSeries tvSeries) { throw new System.NotImplementedException(); }
public static void Initialize(ApplicationContext context) { context.Database.EnsureCreated(); // Look for any students. if (context.Movies.Any()) { return; // DB has been seeded } var movies = new Movie[] { new Movie { Title = "Царство красоты", Description = "Люк Саваж — молодой архитектор и примерный семьянин, который считает себя самым счастливым человеком, поскольку он женат на любимой женщине и делает огромные успехи в карьере. Он очень доволен своей жизнью, но однажды его налаженному быту приходит конец. ", Link = "http://baskino.me/films/dramy/11642-carstvo-krasoty.html", isWatched = false } }; context.Movies.AddRange(movies); context.SaveChanges(); // Look for any students. if (context.TVSerials.Any()) { return; // DB has been seeded } var tvSerials = new TVSeries[] { new TVSeries { Title = "CSI: Miami", Description = "Преступления совершаются круглосуточно, а на их раскрытие требуется время. ", Link = "http://seasonvar.ru/serial-473-Mesto_prestupleniya_Majami-00001-sezon.html", isWatched = false, Season = "1", Series = "4" } }; context.TVSerials.AddRange(tvSerials); context.SaveChanges(); // Look for any students. if (context.TEDTalks.Any()) { return; // DB has been seeded } var tedTalks = new TEDTalk[] { new TEDTalk { Title = "Inside the mind of a master procrastinator", isWatched = false, Link = "https://www.youtube.com/watch?v=arj7oStGLkU&list=PLiAqvMJOAIKtu5ZENVgZ_ewYJX3crpTVU" } }; context.TEDTalks.AddRange(tedTalks); context.SaveChanges(); // Look for any students. if (context.Books.Any()) { return; // DB has been seeded } var books = new Book[] { new Book { Title = "Тайная комната", Author = "Донна Тартт", Description = "Тайная комната", IsReaded = false } }; context.Books.AddRange(books); context.SaveChanges(); }
static void Main(string[] args) { //if (false) //{ // const string theXML = "C:\\repos\\svn\\src\\TheTVDB\\xml-samples\\77345.xml"; // TVSeries tvFile = new TVSeries(); // tvFile.LoadFromFile(theXML); // if (tvFile.HasEpisodes()) // { // foreach (DataEpisode Episode in tvFile.Episodes) // { // Console.WriteLine("{0} {1}x{2} {3}", tvFile.Series.SeriesName, Episode.SeasonNumber, // Episode.EpisodeNumber, Episode.EpisodeName); // } // } // TVSeries tvSearch = new TVSeries(); // // tvSearch.LoadFromURL("http://thetvdb.com/api/GetSeries.php?seriesname=american"); // Many results // tvSearch.LoadFromURL("http://thetvdb.com/api/GetSeries.php?seriesname=american%20dad"); // One result // if (tvSearch.IsSearchResult()) // { // foreach (DataSeries s in tvSearch.Shows) // { // Console.WriteLine("{0} First Aired:{1}", s.SeriesName, s.FirstAired); // } // } //} // string showFolder = "\\\\JBOD\\video\\TV\\..\\TV\\Classic\\Gilligans Island\\Gilligans_Island_-_s01e00_Original_Pilot.avi"; // string showFolder = @"\\JBOD\video\TV\..\TV\Classic\Gilligans Island\"; const string showFolder = @"\\JBOD\video\TV\Classic\Tru Calling"; TVShowFolder myShow = new TVShowFolder(showFolder); if (myShow.IsValid) { Console.WriteLine("Show name is {0}", myShow.ShowName); } else { Console.WriteLine("Error! {0}", myShow.ErrorMessage); Console.WriteLine("Press <ENTER> to continue..."); Console.ReadLine(); Environment.Exit(1); } TVSeries tvSearch = new TVSeries(); string show = HttpUtility.UrlEncode(myShow.ShowName); string url = "http://thetvdb.com/api/GetSeries.php?seriesname=" + show; tvSearch.LoadFromURL(url); if (tvSearch.IsSearchResult()) { foreach (DataSeries s in tvSearch.Shows) { Console.WriteLine("{0} First Aired:{1}", s.SeriesName, s.FirstAired); } } if (tvSearch.Shows.Count != 1) { Console.WriteLine("Ambigious search for {0}", myShow.ShowName); Console.WriteLine("Press <ENTER> to continue..."); Console.ReadLine(); Environment.Exit(1); } string showID = tvSearch.Series.id; TVSeries tvShow = new TVSeries(); //showID = "77345"; string foo = "http://www.thetvdb.com/api/713541F4CE28A6D8/series/" + showID + "/all/en.xml"; tvShow.LoadFromURL(foo); if (tvShow.HasEpisodes()) { Console.WriteLine("We have episodes!"); } Console.WriteLine("This show has {0} seasons.", tvShow.Seasons); System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(myShow.Location); foreach (System.IO.FileInfo f in dir.GetFiles("*.*")) { TVShowNameParser myNameParser = new TVShowNameParser(f.Name); string fileExtension = Path.GetExtension(f.Name); if (myNameParser.Matched()) { Console.WriteLine("{0} Season {1}, Episode{2}", f.Name, myNameParser.Season, myNameParser.Episode); DataEpisode mine = tvShow.GetEpisode(myNameParser.Season, myNameParser.Episode); if (mine != null) { string season = String.Format("{0:00}", myNameParser.Season); string episode = String.Format("{0:00}", myNameParser.Episode); Console.WriteLine("Located Show: {0}", mine.EpisodeName); string newName = String.Format("{0} - {1}x{2} - {3}{4}", tvShow.Series.SeriesName, season, episode, mine.EpisodeName, Path.GetExtension(f.Name)); if (newName != f.Name) { Console.WriteLine("Rename me!"); } } } else { if (myNameParser.AmbigiousNaming) { Console.WriteLine("AMBIGIOUS NAMING: {0}", f.Name); } else { Console.WriteLine("CAN'T MATCH: {0}", f.Name); } } } Console.WriteLine("Press <ENTER> to continue..."); Console.ReadLine(); }
private static void Main(string[] args) { ProgramOptions options = new ProgramOptions(); // Parse command line options any errors and you get Usage if (options.ParseArgs(args) == false) { ProgramOptions.Usage(); } // We must have at least 1 path to process files, else Usage and exit if (options.PathList.Count < 1) { ProgramOptions.Usage("You must specify at least one TVShowFolder."); } List <String> validPaths = new List <string>(); foreach (string p in options.PathList) { Console.WriteLine("Processing: {0}", p); TVShowFolder f = new TVShowFolder(p); if (f.IsValid) { validPaths.Add(p); } else { Console.WriteLine("INGNORED! NOT A VALID PATH: {0}", p); } } // Read program options from the App.Config AppConfigOptions AppConfig = new AppConfigOptions(); // Setup new search object TVSearcher tvSearcher = new TVSearcher(AppConfig.ApiKey); // Search each path foreach (string p in validPaths) { TVShowFolder myShow = new TVShowFolder(p); Console.WriteLine("Looking for show: {0}", myShow.ShowName); string showID; if (myShow.HasAssignedID) { showID = myShow.AssignedID; Console.WriteLine("Has Assigned ID: {0}", showID); } else { TVSeries tvSearch = tvSearcher.GetSeries(myShow.ShowName); if (tvSearch.IsSearchResult()) { foreach (DataSeries s in tvSearch.Shows) { Console.WriteLine("Located: {0} {1} {2}", s.id, s.FirstAired, s.SeriesName); } } if (tvSearch.Shows.Count > 1) { Console.WriteLine("Ambigious search for: {0}", myShow.ShowName); Console.WriteLine("Create a .thetvdb.id file with the show ID as the 1st line."); continue; } if (tvSearch.Shows.Count == 0) { Console.WriteLine("Unable to locate: {0}", myShow.ShowName); continue; } showID = tvSearch.Series.id; } TVSeries tvShow = tvSearcher.GetShow(showID); if (!tvShow.HasEpisodes()) { Console.WriteLine("Unable to locate any episode data!"); continue; } if (tvShow.Series.Status == "Ended") { Console.WriteLine("No more episodes :-( The show has ended!"); continue; } // Load up a list of the existing files in this folder TVFiles myTVFiles = new TVFiles(p); bool foundNewEpisode = false; foreach (DataEpisode de in tvShow.Episodes) { DateTime date; try { date = DateTime.ParseExact(de.FirstAired, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } catch { // Probably a blank date so it is in the future. continue; } if (date >= DateTime.Now) { foundNewEpisode = true; Console.WriteLine("NEXT AIR: {0}\t{1}\t{2}\t{3}x{4}\t{5}", de.FirstAired, tvShow.Series.id, tvShow.Series.SeriesName, de.SeasonNumber, de.EpisodeNumber, de.EpisodeName); break; } if (!myTVFiles.Exist(Convert.ToInt32(de.SeasonNumber), Convert.ToInt32(de.EpisodeNumber))) { Console.WriteLine("MISSING! {0}\t{1}\t{2}\t{3}x{4}\t{5}", de.FirstAired, tvShow.Series.id, tvShow.Series.SeriesName, de.SeasonNumber, de.EpisodeNumber, de.EpisodeName); } } if (!foundNewEpisode) { Console.WriteLine("Unable to locate a new episode."); } } Misc.PauseIfInIDE(); }