public async void RefreshConfigData(CancellationToken cancellationToken) { var config = Plugin.Instance.Configuration; if (config.TunerHostsConfiguration != null) { _tunerServer = TunerHostFactory.CreateTunerHosts(config.TunerHostsConfiguration, _logger, _jsonSerializer, _httpClient); for (var i = 0; i < _tunerServer.Count(); i++) { await _tunerServer[i].GetDeviceInfo(cancellationToken); config.TunerHostsConfiguration[i].ServerId = _tunerServer[i].HostId; } } if (FirstRun) { seriesTimers = GetSeriesTimerData(DataPath, _xmlSerializer); InitializeTimer(GetTimerData(DataPath, _xmlSerializer)); } FirstRun = false; _tvGuide = new EPGProvider.SchedulesDirect(config.username, config.hashPassword, config.lineup, _logger, _jsonSerializer, _httpClient); config.avaliableLineups = await _tvGuide.getLineups(cancellationToken); if (_tvGuide.badPassword) { config.hashPassword = ""; } config.headends = await _tvGuide.getHeadends(config.zipCode, cancellationToken); Plugin.Instance.SaveConfiguration(); }
public SchedulesDirect(ILogger logger, IJsonSerializer jsonSerializer, IHttpClient httpClient) { _logger = logger; _jsonSerializer = jsonSerializer; _httpClient = httpClient; _apiUrl = "https://json.schedulesdirect.org/20141201"; Current = this; }
public LiveTvService(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogManager logManager, IXmlSerializer xmlSerializer, IApplicationPaths appPaths) { _logger = logManager.GetLogger(Name); _httpClient = httpClient; _jsonSerializer = jsonSerializer; _streams = new Dictionary<string, MediaSourceInfo>(); _appPaths = appPaths; _logger.Info("Directory is: " + DataPath); _tvGuide = new EPGProvider.SchedulesDirect(_logger, _jsonSerializer, _httpClient); _recordingProvider = new ItemDataProvider<RecordingInfo>(xmlSerializer, _jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)); _seriesTimerProvider = new SeriesTimerManager(xmlSerializer, _jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); _timerProvider = new TimerManager(xmlSerializer, _jsonSerializer, _logger, Path.Combine(DataPath, "timers")); _timerProvider.TimerFired += _timerProvider_TimerFired; Initialize(); }
public LiveTvService(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogManager logManager, IXmlSerializer xmlSerializer, IApplicationPaths appPaths) { _logger = logManager.GetLogger(Name); _httpClient = httpClient; _jsonSerializer = jsonSerializer; _streams = new Dictionary <string, MediaSourceInfo>(); _appPaths = appPaths; _logger.Info("Directory is: " + DataPath); _tvGuide = new EPGProvider.SchedulesDirect(_logger, _jsonSerializer, _httpClient); _recordingProvider = new ItemDataProvider <RecordingInfo>(xmlSerializer, _jsonSerializer, _logger, Path.Combine(DataPath, "recordings"), (r1, r2) => string.Equals(r1.Id, r2.Id, StringComparison.OrdinalIgnoreCase)); _seriesTimerProvider = new SeriesTimerManager(xmlSerializer, _jsonSerializer, _logger, Path.Combine(DataPath, "seriestimers")); _timerProvider = new TimerManager(xmlSerializer, _jsonSerializer, _logger, Path.Combine(DataPath, "timers")); _timerProvider.TimerFired += _timerProvider_TimerFired; Initialize(); }