Skip to content

Commit

Permalink
Merge pull request #341 from MediaPortal/MP1-5227-Fix_Subtitle_Langua…
Browse files Browse the repository at this point in the history
…ge_Name_in_case_of_difference_between_current_video_file_and_subtitle_engine

MP1-5227: Core: VideoPlayerVMR7: Fix Subtitle Language/Name in case of difference between current video file and subtitle engine
  • Loading branch information
andrewjswan authored Nov 6, 2024
2 parents 3010cf0 + 4bc6d15 commit f7d5d04
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions mediaportal/Core/Player/VideoPlayerVMR7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,13 +1850,21 @@ public override string SubtitleLanguage(int iStream)

string strVideNoExt = Path.GetFileNameWithoutExtension(this.m_strCurrentFile);
string strSubNoExt = Path.GetFileNameWithoutExtension(match.Groups["file"].Value);
if (strSubNoExt.Length > strVideNoExt.Length)
streamName = strSubNoExt.Substring(strVideNoExt.Length + 1);
else
streamName = string.Empty;
if (strSubNoExt.StartsWith(strVideNoExt, StringComparison.CurrentCultureIgnoreCase))
{
if (strSubNoExt.Length > strVideNoExt.Length)
streamName = strSubNoExt.Substring(strVideNoExt.Length + 1);
else
streamName = string.Empty;

if (string.IsNullOrWhiteSpace(streamName))
streamName = strVideNoExt;
if (string.IsNullOrWhiteSpace(streamName))
streamName = strVideNoExt;
}
else
{
//difference between m_strCurrentFile and ISubEngine.LoadSubtitles call
streamName = strSubNoExt;
}

langName = streamName;
streamNameUND = streamName;
Expand Down Expand Up @@ -1947,10 +1955,18 @@ public override string SubtitleName(int iStream)
{
string strVideNoExt = Path.GetFileNameWithoutExtension(this.m_strCurrentFile);
string strSubNoExt = Path.GetFileNameWithoutExtension(match.Groups["file"].Value);
if (strSubNoExt.Length > strVideNoExt.Length)
streamName = strSubNoExt.Substring(strVideNoExt.Length + 1);
if (strSubNoExt.StartsWith(strVideNoExt, StringComparison.CurrentCultureIgnoreCase))
{
if (strSubNoExt.Length > strVideNoExt.Length)
streamName = strSubNoExt.Substring(strVideNoExt.Length + 1);
else
streamName = string.Empty;
}
else
streamName = string.Empty;
{
//difference between m_strCurrentFile and ISubEngine.LoadSubtitles call
streamName = strSubNoExt;
}

streamNameFalse = streamName;
langName = streamName;
Expand Down

0 comments on commit f7d5d04

Please sign in to comment.