public async Task FindLastEpisodeNumberAsync_WithValidObject() { var animeSeriesId = this.Context.AnimeSeries.LastOrDefault(p => p.Episodes.Any()).Id; var episodeNumber = this.Context.Episodes .Where(p => p.AnimeSeriesId == animeSeriesId) .OrderByDescending(p => p.EpisodeNumber) .FirstOrDefault().EpisodeNumber; var result = await this.EpisodeService.FindLastEpisodeNumberAsync(animeSeriesId); Assert.AreEqual(episodeNumber, result); var episode = new AnimeEpisode() { AnimeSeriesId = animeSeriesId, DateCreatedAt = DateTime.UtcNow, EpisodeNumber = episodeNumber + 1 }; await this.Context.Episodes.AddAsync(episode); await this.Context.SaveChangesAsync(); episodeNumber = this.Context.Episodes .Where(p => p.AnimeSeriesId == animeSeriesId) .OrderByDescending(p => p.EpisodeNumber) .FirstOrDefault().EpisodeNumber; result = await this.EpisodeService.FindLastEpisodeNumberAsync(animeSeriesId); Assert.AreEqual(episodeNumber, result); }
public void Save(AnimeEpisode obj) { using (var session = JMMService.SessionFactory.OpenSession()) { Save(session, obj); } }
private static void PopulateVideoEpisodeFromAnimeEpisode(Video v, AnimeEpisode ep, int userid) { AniDB_Episode aep = ep.AniDB_Episode; if (aep != null) { v.EpNumber = aep.EpisodeNumber; v.Index = aep.EpisodeNumber.ToString(); v.Title = aep.EnglishName; v.OriginalTitle = aep.RomajiName; v.Rating = (float.Parse(aep.Rating, CultureInfo.InvariantCulture)).ToString(CultureInfo.InvariantCulture); if (aep.AirDateAsDate.HasValue) { v.Year = aep.AirDateAsDate.Value.Year.ToString(); v.OriginallyAvailableAt = aep.AirDateAsDate.Value.ToPlexDate(); } AnimeEpisode_User epuser = ep.GetUserRecord(userid); if (epuser != null) { v.ViewCount = epuser.WatchedCount.ToString(); if (epuser.WatchedDate.HasValue) { v.LastViewedAt = epuser.WatchedDate.Value.ToUnixTime(); } } MetroContract_Anime_Episode contract = new MetroContract_Anime_Episode(); JMMServiceImplementationMetro.SetTvDBInfo(aep.AnimeID, aep, ref contract); v.Thumb = contract.GenPoster(); v.Summary = contract.EpisodeOverview; } }
public override void ProcessCommand() { logger.Info("Processing CommandRequest_TraktShowScrobble: {0}", AnimeEpisodeID); try { if (!ServerSettings.WebCache_Trakt_Send || string.IsNullOrEmpty(ServerSettings.Trakt_Username)) { return; } AnimeEpisodeRepository repEpisodes = new AnimeEpisodeRepository(); AnimeEpisode ep = repEpisodes.GetByID(AnimeEpisodeID); if (ep != null) { // before scrobbling try to ensure the episode is in the users collection by sync'ing the series //TraktTVHelper.SyncCollectionToTrakt_Series(ep.AnimeSeries); TraktTVHelper.MarkEpisodeWatched(ep); } } catch (Exception ex) { logger.Error("Error processing CommandRequest_TraktShowScrobble: {0} - {1}", AnimeEpisodeID, ex.ToString()); return; } }
public async Task GetAllAnimesCountAsync_WithValidObjects() { var cnt = await this.AnimeService.GetAllAnimesCountAsync(); Assert.AreEqual(this.Context.Episodes.Count(), cnt); var testEpisode = new AnimeEpisode() { AnimeSeriesId = 1, DateCreatedAt = DateTime.UtcNow, EpisodeNumber = 1, }; var testEpisode2 = new AnimeEpisode() { AnimeSeriesId = 2, DateCreatedAt = DateTime.UtcNow, EpisodeNumber = 1, }; this.Context.Episodes.Add(testEpisode); this.Context.Episodes.Add(testEpisode2); this.Context.SaveChanges(); cnt = await this.AnimeService.GetAllAnimesCountAsync(); Assert.AreEqual(this.Context.Episodes.Count(), cnt); }
public void Delete(int id) { AnimeEpisode cr = GetByID(id); if (cr != null) { // delete user records AnimeEpisode_UserRepository repUsers = new AnimeEpisode_UserRepository(); foreach (AnimeEpisode_User epuser in repUsers.GetByEpisodeID(id)) { repUsers.Delete(epuser.AnimeEpisode_UserID); } } using (var session = JMMService.SessionFactory.OpenSession()) { // populate the database using (var transaction = session.BeginTransaction()) { if (cr != null) { Cache.Remove(cr); session.Delete(cr); transaction.Commit(); } } } }
public void ToggleWatchedStatusOnEpisode(string userid, string episodeid, string watchedstatus) { try { int aep = 0; int usid = 0; bool wstatus = false; if (!int.TryParse(episodeid, out aep)) { return; } if (!int.TryParse(userid, out usid)) { return; } if (!bool.TryParse(watchedstatus, out wstatus)) { return; } AnimeEpisodeRepository repEps = new AnimeEpisodeRepository(); AnimeEpisode ep = repEps.GetByID(aep); if (ep == null) { return; } ep.ToggleWatchedStatus(wstatus, true, DateTime.Now, false, false, usid, true); ep.GetAnimeSeries().UpdateStats(true, false, true); } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } }
public IActionResult Episode(int id) { AnimeEpisode episode = _animeRepository.GetEpisode(id); if (episode == null) { return(View("404Error")); } var orderedEpList = _animeRepository.GetAnimeEpisodes(episode.AnimeId).OrderBy(s => s.EpisodeNo); var current = orderedEpList.IndexOf(episode); var model = new EpisodeViewModel() { AnimeName = _animeRepository.GetAnime(episode.AnimeId).Title, Id = episode.Id, AnimeId = episode.AnimeId, EpNo = episode.EpisodeNo, Title = episode.Title, Links = episode.Links, PrevEpisode = orderedEpList.ElementAtOrDefault(current - 1), NextEpisode = orderedEpList.ElementAtOrDefault(current + 1) }; return(View(model)); }
public static void Init() { JMMUser.Populate(a => a.JMMUserID); CloudAccount.Populate(a => a.CloudID); ImportFolder.Populate(a => a.ImportFolderID); AniDB_Anime.Populate(a => a.AniDB_AnimeID); AniDB_Episode.Populate(a => a.AniDB_EpisodeID); AniDB_File.Populate(a => a.AniDB_FileID); AniDB_Anime_Title.Populate(a => a.AniDB_Anime_TitleID); AniDB_Anime_Tag.Populate(a => a.AniDB_Anime_TagID); AniDB_Tag.Populate(a => a.AniDB_TagID); CustomTag.Populate(a => a.CustomTagID); CrossRef_CustomTag.Populate(a => a.CrossRef_CustomTagID); CrossRef_File_Episode.Populate(a => a.CrossRef_File_EpisodeID); VideoLocalPlace.Populate(a => a.VideoLocal_Place_ID); VideoLocal.Populate(a => a.VideoLocalID); VideoLocalUser.Populate(a => a.VideoLocal_UserID); GroupFilter.Populate(a => a.GroupFilterID); AnimeEpisode.Populate(a => a.AnimeEpisodeID); AnimeEpisode_User.Populate(a => a.AnimeEpisode_UserID); AnimeSeries.Populate(a => a.AnimeSeriesID); AnimeSeries_User.Populate(a => a.AnimeSeries_UserID); AnimeGroup.Populate(a => a.AnimeGroupID); AnimeGroup_User.Populate(a => a.AnimeGroup_UserID); GroupFilter.PostProcess(); CleanUpMemory(); }
private void OpenEpisode(object sender, MouseButtonEventArgs e) { AnimeEpisode episode = (AnimeEpisode)(sender as StackPanel).DataContext; anime.episode = episode; if (episode.watchurl == "bulunamadi") { MessageBox.Show("Video URL'si Sunucuda Bulunamadi.", "Video URL'si bulunamadi."); return; } if (!episode.watchurl.StartsWith("{")) { //Eğer liste halinde gelirse köşeli parantezleri yok et ve izleme URL'ini kullan anime.episode.watchurl = episode.watchurl.Replace("[", "").Replace("]", ""); ytdl.openWithmpv(anime); } else { //Eğer Dictionary döndürürse Fansub/Alternatif Seçme Ekranını Aç Dictionary <string, object> obje = JsonConvert.DeserializeObject <Dictionary <string, object> >(episode.watchurl); AlternatifSecici secici = new AlternatifSecici(obje, anime); changeFrame(secici); } }
public override void ProcessCommand() { logger.Info("Processing CommandRequest_TraktCollectionEpisode: {0}-{1}", AnimeEpisodeID, Action); try { logger.Info("CommandRequest_TraktCollectionEpisode - DEBUG01"); if (!ServerSettings.Trakt_IsEnabled || string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) return; logger.Info("CommandRequest_TraktCollectionEpisode - DEBUG02"); AnimeEpisodeRepository repEpisodes = new AnimeEpisodeRepository(); AnimeEpisode ep = repEpisodes.GetByID(AnimeEpisodeID); if (ep != null) { logger.Info("CommandRequest_TraktCollectionEpisode - DEBUG03"); TraktSyncType syncType = TraktSyncType.CollectionAdd; if (ActionEnum == TraktSyncAction.Remove) syncType = TraktSyncType.CollectionRemove; TraktTVHelper.SyncEpisodeToTrakt(ep, syncType); } } catch (Exception ex) { logger.Error("Error processing CommandRequest_TraktCollectionEpisode: {0} - {1} - {2}", AnimeEpisodeID, Action, ex.ToString()); return; } }
public async Task FindOrCreateEpisodeAsync_WithValidObject() { var animeSeriesId = this.Context.AnimeSeries.LastOrDefault(p => p.Episodes.Any()).Id; var episode = this.Context.Episodes.FirstOrDefault(); var episode3 = new AnimeEpisode() { AnimeSeriesId = this.Context.AnimeSeries.FirstOrDefault().Id, EpisodeNumber = 8 }; var episode4 = new AnimeEpisode() { AnimeSeriesId = this.Context.AnimeSeries.FirstOrDefault().Id, EpisodeNumber = 9 }; var result = await this.EpisodeService.FindOrCreateEpisodeAsync(episode.AnimeSeriesId, episode.EpisodeNumber); var result3 = await this.EpisodeService.FindOrCreateEpisodeAsync(episode3.AnimeSeriesId, episode3.EpisodeNumber); var result4 = await this.EpisodeService.FindOrCreateEpisodeAsync(episode4.AnimeSeriesId, episode4.EpisodeNumber); Assert.AreEqual(episode, result); Assert.AreEqual(episode3.AnimeSeriesId, result3.AnimeSeriesId); Assert.AreEqual(episode3.EpisodeNumber, result3.EpisodeNumber); Assert.AreEqual(episode4.AnimeSeriesId, result4.AnimeSeriesId); Assert.AreEqual(episode4.EpisodeNumber, result4.EpisodeNumber); }
public override void ProcessCommand() { logger.Info("Processing CommandRequest_TraktHistoryEpisode: {0}-{1}", AnimeEpisodeID, Action); try { if (!ServerSettings.Trakt_IsEnabled || string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) { return; } AnimeEpisode ep = RepoFactory.AnimeEpisode.GetByID(AnimeEpisodeID); if (ep != null) { TraktSyncType syncType = TraktSyncType.HistoryAdd; if (ActionEnum == TraktSyncAction.Remove) { syncType = TraktSyncType.HistoryRemove; } TraktTVHelper.SyncEpisodeToTrakt(ep, syncType); } } catch (Exception ex) { logger.Error("Error processing CommandRequest_TraktHistoryEpisode: {0} - {1}", AnimeEpisodeID, ex.ToString()); return; } }
public static void Init() { JMMUser.Populate(); CloudAccount.Populate(); ImportFolder.Populate(); AniDB_Anime.Populate(); AniDB_Episode.Populate(); AniDB_File.Populate(); AniDB_Anime_Title.Populate(); AniDB_Anime_Tag.Populate(); AniDB_Tag.Populate(); CustomTag.Populate(); CrossRef_CustomTag.Populate(); CrossRef_File_Episode.Populate(); VideoLocalPlace.Populate(); VideoLocal.Populate(); VideoLocalUser.Populate(); GroupFilter.Populate(); AnimeEpisode.Populate(); AnimeEpisode_User.Populate(); AnimeSeries.Populate(); AnimeSeries_User.Populate(); AnimeGroup.Populate(); AnimeGroup_User.Populate(); // Update Contracts if necessary try { JMMUser.RegenerateDb(); CloudAccount.RegenerateDb(); ImportFolder.RegenerateDb(); AniDB_Anime.RegenerateDb(); AniDB_Episode.RegenerateDb(); AniDB_File.RegenerateDb(); AniDB_Anime_Title.RegenerateDb(); AniDB_Anime_Tag.RegenerateDb(); AniDB_Tag.RegenerateDb(); CustomTag.RegenerateDb(); CrossRef_CustomTag.RegenerateDb(); CrossRef_File_Episode.RegenerateDb(); VideoLocalPlace.RegenerateDb(); VideoLocal.RegenerateDb(); VideoLocalUser.RegenerateDb(); AnimeEpisode.RegenerateDb(); AnimeEpisode_User.RegenerateDb(); AnimeSeries.RegenerateDb(); AnimeSeries_User.RegenerateDb(); AnimeGroup.RegenerateDb(); AnimeGroup_User.RegenerateDb(); GroupFilter.RegenerateDb(); GroupFilter.PostProcess(); } catch (Exception e) { LogManager.GetCurrentClassLogger().Error(e, "There was an error starting the Database Factory"); } CleanUpMemory(); }
public AnimeEpisode GetByAniDBEpisodeID(ISession session, int epid) { AnimeEpisode obj = session .CreateCriteria(typeof(AnimeEpisode)) .Add(Restrictions.Eq("AniDB_EpisodeID", epid)) .UniqueResult <AnimeEpisode>(); return(obj); }
public void Save(ISession session, AnimeEpisode obj) { // populate the database using (var transaction = session.BeginTransaction()) { session.SaveOrUpdate(obj); transaction.Commit(); } }
private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { if (listBox2.SelectedIndex >= 0) { SelectedEpisode = SelectedSeason.Episodes[listBox2.SelectedIndex]; label6.Text = $"Name:{SelectedEpisode.EpisodePath.Name}\r\nResolution: {SelectedEpisode.EpisodeInfo.VideoWidth}x{SelectedEpisode.EpisodeInfo.VideoHeight}\r\nFrame rate: {SelectedEpisode.EpisodeInfo.VideoFrameRate} fps\r\nBitrate: {SelectedEpisode.EpisodeInfo.VideoBitrate} kbps\r\nSize: {Utils.BytesToString(SelectedEpisode.EpisodePath.Length)}\r\nDuration: {SelectedEpisode.EpisodeInfo.Duration}\r\nDescription: {SelectedEpisode.EpisodeInfo.Description}"; checkBox1.Checked = SelectedEpisode.Watched; } }
private void GetTraktEpisodeNumber(AnimeEpisode aniepisode, Trakt_Show show, int season, ref int traktEpNum, ref int traktSeason) { try { traktEpNum = -1; traktSeason = -1; AnimeSeries ser = aniepisode.GetAnimeSeries(); if (ser == null) { return; } //Dictionary<int, int> dictTraktSeasons = GetDictTraktSeasons(show); //Dictionary<int, Trakt_Episode> dictTraktEpisodes = GetDictTraktEpisodes(show); Dictionary <int, int> dictTraktSeasons = null; Dictionary <int, Trakt_Episode> dictTraktEpisodes = null; GetDictTraktEpisodesAndSeasons(show, ref dictTraktEpisodes, ref dictTraktSeasons); int epNum = aniepisode.AniDB_Episode.EpisodeNumber; //episode if (aniepisode.EpisodeTypeEnum == AniDBAPI.enEpisodeType.Episode) { if (dictTraktEpisodes != null && dictTraktSeasons != null) { if (dictTraktSeasons.ContainsKey(season)) { int absEpisodeNumber = dictTraktSeasons[season] + epNum - 1; if (dictTraktEpisodes.ContainsKey(absEpisodeNumber)) { Trakt_Episode tvep = dictTraktEpisodes[absEpisodeNumber]; traktEpNum = tvep.EpisodeNumber; traktSeason = tvep.Season; } } } } if (aniepisode.EpisodeTypeEnum == AniDBAPI.enEpisodeType.Special) { traktSeason = 0; traktEpNum = epNum; } return; } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); return; } }
public static void CleanUpMemory() { AniDB_Anime.GetAll().ForEach(a => a.CollectContractMemory()); VideoLocal.GetAll().ForEach(a => a.CollectContractMemory()); AnimeEpisode.GetAll().ForEach(a => a.CollectContractMemory()); AnimeEpisode_User.GetAll().ForEach(a => a.CollectContractMemory()); AnimeSeries.GetAll().ForEach(a => a.CollectContractMemory()); AnimeSeries_User.GetAll().ForEach(a => a.CollectContractMemory()); AnimeGroup.GetAll().ForEach(a => a.CollectContractMemory()); AnimeGroup_User.GetAll().ForEach(a => a.CollectContractMemory()); GC.Collect(); }
public IActionResult DeleteEpisode(int id) { AnimeEpisode episode = _animeRepository.GetEpisode(id); if (episode == null) { return(View("404Error")); } _animeRepository.DeleteEpisode(id); return(RedirectToAction("Episodes", new{ id = episode.AnimeId })); }
public static void Init() { JMMUser.Populate(); CloudAccount.Populate(); ImportFolder.Populate(); AniDB_Anime.Populate(); AniDB_Episode.Populate(); AniDB_File.Populate(); AniDB_Anime_Title.Populate(); AniDB_Anime_Tag.Populate(); AniDB_Tag.Populate(); CustomTag.Populate(); CrossRef_CustomTag.Populate(); CrossRef_File_Episode.Populate(); VideoLocalPlace.Populate(); VideoLocal.Populate(); VideoLocalUser.Populate(); GroupFilter.Populate(); AnimeEpisode.Populate(); AnimeEpisode_User.Populate(); AnimeSeries.Populate(); AnimeSeries_User.Populate(); AnimeGroup.Populate(); AnimeGroup_User.Populate(); // Update Contracts if necessary JMMUser.RegenerateDb(); CloudAccount.RegenerateDb(); ImportFolder.RegenerateDb(); AniDB_Anime.RegenerateDb(); AniDB_Episode.RegenerateDb(); AniDB_File.RegenerateDb(); AniDB_Anime_Title.RegenerateDb(); AniDB_Anime_Tag.RegenerateDb(); AniDB_Tag.RegenerateDb(); CustomTag.RegenerateDb(); CrossRef_CustomTag.RegenerateDb(); CrossRef_File_Episode.RegenerateDb(); VideoLocalPlace.RegenerateDb(); VideoLocal.RegenerateDb(); VideoLocalUser.RegenerateDb(); AnimeEpisode.RegenerateDb(); AnimeEpisode_User.RegenerateDb(); AnimeSeries.RegenerateDb(); AnimeSeries_User.RegenerateDb(); AnimeGroup.RegenerateDb(); AnimeGroup_User.RegenerateDb(); GroupFilter.RegenerateDb(); GroupFilter.PostProcess(); CleanUpMemory(); }
public static bool PopulateVideo(Video l, VideoLocal v, AnimeEpisode ep, AnimeSeries series, AniDB_Anime ani, Video nv, JMMType type, int userid) { PopulateVideoEpisodeFromVideoLocal(l, v, type); if (ep != null) { PopulateVideoEpisodeFromAnimeEpisode(l, ep, userid); if (series != null) { return(PopulateVideoEpisodeFromAnime(l, ani, nv)); } } return(false); }
private void Download(object sender, RoutedEventArgs e) { AnimeEpisode episode = (AnimeEpisode)(sender as Button).DataContext; anime.episode = episode; if (episode.watchurl == "bulunamadi") { MessageBox.Show("Video URL'si Sunucuda Bulunamadi.", "Video URL'si bulunamadi."); return; } ytdl.addToQueue(anime); }
/// <summary> /// Get TVDB info from Anime Episode /// </summary> /// <param name="episode">Anime Episode reference</param> /// <param name="seriesid">TVDB Series ID</param> /// <param name="seasonidx">TVDB Season Number</param> /// <param name="episodeidx">TVDB Episode Number</param> /// <returns></returns> public static bool GetTVDBEpisodeInfo(AnimeEpisode episode, out string seriesid, out int seasonidx, out int episodeidx) { seriesid = null; seasonidx = 0; episodeidx = 0; if (episode.Series == null) { return(false); } seriesid = episode.Series.TvDB_ID.HasValue ? episode.Series.TvDB_ID.ToString() : null; if (seriesid == null) { return(false); } // get air date in valid tvdb form string episodeAirDate = episode.AniDB_Episode.AirDateAsDate.ToString("yyyy-MM-dd"); TvDB_Episode tvdbEpisode = null; List <TvDB_Episode> tvdbEpisodes = episode.Series.TvDB_Episodes; // episode Number is not absolute in some case e.g. multiple animeseries mapped to the same tvdb series if (episode.Series.TvDB_SeasonNumber == null || episode.Series.TvDB_SeasonNumber == 1) { // first try absolute episode order tvdbEpisode = tvdbEpisodes.FirstOrDefault(e => e.Absolute_number == episode.EpisodeNumber); } // try title / airdate matching, this should support specials if (tvdbEpisode == null) { tvdbEpisode = tvdbEpisodes.FirstOrDefault(e => e.EpisodeName == episode.EpisodeName || e.FirstAired == episodeAirDate); // try My Anime's helper, doesn't support specials if (tvdbEpisode == null) { tvdbEpisode = episode.GetTvDBEpisode(); } } if (tvdbEpisode == null) { return(false); } seasonidx = tvdbEpisode.SeasonNumber; episodeidx = tvdbEpisode.EpisodeNumber; return(true); }
public static void CleanUpMemory() { AniDB_Anime.GetAll().ForEach(a => a.CollectContractMemory()); VideoLocal.GetAll().ForEach(a => a.CollectContractMemory()); AnimeEpisode.GetAll().ForEach(a => a.CollectContractMemory()); AnimeEpisode_User.GetAll().ForEach(a => a.CollectContractMemory()); AnimeSeries.GetAll().ForEach(a => a.CollectContractMemory()); AnimeSeries_User.GetAll().ForEach(a => a.CollectContractMemory()); AnimeGroup.GetAll().ForEach(a => a.CollectContractMemory()); AnimeGroup_User.GetAll().ForEach(a => a.CollectContractMemory()); GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); }
public IActionResult EditEpisode(EpisodeEditViewModel model) { if (ModelState.IsValid) { AnimeEpisode episode = _animeRepository.GetEpisode(model.Id); episode.Title = model.Title; episode.Links = model.Alternative1 + "," + model.Alternative2 + "," + model.Alternative3 + "," + model.Alternative4 + "," + model.Alternative5; _animeRepository.UpdateEpisode(episode); return(RedirectToAction("Episodes", new{ id = episode.AnimeId })); } return(View()); }
public void UpdateContract(ISession session, AnimeEpisode_User aeu) { AnimeEpisodeRepository aerepo = new AnimeEpisodeRepository(); Contract_AnimeEpisode caep = aeu.Contract ?? new Contract_AnimeEpisode(); AnimeEpisode ep = aerepo.GetByID(aeu.AnimeEpisodeID); if (ep == null) { return; } AniDB_Episode aniEp = ep.AniDB_Episode; caep.AniDB_EpisodeID = ep.AniDB_EpisodeID; caep.AnimeEpisodeID = ep.AnimeEpisodeID; caep.AnimeSeriesID = ep.AnimeSeriesID; caep.DateTimeUpdated = ep.DateTimeUpdated; caep.IsWatched = aeu.WatchedCount > 0 ? 1 : 0; caep.PlayedCount = aeu.PlayedCount; caep.StoppedCount = aeu.StoppedCount; caep.WatchedCount = aeu.WatchedCount; caep.WatchedDate = aeu.WatchedDate; if (aniEp != null) { caep.AniDB_AirDate = aniEp.AirDateAsDate; caep.AniDB_EnglishName = aniEp.EnglishName; caep.AniDB_LengthSeconds = aniEp.LengthSeconds; caep.AniDB_Rating = aniEp.Rating; caep.AniDB_RomajiName = aniEp.RomajiName; caep.AniDB_Votes = aniEp.Votes; caep.EpisodeNumber = aniEp.EpisodeNumber; caep.EpisodeNameRomaji = aniEp.RomajiName; caep.EpisodeNameEnglish = aniEp.EnglishName; caep.EpisodeType = aniEp.EpisodeType; } //TODO if this is needed, calculating it in here will not affect performance caep.ReleaseGroups = new List <Contract_AniDBReleaseGroup>(); aeu.Contract = caep; }
private async Task LoadProperties(AnimeEpisode episode, AnimeLink link) { this.EpisodeId = episode.Id; this.Title = await this.AnimeService.GetTitleAsync(episode.AnimeSeriesId); this.AnimeSeriesId = episode.AnimeSeriesId; this.Categories = await this.CategoryService.GetCategoriesIdNamePair(episode.AnimeSeriesId); this.EpisodeNumber = episode.EpisodeNumber; this.Episodes = await this.EpisodeService.GetAllEpisodesIdsAsync(episode.AnimeSeriesId); this.WatchEpisodeViewModel.Links = await this.EpisodeService.GetAnimeLinksForAsync(episode.Id, link.Source.Id); this.Comments = await this.EpisodeService.LoadComments(episode.Id); this.SourceName = link.Source.Name; this.WatchEpisodeViewModel.NextEpisodeId = await this.EpisodeService.GetNextEpisodeId(this.EpisodeNumber, this.AnimeSeriesId); this.WatchEpisodeViewModel.PreviousEpisodeId = await this.EpisodeService.GetPreviousEpisodeId(this.EpisodeNumber, this.AnimeSeriesId); }
public async Task <AnimeEpisode> FindOrCreateEpisodeAsync(int animeSeriesId, int episodeNumber) { var episode = await this.AnimeContext.Episodes .FirstOrDefaultAsync(p => p.AnimeSeriesId == animeSeriesId && p.EpisodeNumber == episodeNumber); if (episode == null) { episode = new AnimeEpisode() { AnimeSeriesId = animeSeriesId, EpisodeNumber = episodeNumber, DateCreatedAt = DateTime.Now }; await this.AnimeContext.Episodes.AddAsync(episode); await this.AnimeContext.SaveChangesAsync(); } return(episode); }
public IActionResult CreateEpisode(int id, AnimeEpisodeCreateViewModel model) { if (ModelState.IsValid) { AnimeEpisode newEpisode = new AnimeEpisode() { EpisodeNo = model.EpisodeNo, AnimeId = id, Title = model.Title, Links = model.Alternative1 + "," + model.Alternative2 + "," + model.Alternative3 + "," + model.Alternative4 + "," + model.Alternative5 }; _animeRepository.AddEpisode(newEpisode); return(RedirectToAction("Episodes", new { id = id })); } return(View(model)); }
/// <summary> /// Get TVDB info from Anime Episode /// </summary> /// <param name="episode">Anime Episode reference</param> /// <param name="seriesid">TVDB Series ID</param> /// <param name="seasonidx">TVDB Season Number</param> /// <param name="episodeidx">TVDB Episode Number</param> /// <returns></returns> public static bool GetTVDBEpisodeInfo(AnimeEpisode episode, out string seriesid, out int seasonidx, out int episodeidx) { seriesid = null; seasonidx = 0; episodeidx = 0; if (episode.Series == null) return false; seriesid = episode.Series.TvDB_ID.HasValue ? episode.Series.TvDB_ID.ToString() : null; if (seriesid == null) return false; // get air date in valid tvdb form string episodeAirDate = episode.AniDB_Episode.AirDateAsDate.ToString("yyyy-MM-dd"); TvDB_Episode tvdbEpisode = null; List<TvDB_Episode> tvdbEpisodes = episode.Series.TvDB_Episodes; // episode Number is not absolute in some case e.g. multiple animeseries mapped to the same tvdb series if (episode.Series.TvDB_SeasonNumber == null || episode.Series.TvDB_SeasonNumber == 1) { // first try absolute episode order tvdbEpisode = tvdbEpisodes.FirstOrDefault(e => e.Absolute_number == episode.EpisodeNumber); } // try title / airdate matching, this should support specials if (tvdbEpisode == null) { tvdbEpisode = tvdbEpisodes.FirstOrDefault(e => e.EpisodeName == episode.EpisodeName || e.FirstAired == episodeAirDate); // try My Anime's helper, doesn't support specials if (tvdbEpisode == null) tvdbEpisode = episode.GetTvDBEpisode(); } if (tvdbEpisode == null) return false; seasonidx = tvdbEpisode.SeasonNumber; episodeidx = tvdbEpisode.EpisodeNumber; return true; }
// [i] �G�s�\�[�h //========================================================================= /// <summary> /// �u�܂�Ȃ��������ԁv�o���[����|�b�v�A�b�v /// </summary> /// <remarks> /// </remarks> /// <history>2008/10/01 �V�K�쐬</history> //========================================================================= internal void PopupSoonBalloon( AnimeEpisode episode ) { if( mNotifyIcon.Visible) { string t; if( !episode.HasPlan ) return; DateTimeHelper dateTime = new DateTimeHelper( episode.StartDateTime , Settings.Default.hoursPerDay -24 ); t = "�܂�Ȃ��������Ԃł�\n\n" + dateTime.ToShortTimeString() + "���� " + episode.ToString(); mNotifyIcon.BalloonTipText = t; mNotifyIcon.ShowBalloonTip(3000); } }