Exemplo n.º 1
0
        public async Task LoadDoubanAsync()
        {
            if (string.IsNullOrWhiteSpace(this.DoubanId))
            {
                return;
            }

            var movie = await DoubanHelper.TryGetMovieInfoAsync(this.DoubanId);

            if (movie != null)
            {
                this.NamesViewModel.AddRange(DoubanMovieParser.Parse(movie).SeriesNames);
            }
        }
Exemplo n.º 2
0
        public async Task LoadDoubanAsync()
        {
            if (String.IsNullOrWhiteSpace(this.DoubanId))
            {
                return;
            }

            var movie = await DoubanHelper.TryGetMovieInfoAsync(this.DoubanId);

            if (movie != null)
            {
                var doubanName = DoubanMovieParser.Parse(movie).SeriesNames.AsLines();

                this.Names = String.IsNullOrWhiteSpace(this.Names)
                    ? doubanName
                    : String.Join("\r\n", this.Names, doubanName);
            }
        }
Exemplo n.º 3
0
        public void LoadDouban(DoubanMovie info)
        {
            var parser           = DoubanMovieParser.Parse(info);
            var doubanSecondName = parser.EntityNames.AsLines();

            this.Names = this.Names.IsNullOrWhiteSpace()
                ? doubanSecondName
                : String.Join("\r\n", this.Names, doubanSecondName);

            var defaultValue = (Application.Current as App)?.UserConfig?.DefaultValue;

            if (defaultValue != null)
            {
                if (parser.IsMovie)
                {
                    if (!defaultValue.MovieType.IsNullOrWhiteSpace())
                    {
                        this.Type = defaultValue.MovieType;
                    }
                }
                else
                {
                    if (!defaultValue.SeasonType.IsNullOrWhiteSpace())
                    {
                        this.Type = defaultValue.SeasonType;
                    }
                }
            }

            if (this.Year.IsNullOrWhiteSpace())
            {
                this.Year = info.Year;
            }

            if (this.Index.IsNullOrWhiteSpace())
            {
                this.Index = info.CurrentSeason ?? parser.Index;
            }

            if (this.EpisodesCount.IsNullOrWhiteSpace())
            {
                this.EpisodesCount = parser.EpisodesCount ?? string.Empty;
            }
        }
Exemplo n.º 4
0
        private async void BeginLoadDoubanMeta(string doubanId)
        {
            var info = await DoubanHelper.TryGetMovieInfoAsync(doubanId);

            if (info != null)
            {
                var parser = DoubanMovieParser.Parse(info);
                this.NamesViewModel.AddRange(parser.EntityNames);

                var defaultValue = (Application.Current as App)?.UserConfig?.DefaultValue;
                if (defaultValue != null)
                {
                    if (parser.IsMovie)
                    {
                        if (!defaultValue.MovieType.IsNullOrWhiteSpace())
                        {
                            this.Type = defaultValue.MovieType;
                        }
                    }
                    else
                    {
                        if (!defaultValue.SeasonType.IsNullOrWhiteSpace())
                        {
                            this.Type = defaultValue.SeasonType;
                        }
                    }
                }

                if (this.Year.Value.IsNullOrWhiteSpace())
                {
                    this.Year.Value = info.Year;
                }

                if (this.Index.Value.IsNullOrWhiteSpace())
                {
                    this.Index.Value = info.CurrentSeason ?? parser.Index;
                }

                if (this.EpisodesCount.Value.IsNullOrWhiteSpace())
                {
                    this.EpisodesCount.Value = parser.EpisodesCount ?? string.Empty;
                }
            }
        }