public void Add(IProgramInfo programInfo) { var list = (List <ProgramInfoModel>) this.ProgramInfoModels; list.Add(this.CreateProgramInfoModel(programInfo)); this.RaisePropertyChanged(nameof(this.ProgramInfoModels)); }
private UPnPError OnGetNowNextProgramForGroup(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo; if (programInfo == null) { return(new UPnPError(500, "IProgramInfo service not available")); } int channelGroupId = (int)inParams[0]; IList <IProgram> programs = new List <IProgram>(); IDictionary <int, IProgram[]> nowNextPrograms; // Flatten to simple list for UPnP transfer if (programInfo.GetNowAndNextForChannelGroup(new ChannelGroup { ChannelGroupId = channelGroupId }, out nowNextPrograms)) { foreach (KeyValuePair <int, IProgram[]> nowNextProgram in nowNextPrograms) { foreach (var program in nowNextProgram.Value) { if (program != null) { programs.Add(program); } } } } outParams = new List <object> { true, programs }; return(null); }
private static ProgramBank ReadPrograms <T>(EndianBinaryReader reader, int numPRGISlots) where T : IProgramInfo { long chunkOffset = FindChunk(reader, "prgi"); if (chunkOffset == -1) { return(null); } else { chunkOffset += 0x10; var programInfos = new IProgramInfo[numPRGISlots]; for (int i = 0; i < programInfos.Length; i++) { ushort offset = reader.ReadUInt16(chunkOffset + (2 * i)); if (offset != 0) { programInfos[i] = reader.ReadObject <T>(offset + chunkOffset); } } return(new ProgramBank { ProgramInfos = programInfos, KeyGroups = ReadKeyGroups(reader) }); } }
public void PromoteStartup(IProgramInfo programInfo) { this.DelayedProgramInfosModel.Remove(programInfo); var programLogic = this.CreateProgramLogic(programInfo); programLogic.Undo(); this.StartupProgramInfosModel.Add(programInfo); }
public void Remove(IProgramInfo programInfo) { var list = (List <ProgramInfoModel>) this.ProgramInfoModels; Func <ProgramInfoModel, bool> condition = pim => pim.ProgramInfo == programInfo; var programInfoModel = this.ProgramInfoModels.Single(condition); list.Remove(programInfoModel); this.RaisePropertyChanged(nameof(this.ProgramInfoModels)); }
public SerializableProgramInfo(IProgramInfo copyFrom) { var fileOrigin = copyFrom.Origin as IFileOrigin; var registryOrigin = copyFrom.Origin as IRegistryOrigin; if (fileOrigin != null) { this.Origin = new SerializableFileOrigin(fileOrigin); } else if (registryOrigin != null) { this.Origin = new SerializableRegistryOrigin(registryOrigin); } this.StartInfo = new SerializableStartInfo(copyFrom.StartInfo); }
private static void GetOnDemandDates(HtmlDocument document, IProgramInfo program) { try { var onDemand = document.DocumentNode.Descendants().Where(node => node.GetAttributeValue("class", string.Empty).Equals("on-demand")).Single(); var timeNodes = onDemand.Descendants().Where(node => node.Name == "time").ToList(); foreach (var timeNode in timeNodes) { timeNode.Descendants().Where(node => node.Name == "span").First().Remove(); } program.OnDemandStarts = Convert.ToDateTime(timeNodes[0].InnerText); program.OnDemandEnds = Convert.ToDateTime(timeNodes[1].InnerText); } catch { } }
private UPnPError OnRemoveSchedule(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo; IScheduleControl scheduleControl = ServiceRegistration.Get <ITvProvider>() as IScheduleControl; if (programInfo == null || scheduleControl == null) { return(new UPnPError(500, "IProgramInfo or IScheduleControl service not available")); } ISchedule schedule = (ISchedule)inParams[0]; bool result = scheduleControl.RemoveSchedule(schedule); outParams = new List <object> { result }; return(null); }
private void ProgramInfoProvider_ProgramInfoReceived(object sender, IProgramInfo e) { var metadata = new Metadata { Title = e.Title, }; RaiseMetadataUpdated(metadata); _vposBaseAt = e.VposBaseAt; var newRooms = Tools.Distinct(_rooms, e.Rooms.Cast <IXmlWsRoomInfo>().ToList()); if (newRooms.Count > 0) { _mainRoomThreadId = Math.Min(int.Parse(_mainRoomThreadId), newRooms.Select(r => int.Parse(r.ThreadId)).Min()).ToString(); _rooms.AddRange(newRooms); _chatProvider.Add(newRooms); } }
private UPnPError OnCreateSchedule(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo; IScheduleControl scheduleControl = ServiceRegistration.Get <ITvProvider>() as IScheduleControl; if (programInfo == null || scheduleControl == null) { return(new UPnPError(500, "IProgramInfo or IScheduleControl service not available")); } int programId = (int)inParams[0]; IProgram program; bool result = programInfo.GetProgram(programId, out program) && scheduleControl.CreateSchedule(program); outParams = new List <object> { result }; return(null); }
private UPnPError OnGetRecordingStatus(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo; IScheduleControl scheduleControl = ServiceRegistration.Get <ITvProvider>() as IScheduleControl; if (programInfo == null || scheduleControl == null) { return(new UPnPError(500, "IProgramInfo or IScheduleControl service not available")); } int programId = (int)inParams[0]; IProgram program; RecordingStatus recordingStatus = RecordingStatus.None; bool result = programInfo.GetProgram(programId, out program) && scheduleControl.GetRecordingStatus(program, out recordingStatus); outParams = new List <object> { result, recordingStatus.ToString() }; return(null); }
private UPnPError OnGetProgramsByTitle(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo; if (programInfo == null) { return(new UPnPError(500, "IProgramInfo service not available")); } string title = (string)inParams[0]; DateTime timeFrom = (DateTime)inParams[1]; DateTime timeTo = (DateTime)inParams[2]; IList <IProgram> programs; bool result = programInfo.GetPrograms(title, timeFrom, timeTo, out programs); outParams = new List <object> { result, programs }; return(null); }
private UPnPError OnGetNowNextProgram(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context) { outParams = new List <object>(); IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo; if (programInfo == null) { return(new UPnPError(500, "IProgramInfo service not available")); } int channelId = (int)inParams[0]; IProgram programNow; IProgram programNext; bool result = programInfo.GetNowNextProgram(new Channel { ChannelId = channelId }, out programNow, out programNext); outParams = new List <object> { result, programNow, programNext }; return(null); }
private string GetSearchParamsString(IProgramInfo program) { string result = $"?apikey={omdbKey}&t="; var titleWords = program.Title.Split(' '); for (int index = 0; index < titleWords.Length; index++) { result += titleWords[index]; if (index + 1 < titleWords.Length) { result += "+"; } } if (program.Year > -1) { result = $"{result}&&y={program.Year}"; } return(result); }
public async Task <Program> GetProgramDetails(IProgramInfo program) { var searchString = GetSearchParamsString(program); try { var response = await _httpClient.GetAsync(searchString); var deserializedProgram = await response.Content.ReadAsAsync <Program>(); deserializedProgram.OnDemandStarts = program.OnDemandStarts; deserializedProgram.OnDemandEnds = program.OnDemandEnds; return(deserializedProgram); } catch (Exception) { return(new Program() { Title = program.Title, Year = program.Year }); } }
public FileProgramLogic(IProgramInfo programInfo) : base(programInfo) { }
private IProgramLogic CreateProgramLogic(IProgramInfo programInfo) { var programLogic = this._dependencies.ProgramLogicFactory.Get(programInfo); return(programLogic); }
public ProgramInfoModel(IProgramInfo programInfo) { this.ProgramInfo = programInfo; }
public RegistryProgramLogic(IProgramInfo programInfo) : base(programInfo) { }
protected AbstractProgramLogic(IProgramInfo programInfo) { this._programInfo = programInfo; }
private ProgramInfoModel CreateProgramInfoModel(IProgramInfo programInfo) { return(new ProgramInfoModel(programInfo)); }
public ProxyProgramLogic(IProgramInfo programInfo) { this._programInfo = programInfo; this._serializationManager = new ProxySerializationManager(); }