示例#1
0
        public async Task <IReadOnlyCollection <IMovieIdentifier> > GetMovieIdentifiersAsync(
            ILibraryIdentifier libraryIdentifier)
        {
            await SemSlim.WaitAsync();

            try
            {
                Logger.Log(Severity.Info, "Querying existing movies.");
                return(await Repository.GetMovieIdentifiersAsync(Client, libraryIdentifier.Id));
            }
            catch (Exception ex)
            {
                LogException(ex, "Failed to query existing movies:");
                return(null);
            }
            finally
            {
                SemSlim.Release();
            }
        }
示例#2
0
        private static async Task <IReadOnlyCollection <IMovieIdentifier> > GetMovieIdentifiersAsync(IEmbyService embyService,
                                                                                                     ISpinWheelService spinWheelService,
                                                                                                     ILibraryIdentifier libraryIdentifier)
        {
            var cts = new CancellationTokenSource();

            try
            {
                await spinWheelService.StartSpinWheelAsync(cts.Token);

                return(await embyService.GetMovieIdentifiersAsync(libraryIdentifier));
            }
            finally
            {
                spinWheelService.StopSpinWheel(cts);
                cts.Dispose();
            }
        }