public async Task UpdateAsync(UserPlaylist playlist, BaseItem[] newItems)
        {
            using (PerfLogger.Create("UpdatePlaylistItems",
                                     () => new { playlistName = playlist.Name, newItemsCount = newItems.Length }))

            {
                await _decorated.UpdateAsync(playlist, newItems).ConfigureAwait(false);
            }
        }
Exemplo n.º 2
0
        private async Task GetTasks(Domain.SmartPlaylist smartPlaylist, BaseItem[] items)
        {
            BaseItem[] newItems;
            var        playlist = _playlistRepository.GetUserPlaylist(smartPlaylist.UserId, smartPlaylist.Name);

            using (PerfLogger.Create("FilterPlaylistItems",
                                     () => new { playlistName = playlist.Name, itemsCount = items.Length }))
            {
                newItems = smartPlaylist.FilterPlaylistItems(playlist, items).ToArray();
            }

            await _playlistItemsUpdater.UpdateAsync(playlist, newItems).ConfigureAwait(false);
        }
Exemplo n.º 3
0
        public async Task HandleAsync(UpdateSmartPlaylistCommand message)
        {
            var smartPlaylist = await _smartPlaylistProvider.GetSmartPlaylistAsync(message.SmartPlaylistId)
                                .ConfigureAwait(false);

            var playlist = _playlistRepository.GetUserPlaylist(smartPlaylist.UserId, smartPlaylist.Name);

            var items = _userItemsProvider.GetItems(playlist.User, Const.SupportedItemTypeNames).ToArray();

            BaseItem[] newItems;
            using (PerfLogger.Create("FilterPlaylistItems",
                                     () => new { playlistName = playlist.Name, itemsCount = items.Length }))
            {
                newItems = smartPlaylist.FilterPlaylistItems(playlist, items).ToArray();
            }

            await _playlistItemsUpdater.UpdateAsync(playlist, newItems).ConfigureAwait(false);

            if (smartPlaylist.IsShuffleUpdateType)
            {
                smartPlaylist.UpdateLastShuffleTime();
                _smartPlaylistStore.Save(smartPlaylist.ToDto());
            }
        }