public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { // Fetch the info for a particular recording String result; if (arguments != null) { try { int index = Int32.Parse(arguments[0]); bool withRTSPurl = false; if (arguments.Length >= 2) { withRTSPurl = bool.Parse(arguments[1]); } result = TVServerConnection.getRecordingInfo(index, withRTSPurl); Console.WriteLine(getCommandToHandle() + ":" + index + " " + result); writer.write(result); } catch { Console.WriteLine(getCommandToHandle() + ": failed"); writer.write(""); } } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":RecordingID[|withRTSPurl=False]"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { List <string> groups; if ((arguments != null) && (arguments[0].Length > 0)) { //we want to list all channels in group arg[0] groups = new List <string>(arguments); } else { groups = new List <string>(); } List <string> tvchannels = TVServerConnection.GetTVChannels(groups); if (tvchannels != null) { foreach (string channel in tvchannels) { Console.WriteLine(channel); } writer.writeList(tvchannels); } else { getConnection().WriteLine("[ERROR]: No TV channels found"); } }
/* * No arguments needed */ public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { bool result = TVServerConnection.IsRecording(); Console.WriteLine("IsRecording result: " + result.ToString()); writer.write(result.ToString()); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { // we want to list all recorded TV shows List <string> results = new List <string>(); List <RecordedInfo> recorded = TVServerConnection.getRecordedTV(); foreach (RecordedInfo r in recorded) { Int32 runningTime = Convert.ToInt32((r.endTime.Ticks - r.startTime.Ticks) / 10000000); string streamURL = TVServerConnection.getRecordingURL(Convert.ToInt32(r.ID)); string recitem = writer.makeItem( r.ID.ToString(), r.title.Replace(";", ""), r.description.Replace(";", ""), r.genre, r.played.ToString(), r.startTime.ToString(), r.endTime.ToString(), r.filename, r.channelName.Replace(";", ""), runningTime.ToString(), streamURL); results.Add(recitem); Console.WriteLine("Recorded: " + recitem); } writer.writeList(results); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { String result; if (arguments != null) { try { int index = Int32.Parse(arguments[0]); bool useUriEncoding = false; if (arguments.Length >= 2) { useUriEncoding = bool.Parse(arguments[1]); } result = TVServerConnection.GetScheduleInfo(index); Console.WriteLine("GetScheduleInfo:" + index + " " + result); writer.write(result, useUriEncoding); } catch { Console.WriteLine("GetScheduleInfo: failed"); writer.write(""); } } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":ScheduleID"); } }
/* * Expect arguments: ChannelID */ public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { if (arguments == null || arguments.Length < 1) { getConnection().WriteLine("[ERROR]: Usage: " + getCommandToHandle() + ":ChannelId[|ResolveIPs=False][|StopTimeshift=True]"); return; } try { int chanId = int.Parse(arguments[0]); bool resolveToIP = true; bool stoptimeshift = true; string originalURL = ""; string result; string timeShiftFileName = ""; Int64 timeShiftBufPos = 0; long timeShiftBufNr = 0; if (arguments.Length >= 2) { resolveToIP = Boolean.Parse(arguments[1]); if (arguments.Length >= 3) { stoptimeshift = Boolean.Parse(arguments[2]); } if (stoptimeshift) { TVServerConnection.StopTimeshift(ref me); } result = TVServerConnection.playChannel(chanId, resolveToIP, ref originalURL, ref me, ref timeShiftFileName, ref timeShiftBufPos, ref timeShiftBufNr); if (!result.StartsWith("[ERROR]")) { if (resolveToIP == true) { result += "|" + originalURL; } else { result += "|"; } result += "|" + timeShiftFileName + "|" + me.CardId.ToString() + "|" + timeShiftBufPos.ToString() + "|" + timeShiftBufNr.ToString(); } writer.write(result); } else { //backward compatibility TVServerConnection.StopTimeshift(ref me); result = TVServerConnection.playChannel(chanId, resolveToIP, ref originalURL, ref me, ref timeShiftFileName, ref timeShiftBufPos, ref timeShiftBufNr); writer.write(result); } } catch { getConnection().WriteLine("[ERROR]: Usage: " + getCommandToHandle() + ":ChannelId[|ResolveIPs][|StopTimeshift]"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { if ((arguments != null) && (arguments.Length == 2)) { try { string strChannelName = arguments[0]; Boolean bIsRadio = Boolean.Parse(arguments[1]); string strThumbName = "False"; Boolean bFound = false; string strThumbPath = TVServerConnection.GetLogoPath(bIsRadio); string strThumbBaseName = ToThumbFileName(strChannelName); foreach (string strExt in strThumbExt) { strThumbName = strThumbBaseName + strExt; if (File.Exists(strThumbPath + strThumbName)) { bFound = true; break; } } if (!bFound) { writer.write("0|False"); } else { Byte[] thumbData = File.ReadAllBytes(strThumbPath + strThumbName); Int32 fileLength = thumbData.Length; Int32 thumbNameLength = strThumbName.Length; Byte[] utf8ThumbName = System.Text.Encoding.UTF8.GetBytes(strThumbName); Byte[] thumbNameLengthBytes = BitConverter.GetBytes(System.Net.IPAddress.HostToNetworkOrder(utf8ThumbName.Length)); Byte[] fileLengthBytes = BitConverter.GetBytes(System.Net.IPAddress.HostToNetworkOrder(fileLength)); Byte[] strThumbInfo = { 0x31, 0x7C }; // ASCII: "1|" writer.writeBytes(strThumbInfo); writer.writeBytes(thumbNameLengthBytes); writer.writeBytes(utf8ThumbName); writer.writeBytes(fileLengthBytes); writer.writeBytes(thumbData); Byte[] strEnd = { 0x7C, 0x45, 0x4E, 0x44 }; // ASCII: "|END" writer.writeBytes(strEnd); } } catch { writer.write("0|Error"); } } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":ChannelName|IsRadio"); } }
/* * No arguments needed */ public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { bool result = TVServerConnection.StopTimeshift(ref me); Console.WriteLine("StopTimeshift result: " + result.ToString()); writer.write(result.ToString()); }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { int cardID = -1; List <string> results = new List <string>(); try { if (arguments != null) { cardID = Int32.Parse(arguments[0]); } else { cardID = me.CardId; } TVServerController server = TVServerConnection.GetServerInterface(); int level = server.GetSignalLevel(cardID); int quality = server.GetSignalQuality(cardID); writer.write(level.ToString() + "|" + quality.ToString()); } catch { Console.WriteLine(getCommandToHandle() + ": failed"); writer.write(""); } //getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + "[:cardID]"); }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { // we want to list all recordings String result; if (arguments != null) { try { int index = Int32.Parse(arguments[0]); result = TVServerConnection.GetScheduleInfo(index); Console.WriteLine("GetScheduleInfo:" + index + " " + result); writer.write(result); } catch { Console.WriteLine("GetScheduleInfo: failed"); writer.write(""); } } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":ScheduleID"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { // we want to list all recordings List <string> results = new List <string>(); results = TVServerConnection.GetSchedules(); writer.writeList(results); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { string VersionNr = "1.0.0"; // Fetch the MediaPortal TVServer version VersionNr = TVServerConnection.GetVersion(); writer.write(VersionNr); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { // we want to list all channels in group arg[0] // String group = arguments[0]; int count = 0; count = TVServerConnection.getScheduleCount(); Console.WriteLine("GetScheduleCount: " + count); writer.write(count.ToString()); }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { // this needs no arguments, and will just list all the tvgroups List <String> groups = TVServerConnection.GetRadioGroups(); foreach (String group in groups) { Console.WriteLine("RADIOGROUP : " + group); } writer.writeList(groups); }
/* * 1 optional argument: id */ public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { int schedId = -1; if ((arguments != null) && (arguments.Length == 1)) { schedId = int.Parse(arguments[0]); } bool result = TVServerConnection.StopRecording(schedId); Console.WriteLine("StopRecording result : " + result.ToString()); writer.write(result.ToString()); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { if (arguments == null) { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":RecordingId"); return; } int recId = int.Parse(arguments[0]); bool result = TVServerConnection.DeleteRecordedTV(recId); Console.WriteLine("DeleteRecordedTV result : " + result.ToString()); writer.write(result.ToString()); }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { // we want to list all recordings List <string> results = new List <string>(); bool resolveToIP = true; string originalURL = ""; if (arguments != null && arguments.Length == 1) { resolveToIP = Boolean.Parse(arguments[0]); } results = TVServerConnection.GetRecordings(resolveToIP, ref originalURL); writer.writeList(results); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { if ((arguments != null) && (arguments.Length == 1)) { int recindex = int.Parse(arguments[0]); int result = TVServerConnection.GetRecordingStopTime(recindex); Console.WriteLine("GetRecordingStopTime result : " + result.ToString()); writer.write(result.ToString()); } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":RecordingIndex"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { // we want to list all channels in group arg[0] if ((arguments != null) && (arguments.Length == 2)) { int recindex = int.Parse(arguments[0]); int count = int.Parse(arguments[1]); bool result = TVServerConnection.SetRecordingTimesWatched(recindex, count); Console.WriteLine("SetRecordingTimesWatched result : " + result.ToString()); writer.write(result.ToString()); } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":RecordingIndex|timesWatched"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { // we want to list all channels in group arg[0] if ((arguments != null) && (arguments.Length == 2)) { int recindex = int.Parse(arguments[0]); String name = arguments[1]; bool result = TVServerConnection.UpdateRecording(recindex, name); Console.WriteLine("UpdateRecording result : " + result.ToString()); writer.write(result.ToString()); } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":RecordingIndex|NewName"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { String group; int count = 0; if (arguments != null) { //we want to list all channels in group arg[0] group = arguments[0]; } else { group = ""; } count = TVServerConnection.getChannelCount(group); Console.WriteLine("GetChannelCount: " + count); writer.write(count.ToString()); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { // we want to list all channels in group arg[0] if ((arguments != null) && (arguments.Length == 1)) { try { String name = arguments[0]; me = TVServerConnection.RequestUser(name); writer.write("True"); } catch { writer.write("[ERROR]"); } } else { getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + ":Name"); } }
/* * No arguments needed */ public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { string rtspUrl = TVServerConnection.getTimeshiftUrl(ref me); bool result = true; if (String.IsNullOrEmpty(rtspUrl)) { result = false; rtspUrl = ""; } // results = isShifting;url;chanInfo as in ListChannels // chanInfo must be the same as the listchannel.. ChannelInfo c = new ChannelInfo(); if (result) { c = TVServerConnection.getTimeshiftInfo(ref me); } writer.write(writer.makeItemSmart(result.ToString(), rtspUrl, c)); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { List <string> groups; if ((arguments != null) && (arguments[0].Length > 0)) { //we want to list all channels in group arg[0] groups = new List <string>(arguments); } else { groups = new List <string>(); } List <string> radiochannels = TVServerConnection.GetRadioChannels(groups); foreach (string channel in radiochannels) { Console.WriteLine(channel); } writer.writeList(radiochannels); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { try { bool seriesSupport = false; if (arguments != null && arguments.Length >= 1) { if (arguments[0].Length > 0) { seriesSupport = Boolean.Parse(arguments[0]); } } // we want to list all scheduled recordings List <string> results = new List <string>(); results = TVServerConnection.GetSchedules(seriesSupport); writer.writeList(results); } catch { getConnection().WriteLine("[ERROR]: Usage: " + getCommandToHandle() + ":[seriesSupport=False]"); } }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { bool timeshiftingUsers = false; List <string> results = new List <string>(); if (arguments != null && arguments.Length == 1) { if (arguments[0] == "TimeshiftingUsers") { timeshiftingUsers = true; } } if (timeshiftingUsers) { results = TVServerConnection.getTimeshiftingUserNames(); } else { results.Add(me.Name); } writer.writeList(results); }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { int cardID = -1; List <string> results = new List <string>(); try { if (arguments != null) { cardID = Int32.Parse(arguments[0]); } TVServerController server = TVServerConnection.GetServerInterface(); results = server.GetCardSettings(cardID); writer.writeList(results); } catch { Console.WriteLine(getCommandToHandle() + ": failed"); writer.write(""); } //getConnection().WriteLine("[ERROR]: Expected format: " + getCommandToHandle() + "[:cardID]"); }
/* * No arguments needed */ public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { TimeShiftURLs timeShiftURLs = TVServerConnection.getTimeshiftURLs(ref me); bool result = true; if (timeShiftURLs == null || String.IsNullOrEmpty(timeShiftURLs.RTSPUrl) || String.IsNullOrEmpty(timeShiftURLs.TimeShiftFileName)) { timeShiftURLs = new TimeShiftURLs { RTSPUrl = "", TimeShiftFileName = "" }; result = false; } // results = isShifting;url;chanInfo as in ListChannels // chanInfo must be the same as the listchannel.. ChannelInfo c = new ChannelInfo(); if (result) { c = TVServerConnection.getTimeshiftInfo(ref me); } writer.write(writer.makeItemSmart(result.ToString(), timeShiftURLs.RTSPUrl, timeShiftURLs.TimeShiftFileName, c)); }
public override void handleCommand(string command, string[] arguments, ref TvControl.User me) { String group; if (arguments != null) { //we want to list all channels in group arg[0] group = arguments[0]; } else { group = ""; } Console.WriteLine("Radio channels from group:" + group); List <string> radiochannels = TVServerConnection.GetRadioChannels(group); foreach (string channel in radiochannels) { Console.WriteLine(channel); } writer.writeList(radiochannels); }
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me) { String group; List <string> results = new List <string>(); if (arguments != null) { //we want to list all channels in group arg[0] group = arguments[0]; } else { group = ""; } List <ChannelInfo> channels = TVServerConnection.getChannels(group); foreach (ChannelInfo c in channels) { results.Add(writer.makeItemSmart(c)); Console.WriteLine("CHANNEL : " + c.channelID + ";" + c.name + ";" + c.isScrambled.ToString()); } writer.writeList(results); }