Пример #1
0
 public async Task <EmptyModel> DeleteAllTracksInPlaylist(string uuid)
 {
     return(await tidlSession.DeletePlaylistTracks(
                uuid,
                (await tidlSession.GetPlaylistTracks(uuid)).ETag,
                (await tidlSession.GetUserPlaylists()).Items.Select(t => t.Id).ToList()));
 }
Пример #2
0
        public async Task <bool> DeletePlaylistTracks(string uuid)
        {
            var current = await tidlSession.GetPlaylistTracks(uuid);

            var userPlayList = await tidlSession.GetUserPlaylists();

            var ListOfIds = userPlayList.Items.Select(x => x.Id).ToList();//Run on Object and take only ids

            var deleteResponse = await tidlSession.DeletePlaylistTracks(uuid, current.ETag, ListOfIds);

            if (!string.IsNullOrEmpty(deleteResponse.ETag))
            {
                logger.Write(LogLevel.Info, $"Deleted for tag {deleteResponse.ETag}, and uuid: {uuid}");
            }
            var reTryGet = await GetPlayListTracks(uuid);//After deleted i check that there is no playlisttracks

            var isDeleted = reTryGet == null || reTryGet.Items.Length == 0;

            return(isDeleted);
        }