Skip to content

Commit

Permalink
Fixed faulty cue/edl file parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
datasone committed Sep 28, 2021
1 parent edce8da commit f696a1b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions MPVMediaControl/PipeServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ private static string FromHexString(string hexString)
return System.Text.Encoding.UTF8.GetString(bytes); // returns: "Hello world" for "48656C6C6F20776F726C64"
}

private static void ParseFile(MediaController controller, Dictionary<string, string> parameters)
private static void ParseFile(MediaController controller, Dictionary<string, string> parameters, bool nonHexPath = false)
{
var title = FromHexString(parameters["title"]);
var artist = FromHexString(parameters["artist"]);
var path = FromHexString(parameters["path"]);
var path = nonHexPath ? parameters["path"] : FromHexString(parameters["path"]);
var shotPath = FromHexString(parameters["shot_path"]);

// Processing metadata may take some time, so only checking path isn't enough.
Expand All @@ -155,12 +155,12 @@ private static void ParseFile(MediaController controller, Dictionary<string, str
if (path.Split('.').Last() == "edl")
{
parameters["path"] = ParseEDL(path);
ParseFile(controller, parameters);
ParseFile(controller, parameters, true);
}
else if (path.Split('.').Last() == "cue")
{
parameters["path"] = ParseCUE(path);
ParseFile(controller, parameters);
ParseFile(controller, parameters, true);
}
else
{
Expand Down Expand Up @@ -209,7 +209,7 @@ private static void ParseCommand(string command)
switch (commandName)
{
case "setFile":
ParseFile(controller, parameters);
ParseFile(controller, parameters, false);
break;

case "setState":
Expand Down

0 comments on commit f696a1b

Please sign in to comment.