public static IEnumerable <string> ParseName(this DoubanMovie json) { if (!String.IsNullOrWhiteSpace(json.Title)) { yield return(json.Title); } if (!String.IsNullOrWhiteSpace(json.OriginalTitle)) { yield return(json.OriginalTitle); } if (json.OtherNames != null) { foreach (var originName in json.OtherNames.Where(z => !String.IsNullOrWhiteSpace(z))) { if (originName.EndsWith("(港)") || originName.EndsWith("(台)")) { yield return(originName.Substring(0, originName.Length - 3)); } else { yield return(originName); } } } }
public static string GetRawImageUrl(DoubanMovie json) { var large = GetLargeImageUrl(json); // large like 'http://img4.douban.com/view/movie_poster_cover/ipst/public/p2236401229.jpg' var server = large[10].ToString(); var item = large.Substring(large.LastIndexOf('/')); return String.Format(@"http://img{0}.douban.com/view/photo/raw/public{1}", server, item); }
public static string GetRawImageUrl(DoubanMovie json) { var large = GetLargeImageUrl(json); // large like 'http://img4.douban.com/view/movie_poster_cover/ipst/public/p2236401229.jpg' var server = large[10].ToString(); var item = large.Substring(large.LastIndexOf('/')); return(String.Format(@"http://img{0}.douban.com/view/photo/raw/public{1}", server, item)); }
private void Load(DoubanMovie json) { this.LoadName(json); this.IsMovie = json.SubType == "movie"; // EpisodesCount if (json.EpisodesCount.IsNullOrWhiteSpace()) { if (this.IsMovie) this.EpisodesCount = "1"; } else { this.EpisodesCount = json.EpisodesCount; } }
private void Load(DoubanMovie json) { this.LoadName(json); this.IsMovie = json.SubType == "movie"; // EpisodesCount if (json.EpisodesCount.IsNullOrWhiteSpace()) { if (this.IsMovie) { this.EpisodesCount = "1"; } } else { this.EpisodesCount = json.EpisodesCount; } }
private void LoadName(DoubanMovie json) { foreach (var name in json.ParseName()) { if (this.ParseSeriesName(name)) continue; var spliter = name.Split(new string[] { ":", ":" }, 2, StringSplitOptions.RemoveEmptyEntries); if (spliter.Length > 0) { if (!this.ParseSeriesName(spliter[0])) { this.seriesNames.Add(spliter[0]); } if (spliter.Length > 1) { this.entityNames.Add(spliter[1]); } } } }
private void LoadName(DoubanMovie json) { foreach (var name in json.ParseName()) { if (this.ParseSeriesName(name)) { continue; } var spliter = name.Split(new string[] { ":", ":" }, 2, StringSplitOptions.RemoveEmptyEntries); if (spliter.Length > 0) { if (!this.ParseSeriesName(spliter[0])) { this.seriesNames.Add(spliter[0]); } if (spliter.Length > 1) { this.entityNames.Add(spliter[1]); } } } }
private DoubanMovieParser(DoubanMovie json) { this.Load(json); }
public static DoubanMovieParser Parse(DoubanMovie json) => new DoubanMovieParser(json);
public static string GetLargeImageUrl(DoubanMovie json) { return json.ThrowIfNull("json").Images.Large.ThrowIfNullOrEmpty("Large"); }
public static string GetLargeImageUrl(DoubanMovie json) { return(json.ThrowIfNull("json").Images.Large.ThrowIfNullOrEmpty("Large")); }