public override WebFileInfo GetFileInfo() { if ((MediaType == WebMediaType.TV || MediaType == WebMediaType.Recording) && FileType == WebFileType.Logo) { if (_logos == null) { _logos = new ChannelLogos(); } // get display name int idChannel = MediaType == WebMediaType.TV ? Int32.Parse(Id) : Connections.TAS.GetRecordingById(Int32.Parse(Id)).ChannelId; var channel = Connections.TAS.GetChannelBasicById(idChannel); string location = _logos.FindLocation(channel.Title); if (location == null) { Log.Debug("Did not find tv logo for channel {0} with id {1}", channel.Title, idChannel); return(new WebFileInfo() { Exists = false }); } // great, return it return(new WebFileInfo(location)); } return(path != null ? new WebFileInfo(path) : base.GetFileInfo()); }
private void ScanForRequiredLogos() { ITVAccessService tas = TVAccessService.Instance; if (!tas.TestConnectionToTVService()) { return; } channelLogosRequired = tas.GetChannelsBasic() .Where(ch => logos.FindLocation(ch.Title) == null) .ToList(); }
private void Init() { // load list of channel logos that we don't have yet logos = new ChannelLogos(); ITVAccessService tas = TVAccessService.Instance; if (!tas.TestConnectionToTVService()) { return; } channelLogosRequired = tas.GetChannelsBasic() .Where(ch => logos.FindLocation(ch.Title) == null) .ToList(); // exit if we already got all logos if (channelLogosRequired.Count == 0) { Log.Trace("All channel logos already available, not downloading any..."); return; } // try downloading them on starting and exit if successful if (PerformCheck()) { return; } // setup timer backgroundTimer = new Timer() { AutoReset = true, Interval = 60 * 60 * 1000, }; backgroundTimer.Elapsed += new ElapsedEventHandler(TimerElapsed); backgroundTimer.Start(); }
public override WebFileInfo GetFileInfo() { if (fileInfoCache != null) { return(fileInfoCache); } if (path != null) { fileInfoCache = new WebFileInfo(path); return(fileInfoCache); } if ((MediaType == WebMediaType.TV || MediaType == WebMediaType.Recording || MediaType == WebMediaType.Radio) && FileType == WebFileType.Logo) { if (_logos == null) { _logos = new ChannelLogos(); } // get display name int idChannel = MediaType == WebMediaType.TV || MediaType == WebMediaType.Radio ? Int32.Parse(Id) : Connections.TAS.GetRecordingById(Int32.Parse(Id)).ChannelId; var channel = Connections.TAS.GetChannelBasicById(idChannel); string location = _logos.FindLocation(channel.Title); if (location == null) { Log.Debug("Did not find tv logo for channel {0} with id {1}", channel.Title, idChannel); fileInfoCache = new WebFileInfo() { Exists = false }; return(fileInfoCache); } // great, return it fileInfoCache = new WebFileInfo(location); return(fileInfoCache); } if (Offset < 0) { var artwork = Connections.MAS.GetArtwork(Provider, MediaType, Id); var preferedItem = artwork.Where(x => x.Type == FileType) .OrderByDescending(x => x.Rating) .Skip(-1 - Offset) .FirstOrDefault(); if (preferedItem == null) { Log.Debug("Requested prefered artwork item for provider={0} mediatype={1} filetype={2} id={3}, but no artwork found", Provider, MediaType, FileType, Id); fileInfoCache = new WebFileInfo() { Exists = false }; return(fileInfoCache); } fileInfoCache = Connections.MAS.GetFileInfo(Provider, MediaType, FileType, Id, preferedItem.Offset); return(fileInfoCache); } return(base.GetFileInfo()); }