public override async Task Reload()
        {
            const string url = "http://www.nicovideo.jp/api/deflist/list";

            var json = await GetJsonAsync(url);

            Videos.Clear();

            foreach (dynamic item in json["mylistitem"])
            {
                var video = VideoStatusModel.Instance.GetVideo((string)item["item_id"]);

                video.VideoUrl    = item["item_id"];
                video.Title       = item["item_data"]["title"];
                video.Description = item["description"];
                //video.Tags = data["tags"];
                //video.CategoryTag = data["categoryTags"];
                video.ViewCounter    = long.Parse(item["item_data"]["view_counter"]);
                video.MylistCounter  = long.Parse(item["item_data"]["mylist_counter"]);
                video.CommentCounter = long.Parse(item["item_data"]["num_res"]);
                video.StartTime      = NicoDataConverter.FromUnixTime((long)item["item_data"]["first_retrieve"]);
                //video.LastCommentTime = Converter.item(data["lastCommentTime"]);
                video.LengthSeconds = long.Parse(item["item_data"]["length_seconds"]);
                video.ThumbnailUrl  = item["item_data"]["thumbnail_url"];
                video.LastResBody   = item["item_data"]["last_res_body"];
                //video.CommunityIcon = data["communityIcon"];

                Videos.Add(video.VideoId);
            }
        }
Example #2
0
        public void Reload()
        {
            // ログインする。
            LoginModel.Instance.Login();

            // ログインできなかった場合
            if (!LoginModel.Instance.IsLogin)
            {
                ServiceFactory.MessageService.Error("Login error");
                return;
            }

            Videos.Clear();

            string txt = GetSmileVideoHtmlText(Constants.DeflistList);

            // TODO 入力チェック

            var json = DynamicJson.Parse(txt);

            foreach (dynamic data in json["mylistitem"])
            {
                var video = new VideoModel()
                {
                    VideoUrl    = data["item_id"],
                    Title       = data["item_data"]["title"],
                    Description = data["description"],
                    //Tags = data["tags"],
                    //CategoryTag = data["categoryTags"],
                    ViewCounter    = long.Parse(data["item_data"]["view_counter"]),
                    MylistCounter  = long.Parse(data["item_data"]["mylist_counter"]),
                    CommentCounter = long.Parse(data["item_data"]["num_res"]),
                    StartTime      = NicoDataConverter.FromUnixTime((long)data["create_time"]),
                    //LastCommentTime = Converter.ToDatetime(data["lastCommentTime"]),
                    LengthSeconds = long.Parse(data["item_data"]["length_seconds"]),
                    ThumbnailUrl  = data["item_data"]["thumbnail_url"],
                    LastResBody   = data["item_data"]["last_res_body"],
                    //CommunityIcon = data["communityIcon"]
                };

                // 状態に追加
                VideoStatusModel.Instance.VideoMerge(video);

                // 自身に追加
                Videos.Add(video.VideoId);
            }
        }