Exemplo n.º 1
0
        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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
        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]);
                    }
                }
            }
        }
Exemplo n.º 7
0
        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]);
                    }
                }
            }
        }
Exemplo n.º 8
0
 private DoubanMovieParser(DoubanMovie json)
 {
     this.Load(json);
 }
Exemplo n.º 9
0
 public static DoubanMovieParser Parse(DoubanMovie json)
     => new DoubanMovieParser(json);
Exemplo n.º 10
0
 public static string GetLargeImageUrl(DoubanMovie json)
 {
     return json.ThrowIfNull("json").Images.Large.ThrowIfNullOrEmpty("Large");
 }
Exemplo n.º 11
0
 public static string GetLargeImageUrl(DoubanMovie json)
 {
     return(json.ThrowIfNull("json").Images.Large.ThrowIfNullOrEmpty("Large"));
 }
Exemplo n.º 12
0
 private DoubanMovieParser(DoubanMovie json)
 {
     this.Load(json);
 }
Exemplo n.º 13
0
 public static DoubanMovieParser Parse(DoubanMovie json)
 => new DoubanMovieParser(json);