Example #1
0
        private async Task RefreshArtist(RefreshArtist request)
        {
            var item = GetArtist(request.Name, _libraryManager);

            var cancellationToken = CancellationToken.None;

            var albums = _libraryManager.RootFolder
                         .RecursiveChildren
                         .OfType <MusicAlbum>()
                         .Where(i => i.HasArtist(item.Name))
                         .ToList();

            var musicArtists = albums
                               .Select(i => i.Parent)
                               .OfType <MusicArtist>()
                               .ToList();

            var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new Progress <double>(), cancellationToken, true, request.Forced));

            await Task.WhenAll(musicArtistRefreshTasks).ConfigureAwait(false);

            try
            {
                await item.RefreshMetadata(cancellationToken, forceRefresh : request.Forced).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.ErrorException("Error refreshing library", ex);
            }
        }
Example #2
0
        private async Task RefreshArtist(RefreshArtist request)
        {
            var item = await GetArtist(request.Name, _libraryManager).ConfigureAwait(false);

            try
            {
                await item.RefreshMetadata(CancellationToken.None, forceRefresh : request.Forced).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.ErrorException("Error refreshing library", ex);
            }
        }
        private async Task RefreshArtist(RefreshArtist request)
        {
            var item = GetArtist(request.Name, _libraryManager);

            var cancellationToken = CancellationToken.None;

            var albums = _libraryManager.RootFolder
                                        .RecursiveChildren
                                        .OfType<MusicAlbum>()
                                        .Where(i => i.HasArtist(item.Name))
                                        .ToList();

            var musicArtists = albums
                .Select(i => i.Parent)
                .OfType<MusicArtist>()
                .ToList();

            var options = GetRefreshOptions(request);

            var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new Progress<double>(), cancellationToken, options, true));

            await Task.WhenAll(musicArtistRefreshTasks).ConfigureAwait(false);

            try
            {
                await item.RefreshMetadata(options, CancellationToken.None).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.ErrorException("Error refreshing library", ex);
            }
        }
        public void Post(RefreshArtist request)
        {
            var task = RefreshArtist(request);

            Task.WaitAll(task);
        }
Example #5
0
        public void Post(RefreshArtist request)
        {
            var task = RefreshArtist(request);

            Task.WaitAll(task);
        }
        private async Task RefreshArtist(RefreshArtist request)
        {
            var item = await GetArtist(request.Name, _libraryManager).ConfigureAwait(false);

            try
            {
                await item.RefreshMetadata(CancellationToken.None, forceRefresh: request.Forced).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.ErrorException("Error refreshing library", ex);
            }
        }