Exemple #1
0
        public async Task Execute(CancellationToken cancellationToken, IProgress <double> progress)
        {
            var settings = _configurationRepository.GetSingle();

            if (!settings.WizardFinished)
            {
                Log.Warning("Movie sync task not running because wizard is not finished yet!");
                return;
            }
            progress.Report(15);

            _embyClient.SetAddressAndUrl(settings.EmbyServerAddress, settings.AccessToken);
            var systemInfoReponse = await _embyClient.GetServerInfoAsync();

            progress.Report(35);
            var pluginsResponse = await _embyClient.GetInstalledPluginsAsync();

            progress.Report(55);
            var drives = await _embyClient.GetLocalDrivesAsync();

            progress.Report(75);

            var systemInfo  = Mapper.Map <ServerInfo>(systemInfoReponse);
            var localDrives = Mapper.Map <IList <Drives> >(drives);

            _embyServerInfoRepository.UpdateOrAdd(systemInfo);
            progress.Report(85);
            _embyPluginRepository.RemoveAllAndInsertPluginRange(pluginsResponse);
            progress.Report(95);
            _embyDriveRepository.ClearAndInsertList(localDrives.ToList());
            progress.Report(100);
        }
Exemple #2
0
        public async void FireSmallSyncEmbyServerInfo()
        {
            var settings = _configurationRepository.GetSingle();

            _embyClient.SetAddressAndUrl(settings.EmbyServerAddress, settings.AccessToken);
            var systemInfoReponse = await _embyClient.GetServerInfoAsync();

            var pluginsResponse = await _embyClient.GetInstalledPluginsAsync();

            var drives = await _embyClient.GetLocalDrivesAsync();

            var systemInfo  = Mapper.Map <ServerInfo>(systemInfoReponse);
            var localDrives = Mapper.Map <IList <Drives> >(drives);

            _embyServerInfoRepository.UpdateOrAdd(systemInfo);
            _embyPluginRepository.RemoveAllAndInsertPluginRange(pluginsResponse);
            _embyDriveRepository.ClearAndInsertList(localDrives.ToList());
        }