From: <sam...@us...> - 2006-06-18 15:07:33
|
Revision: 15 Author: samuel337 Date: 2006-06-18 08:07:25 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/mp-webinterface/?rev=15&view=rev Log Message: ----------- moved some code groups around; no code changes Modified Paths: -------------- trunk/source/ECP2WebService/App_Code/Service.cs Modified: trunk/source/ECP2WebService/App_Code/Service.cs =================================================================== --- trunk/source/ECP2WebService/App_Code/Service.cs 2006-06-18 15:00:12 UTC (rev 14) +++ trunk/source/ECP2WebService/App_Code/Service.cs 2006-06-18 15:07:25 UTC (rev 15) @@ -86,83 +86,6 @@ } } - #region scheduled recording commands - [WebMethod(Description="This command tells MediaPortal to refresh its recordings list.")] - public bool RefreshRecordingsInMP() - { - return GetEMPH().RefreshRecordings(); - } - - [WebMethod(Description = "This command adds a recording to MP's recording list. No recordings refresh command is required after this action. Possible values for recType parameter are: Daily, EveryTimeOnEveryChannel, EveryTimeOnThisChannel, Once, WeekDays, WeekEnds, Weekly. Possible values for keepMethod parameters are: Always, UntilSpaceNeeded, UntilWatched.")] - public bool AddRecording(string title, string channelName, DateTime startDateTime, DateTime endDateTime, string recType, string keepMethod) - { - MediaPortal.TV.Database.TVRecording rec = new MediaPortal.TV.Database.TVRecording(); - rec.Title = title; - rec.Channel = channelName; - rec.Start = DateToLong(startDateTime); - rec.End = DateToLong(endDateTime); - rec.RecType = Enum.Parse(GetType(MediaPortal.TV.Database.TVRecording.RecordingType), recType, true); - rec.KeepRecordingMethod = Enum.Parse(GetType(MediaPortal.TV.Database.TVRecorded.KeepMethod), keepMethod, true); - - return GetEMPH().AddRecording(ref rec); - } - - [WebMethod(Description = "This command tells MediaPortal to delete a particular recording by ID.")] - public bool DeleteRecordingByID(int recordingID) - { - return GetEMPH().DelRecording(recordingID); - } - - [WebMethod(Description = "This command tells MediaPortal to delete a particular recording by starting time and channel name.")] - public bool DeleteRecordingByStartTimeAndChannelName(DateTime startDateTime, string channelName) - { - return GetEMPH().DelRecording(startDateTime, channelName); - } - - [WebMethod(Description = "This command tells MediaPortal to delete a particular recording by starting time and channel number.")] - public bool DeleteRecordingByStartTimeAndChannelLCN(DateTime startDateTime, int channelLCN) - { - return GetEMPH().DelRecording(startDateTime, channelLCN); - } - - [WebMethod(Description = "This command returns the list of TV recordings in XML format.")] - public string GetRecordings() - { - List<MediaPortal.TV.Database.TVRecording> recList; - recList = GetEMPH().GetRecordings(); - - System.IO.MemoryStream xwMem = new System.IO.MemoryStream(); - System.Xml.XmlWriter xw = System.Xml.XmlWriter.Create(xwMem, GetXMLDocWriterSettings()); - System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(MediaPortal.TV.Database.TVRecording)); - MediaPortal.TV.Database.TVRecording rec; - - try - { - xw.WriteStartDocument(); - xw.WriteStartElement("MPData"); - xw.WriteStartElement("TVRecordings"); - - for (int i = 0; i <= recList.Count - 1; i++) - { - rec = (MediaPortal.TV.Database.TVRecording)recList[i]; - xs.Serialize(xw, rec); - } - - xw.WriteEndElement(); - xw.WriteEndElement(); - xw.WriteEndDocument(); - - xw.Flush(); - } - catch (Exception ex) - { - return ex.ToString(); - } - - return System.Text.Encoding.UTF8.GetString(xwMem.ToArray()); - } - #endregion - #region private methods private long DateToLong(DateTime date) { @@ -387,6 +310,83 @@ } #endregion + #region scheduled recording commands + [WebMethod(Description = "This command tells MediaPortal to refresh its recordings list.")] + public bool RefreshRecordingsInMP() + { + return GetEMPH().RefreshRecordings(); + } + + [WebMethod(Description = "This command adds a recording to MP's recording list. No recordings refresh command is required after this action. Possible values for recType parameter are: Daily, EveryTimeOnEveryChannel, EveryTimeOnThisChannel, Once, WeekDays, WeekEnds, Weekly. Possible values for keepMethod parameters are: Always, UntilSpaceNeeded, UntilWatched.")] + public bool AddRecording(string title, string channelName, DateTime startDateTime, DateTime endDateTime, string recType, string keepMethod) + { + MediaPortal.TV.Database.TVRecording rec = new MediaPortal.TV.Database.TVRecording(); + rec.Title = title; + rec.Channel = channelName; + rec.Start = DateToLong(startDateTime); + rec.End = DateToLong(endDateTime); + rec.RecType = Enum.Parse(GetType(MediaPortal.TV.Database.TVRecording.RecordingType), recType, true); + rec.KeepRecordingMethod = Enum.Parse(GetType(MediaPortal.TV.Database.TVRecorded.KeepMethod), keepMethod, true); + + return GetEMPH().AddRecording(ref rec); + } + + [WebMethod(Description = "This command tells MediaPortal to delete a particular recording by ID.")] + public bool DeleteRecordingByID(int recordingID) + { + return GetEMPH().DelRecording(recordingID); + } + + [WebMethod(Description = "This command tells MediaPortal to delete a particular recording by starting time and channel name.")] + public bool DeleteRecordingByStartTimeAndChannelName(DateTime startDateTime, string channelName) + { + return GetEMPH().DelRecording(startDateTime, channelName); + } + + [WebMethod(Description = "This command tells MediaPortal to delete a particular recording by starting time and channel number.")] + public bool DeleteRecordingByStartTimeAndChannelLCN(DateTime startDateTime, int channelLCN) + { + return GetEMPH().DelRecording(startDateTime, channelLCN); + } + + [WebMethod(Description = "This command returns the list of TV recordings in XML format.")] + public string GetRecordings() + { + List<MediaPortal.TV.Database.TVRecording> recList; + recList = GetEMPH().GetRecordings(); + + System.IO.MemoryStream xwMem = new System.IO.MemoryStream(); + System.Xml.XmlWriter xw = System.Xml.XmlWriter.Create(xwMem, GetXMLDocWriterSettings()); + System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(MediaPortal.TV.Database.TVRecording)); + MediaPortal.TV.Database.TVRecording rec; + + try + { + xw.WriteStartDocument(); + xw.WriteStartElement("MPData"); + xw.WriteStartElement("TVRecordings"); + + for (int i = 0; i <= recList.Count - 1; i++) + { + rec = (MediaPortal.TV.Database.TVRecording)recList[i]; + xs.Serialize(xw, rec); + } + + xw.WriteEndElement(); + xw.WriteEndElement(); + xw.WriteEndDocument(); + + xw.Flush(); + } + catch (Exception ex) + { + return ex.ToString(); + } + + return System.Text.Encoding.UTF8.GetString(xwMem.ToArray()); + } + #endregion + #region TV Channel/Program commands [WebMethod(Description="This command tells MediaPortal to re-import the XMLTV data file.")] public bool ImportXMLTVGuide() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |