public string PlainText(AnimeEntry anime) { var animeStartDate = Convert.ToDateTime(anime.StrStartDate); var animeEndDate = string.IsNullOrEmpty(anime.StrEndDate) ? "" : Convert.ToDateTime(anime.StrEndDate).ToString("ddd dd-MMM-yyyy"); var season = _folderManager.GetSeasonString(animeStartDate); var sb = new System.Text.StringBuilder(); sb.AppendLine("============================================================"); sb.AppendLine("Title:" + anime.Title); sb.AppendLine("English title:" + anime.EnglishTitle); sb.AppendLine("Other names:" + anime.Synonyms); sb.AppendLine("Rating:" + anime.Score + " Season:" + season); sb.AppendLine("release date:" + animeStartDate.ToString("ddd dd-MMM-yyyy")); sb.AppendLine("ended date:" + animeEndDate); sb.AppendLine("============================================================"); sb.AppendLine("total eps:" + anime.Episodes); sb.AppendLine("Anime type:" + anime.AnimeType); sb.AppendLine("============================================================"); sb.AppendLine("synopsis:"); sb.AppendLine(HttpUtility.HtmlDecode(anime.Synopsis)); sb.AppendLine("============================================================"); return sb.ToString(); }
public string CreateFolder(AnimeEntry anime) { var animeStartDate = Convert.ToDateTime(anime.StrStartDate); var year = animeStartDate.Year; var season = this.GetSeasonString(animeStartDate); var folderPath = anime.Title.ValidAnimeFolder(); var animeType = anime.AnimeType; var pathToCreate = this.FolderPath(_baseFolderPath, year, season, folderPath, animeType); if (!System.IO.Directory.Exists(pathToCreate)) System.IO.Directory.CreateDirectory(pathToCreate); return pathToCreate; }
public List<AnimeEntry> GetNewEntriesToGenerate() { using (var dbContext = new AnimeTempEntities()) { var dbResults = dbContext.Animes.Where(x => x.StartDate != null && x.SynopsisFileLastGenerated == null).ToList(); return dbResults.Select(x => { var animePoco = new AnimeEntry(); AutoMapper.Mapper.Map(x, animePoco); return animePoco; }) .ToList(); } }
public void UpdateDetails(AnimeEntry anime) { using (var dbContext = new AnimeTempEntities()) { //var dbObjs = dbContext.Animes.Where(x => x.DataUpdatedDate == null).ToList(); var dbObj = dbContext.Animes.First(x => x.Id == anime.Id); AutoMapper.Mapper.Map(anime, dbObj); dbObj.DataUpdatedDate = DateTime.Now; dbContext.SaveChanges(); } }
public List<AnimeEntry> Search(string query) { using (var dbContext = new AnimeTempEntities()) { var dbObjs = dbContext.Animes.Where( x => x.Title.Contains(query) || x.Synonyms.Contains(query) || x.EnglishTitle.Contains(query)). OrderBy(x => x.Title).ToList(); var animeList = new List<AnimeEntry>(); foreach (var anime in dbObjs) { var animePoco = new AnimeEntry(); AutoMapper.Mapper.Map(anime, animePoco); animeList.Add(animePoco); } return animeList; } }
public string Html(AnimeEntry anime) { throw new NotImplementedException(); }