Permalink
Browse files

Fixed: Use URL escaping for the GetRecordingInfo and GetScheduleInfo …

…commands to accept fields with enters inside

This fixes recording playback for in progress recordings when the description fields contains a multi-line string
1 parent 3456cde commit 5fc4776fca30228da8cd3a902a3d64753f97df18 @margro committed Jan 4, 2017
@@ -1,3 +1,7 @@
+1.15.0.137:
+- Fixed: Use URL escaping for the GetRecordingInfo and GetScheduleInfo commands to accept fields with enters inside
+ This fixes recording playback for in progress recordings when the description fields contains a multi-line string
+
1.15.0.136:
- Added: Support for detecting the recording type (TV, Radio, webstream)
- Fixed: Add additional exception handling around the GetRecordingURL() function
@@ -18,6 +18,7 @@ class DataWriter
private String listSeparator = ",";
private Converter<string, string> argumentEncoder = new Converter<string, string>(Uri.EscapeDataString);
private Converter<string, string> listEncoder = new Converter<string, string>(Uri.EscapeDataString);
+ private bool escapeData = true;
public DataWriter(NetworkStream stream)
{
@@ -37,6 +38,7 @@ public void setHumanEncoders()
//listSeparator = Environment.NewLine;
argumentEncoder = new Converter<string, string>(getSameString);
listEncoder = new Converter<string, string>(getSameString);
+ escapeData = false;
}
public void setArgumentSeparator(String argSep)
@@ -111,6 +113,14 @@ public void write(String line)
Console.WriteLine("Socket write: " + line + commandSeparator);
writer.Flush();
}
+ public void write(String line, bool escapeMe)
+ {
+ if (escapeData && escapeMe)
+ write(Uri.EscapeDataString(line));
+ else
+ write(line);
+ }
+
public void writeBytes(Byte[] bytes)
{
@@ -24,16 +24,21 @@ public override void handleCommand(string command, string[] arguments, ref TvCon
{
int index = Int32.Parse(arguments[0]);
bool withRTSPurl = false;
+ bool useUriEncoding = false;
if (arguments.Length >= 2)
{
withRTSPurl = bool.Parse(arguments[1]);
}
+ if (arguments.Length >= 3)
+ {
+ useUriEncoding = bool.Parse(arguments[2]);
+ }
result = TVServerConnection.getRecordingInfo(index, withRTSPurl);
Console.WriteLine(getCommandToHandle() + ":" + index + " " + result);
- writer.write(result);
+ writer.write(result, useUriEncoding);
}
catch
{
@@ -15,19 +15,24 @@ public GetScheduleInfo(ConnectionHandler connection)
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me)
{
- // we want to list all recordings
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);
+ writer.write(result, useUriEncoding);
}
catch
{
Oops, something went wrong.

0 comments on commit 5fc4776

Please sign in to comment.