public JikanAnimeListEntryAdapter(AnimeListEntry animeListEntry, ICollection <string> usernames) : this(animeListEntry)
 {
     foreach (var username in usernames)
     {
         AddUser(username);
     }
 }
예제 #2
0
 public AnimeListEntity(AnimeListEntry animeListEntry)
 {
     MalId           = animeListEntry.MalId;
     AiringStatus    = JsonConvert.SerializeObject(animeListEntry.AiringStatus);
     Days            = animeListEntry.Days;
     EndDate         = animeListEntry.EndDate;
     HasEpisodeVideo = animeListEntry.HasEpisodeVideo;
     HasPromoVideo   = animeListEntry.HasPromoVideo;
     HasVideo        = animeListEntry.HasVideo;
     ImageUrl        = animeListEntry.ImageURL;
     IsRewatching    = animeListEntry.IsRewatching;
     Priority        = animeListEntry.Priority;
     Rating          = animeListEntry.Rating;
     Score           = animeListEntry.Score;
     StartDate       = animeListEntry.StartDate;
     Title           = animeListEntry.Title;
     TotalEpisodes   = animeListEntry.TotalEpisodes;
     Type            = animeListEntry.Type;
     Url             = animeListEntry.URL;
     VideoUrl        = animeListEntry.VideoUrl;
     WatchedEpisodes = animeListEntry.WatchedEpisodes;
     WatchEndDate    = animeListEntry.WatchEndDate;
     WatchingStatus  = JsonConvert.SerializeObject(animeListEntry.WatchingStatus);
     WatchStartDate  = animeListEntry.WatchStartDate;
 }
예제 #3
0
 public Anime(AnimeListEntry entry)
 {
     Priority        = entry.Priority;
     Days            = entry.Days;
     WatchEndDate    = entry.WatchEndDate;
     WatchStartDate  = entry.WatchStartDate;
     EndDate         = entry.EndDate;
     StartDate       = entry.StartDate;
     Rating          = entry.Rating;
     IsRewatching    = entry.IsRewatching;
     HasVideo        = entry.HasVideo;
     AiringStatus    = entry.AiringStatus;
     HasPromoVideo   = entry.HasPromoVideo;
     Score           = entry.Score;
     TotalEpisodes   = entry.TotalEpisodes;
     WatchedEpisodes = entry.WatchedEpisodes;
     this.Type       = entry.Type;
     VideoUrl        = entry.VideoUrl;
     URL             = entry.URL;
     ImageURL        = entry.ImageURL;
     Title           = entry.Title;
     MalId           = entry.MalId;
     HasEpisodeVideo = entry.HasEpisodeVideo;
     WatchingStatus  = entry.WatchingStatus;
 }
예제 #4
0
        public static Anime AnimeCons(AnimeListEntry entry, Jikan jikan)
        {
            var anime = new Anime(entry);

            JikanDotNet.Anime _anime = jikan.GetAnime(anime.MalId).Result;
            return(anime);
        }
예제 #5
0
        public async static Task <Anime> AnimeConsAsync(AnimeListEntry entry, Jikan jikan)
        {
            var anime = new Anime(entry);

            //MessageBox.Show(anime.Title + ": got the info");
            return(anime);
        }
        public void SetAiringAnimeModelData_GivenValidInput_SetsDataCorrectly(AiringStatus airingStatus, string broadcast)
        {
            // Arrange
            var      sut           = new MiruAnimeModel();
            DateTime airedFromDate = new DateTime(2022, 3, 14);
            var      animeInfo     = new Anime()
            {
                MalId     = MAL_ID,
                Broadcast = broadcast,
                Title     = TITLE,
                ImageURL  = IMAGE_URL,
                Type      = TYPE,
                Aired     = new TimePeriod()
                {
                    From = airedFromDate
                }
            };
            var animeListEntry = new AnimeListEntry()
            {
                TotalEpisodes   = TOTAL_EPISODES,
                URL             = URL,
                WatchedEpisodes = WATCHED_EPISODES,
                AiringStatus    = airingStatus
            };

            // Act
            sut.SetAiringAnimeModelData(animeInfo, animeListEntry);

            // Assert
            Assert.Equal(MAL_ID, sut.MalId);
            Assert.Equal(TITLE, sut.Title);
            Assert.Equal(IMAGE_URL, sut.ImageURL);
            Assert.Equal(TOTAL_EPISODES, sut.TotalEpisodes);
            Assert.Equal(URL, sut.URL);
            Assert.Equal(WATCHED_EPISODES, sut.WatchedEpisodes);
            Assert.Equal(TYPE, sut.Type);
            Assert.True(sut.IsOnWatchingList);
            Assert.Equal(Path.Combine(Constants.ImageCacheFolderPath, $"{ MAL_ID }.jpg"), sut.LocalImagePath);
            Assert.Equal(airingStatus == AiringStatus.Airing, sut.CurrentlyAiring);
            Assert.Equal(broadcast ?? airedFromDate.ToString(), sut.Broadcast);
        }
 public JikanAnimeListEntryAdapter(AnimeListEntry animeListEntry, string username) : this(animeListEntry)
 {
     AddUser(username);
 }
 public JikanAnimeListEntryAdapter(AnimeListEntry animeListEntry)
 {
     this.animeListEntry = animeListEntry;
 }
예제 #9
0
        public async static Task <Anime> AnimeConsAsync(AnimeListEntry entry)
        {
            var jikan = new Jikan(true);

            return(await AnimeConsAsync(entry, jikan));
        }
예제 #10
0
 public static void SetAiringAnimeModelData(this MiruAnimeModel animeModel, Anime animeInfo, AnimeListEntry animeListEntry)
 {
     animeModel.MalId            = animeInfo.MalId;
     animeModel.Broadcast        = animeInfo.Broadcast ?? animeInfo?.Aired?.From.ToString();
     animeModel.Title            = animeInfo.Title;
     animeModel.ImageURL         = animeInfo.ImageURL;
     animeModel.LocalImagePath   = animeInfo.MalId.ToString();
     animeModel.TotalEpisodes    = animeListEntry.TotalEpisodes;
     animeModel.URL              = animeListEntry.URL;
     animeModel.WatchedEpisodes  = animeListEntry.WatchedEpisodes;
     animeModel.IsOnWatchingList = true;
     animeModel.CurrentlyAiring  = animeListEntry.AiringStatus == AiringStatus.Airing;
     animeModel.Type             = animeInfo.Type;
 }