private static bool IsValid(JsonChaps jsonChaps) { List <JsonChapter> jsonChapters = jsonChaps.chapterInfo.chapters.chapter; var areAllInvalid = jsonChapters.All(IsInvalidChapter); return(!areAllInvalid); }
private static void ReplaceChapters(JsonChaps apiData, IList <Chapter> discData) { for (var i = 0; i < discData.Count; i++) { var chapter = discData[i]; var jsonChapter = apiData.chapterInfo.chapters.chapter[i]; chapter.Title = jsonChapter.name; } }
private static ChapterSearchResult Transform(JsonChaps searchResult, Playlist playlist) { var jsonChapters = searchResult.chapterInfo.chapters.chapter.Take(playlist.ChapterCount).ToArray(); return(new ChapterSearchResult { Title = string.Format("+{0}: {1}", searchResult.chapterInfo.confirmations, searchResult.chapterInfo.title), Chapters = jsonChapters.Select(Transform).ToList() }); }
private static bool IsMatch(JsonChaps jsonChaps, IList <Chapter> chapterDisc) { var chapterCountMatches = jsonChaps.chapterInfo.chapters.chapter.Count == chapterDisc.Count || jsonChaps.chapterInfo.chapters.chapter.Count == chapterDisc.Count + 1; if (!chapterCountMatches) { return(false); } for (var i = 0; i < chapterDisc.Count; i++) { var discChapter = chapterDisc[i]; var apiChapter = jsonChaps.chapterInfo.chapters.chapter[i]; if (!DoTimecodesMatch(discChapter.StartTime.TotalSeconds, apiChapter.time.TotalSeconds)) { return(false); } } return(true); }
private static ChapterSearchResult Transform(JsonChaps searchResult, Playlist playlist) { var jsonChapters = searchResult.chapterInfo.chapters.chapter.Take(playlist.ChapterCount).ToArray(); var chapters = jsonChapters.Select(Transform).ToList(); if (ShouldStripLeadingDigits(chapters)) { StripLeadingDigits(chapters); } if (ShouldPrependChapterNumbers) { PrependChapterNumbers(chapters); } return(new ChapterSearchResult { Title = string.Format("+{0}: {1}", searchResult.chapterInfo.confirmations, searchResult.chapterInfo.title), Chapters = chapters }); }
private static ChapterSearchResult Transform(JsonChaps searchResult, Playlist playlist) { var jsonChapters = searchResult.chapterInfo.chapters.chapter.Take(playlist.ChapterCount).ToArray(); return new ChapterSearchResult { Title = string.Format("+{0}: {1}", searchResult.chapterInfo.confirmations, searchResult.chapterInfo.title), Chapters = jsonChapters.Select(Transform).ToList() }; }
private static void ReplaceChapters(JsonChaps apiData, IList<Chapter> discData) { for (var i=0; i<discData.Count; i++) { var chapter = discData[i]; var jsonChapter = apiData.chapterInfo.chapters.chapter[i]; chapter.Title = jsonChapter.name; } }
private static bool IsValid(JsonChaps jsonChaps) { List<JsonChapter> jsonChapters = jsonChaps.chapterInfo.chapters.chapter; var areAllInvalid = jsonChapters.All(IsInvalidChapter); return !areAllInvalid; }
private static bool IsMatch(JsonChaps jsonChaps, IList<Chapter> chapterDisc) { var chapterCountMatches = jsonChaps.chapterInfo.chapters.chapter.Count == chapterDisc.Count || jsonChaps.chapterInfo.chapters.chapter.Count == chapterDisc.Count + 1; if (!chapterCountMatches) return false; for (var i = 0; i < chapterDisc.Count; i++) { var discChapter = chapterDisc[i]; var apiChapter = jsonChaps.chapterInfo.chapters.chapter[i]; if (!DoTimecodesMatch(discChapter.StartTime.TotalSeconds, apiChapter.time.TotalSeconds)) return false; } return true; }