예제 #1
0
        public async Task <bool> UpdateMylist(LoginUserMylistPlaylist mylist, string name, string description, bool isPublic, MylistSortKey sortKey, MylistSortOrder sortOrder)
        {
            var result = await _niconicoSession.ToolkitContext.Mylist.LoginUser.UpdateMylistAsync(mylist.MylistId, name, description, isPublic, sortKey, sortOrder);

            try
            {
                mylist.Name             = name;
                mylist.IsPublic         = isPublic;
                mylist.DefaultSortKey   = sortKey;
                mylist.DefaultSortOrder = sortOrder;
                mylist.Description      = description;
            }
            catch { }
            return(result);
        }
예제 #2
0
        public async Task <List <LoginUserMylistPlaylist> > GetLoginUserMylistGroups()
        {
            using var _ = await _niconicoSession.SigninLock.LockAsync();

            if (!_niconicoSession.IsLoggedIn)
            {
                return(null);
            }

            List <LoginUserMylistPlaylist> mylistGroups = new List <LoginUserMylistPlaylist>();

            var defaultMylist = await GetDefaultMylistAsync();

            mylistGroups.Add(defaultMylist);

            var res = await _niconicoSession.ToolkitContext.Mylist.LoginUser.GetMylistGroupsAsync(sampleItemCount : 1);

            if (res.Meta.Status != 200)
            {
                return(mylistGroups);
            }

            foreach (var mylistGroup in res.Data.Mylists)
            {
                var mylist = new LoginUserMylistPlaylist(mylistGroup.Id, this)
                {
                    Name        = mylistGroup.Name,
                    Count       = (int)mylistGroup.ItemsCount,
                    UserId      = mylistGroup.Owner.Id,
                    Description = mylistGroup.Description,
                    IsPublic    = mylistGroup.IsPublic,
                    //IconType = mylistGroup.co,
                    DefaultSortKey   = mylistGroup.DefaultSortKey,
                    DefaultSortOrder = mylistGroup.DefaultSortOrder,
                    SortIndex        = Array.IndexOf(res.Data.Mylists, mylistGroup),
                    ThumbnailImages  = mylistGroup.SampleItems.Take(3).Select(x => x.Video.Thumbnail.ListingUrl).ToArray(),
                };

                mylistGroups.Add(mylist);
            }

            return(mylistGroups);
        }