update subtitle escaping

This commit is contained in:
Luke Pulverenti 2015-08-16 11:53:30 -04:00
parent f6dcef0cfd
commit 1f1f7642c3
8 changed files with 33 additions and 18 deletions

View File

@ -619,7 +619,7 @@ namespace MediaBrowser.Api.Playback
// TODO: Perhaps also use original_size=1920x800 ??
return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB",
subtitlePath.Replace('\\', '/').Replace(":/", "\\:/"),
MediaEncoder.EscapeSubtitleFilterPath(subtitlePath),
charsetParam,
seconds.ToString(UsCulture));
}
@ -627,7 +627,7 @@ namespace MediaBrowser.Api.Playback
var mediaPath = state.MediaPath ?? string.Empty;
return string.Format("subtitles='{0}:si={1}',setpts=PTS -{2}/TB",
mediaPath.Replace('\\', '/').Replace(":/", "\\:/"),
MediaEncoder.EscapeSubtitleFilterPath(mediaPath),
state.InternalSubtitleStreamOffset.ToString(UsCulture),
seconds.ToString(UsCulture));
}

View File

@ -116,5 +116,12 @@ namespace MediaBrowser.Controller.MediaEncoding
Task<string> EncodeVideo(EncodingJobOptions options,
IProgress<double> progress,
CancellationToken cancellationToken);
/// <summary>
/// Escapes the subtitle filter path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.String.</returns>
string EscapeSubtitleFilterPath(string path);
}
}

View File

@ -125,6 +125,12 @@ namespace MediaBrowser.Controller.Session
/// <value>The session controller.</value>
public ISessionController SessionController { get; set; }
/// <summary>
/// Gets or sets the application icon URL.
/// </summary>
/// <value>The application icon URL.</value>
public string AppIconUrl { get; set; }
/// <summary>
/// Gets or sets the supported commands.
/// </summary>

View File

@ -865,13 +865,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
// TODO: Perhaps also use original_size=1920x800 ??
return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB",
subtitlePath.Replace('\\', '/').Replace(":/", "\\:/"),
MediaEncoder.EscapeSubtitleFilterPath(subtitlePath),
charsetParam,
seconds.ToString(UsCulture));
}
return string.Format("subtitles='{0}:si={1}',setpts=PTS -{2}/TB",
state.MediaPath.Replace('\\', '/').Replace(":/", "\\:/"),
MediaEncoder.EscapeSubtitleFilterPath(state.MediaPath),
state.InternalSubtitleStreamOffset.ToString(UsCulture),
seconds.ToString(UsCulture));
}

View File

@ -765,6 +765,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
}
public string EscapeSubtitleFilterPath(string path)
{
return path.Replace('\\', '/').Replace(":/", "\\:/").Replace("'", "'\\\\\\'");
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>

View File

@ -100,6 +100,12 @@ namespace MediaBrowser.Model.Session
/// <value>The device id.</value>
public string DeviceId { get; set; }
/// <summary>
/// Gets or sets the application icon URL.
/// </summary>
/// <value>The application icon URL.</value>
public string AppIconUrl { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports remote control].
/// </summary>

View File

@ -161,6 +161,7 @@ namespace MediaBrowser.Server.Implementations.Session
if (capabilities != null)
{
info.AppIconUrl = capabilities.IconUrl;
ReportCapabilities(info, capabilities, false);
}
}
@ -1476,6 +1477,7 @@ namespace MediaBrowser.Server.Implementations.Session
NowPlayingItem = session.NowPlayingItem,
SupportsRemoteControl = session.SupportsMediaControl,
PlayState = session.PlayState,
AppIconUrl = session.AppIconUrl,
TranscodingInfo = session.NowPlayingItem == null ? null : session.TranscodingInfo
};

View File

@ -156,6 +156,9 @@
<Content Include="dashboard-ui\css\images\clients\chromecast.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\firefox.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\empty.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -565,12 +568,6 @@
<Content Include="dashboard-ui\css\images\clients\amazon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\chrome_companion.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\nuvue.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\playstore.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -802,9 +799,6 @@
<Content Include="dashboard-ui\css\images\clients\chrome.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\firefox.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\ie.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -2207,11 +2201,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="dashboard-ui\css\images\clients\mb.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="dashboard-ui\css\images\clients\windowsrt.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>