diff --git a/docs/Changelog.md b/docs/Changelog.md index f4547fb..ab15d51 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -17,6 +17,7 @@ is created with defaults for osc and console. - Support mpv idle property, see manual for remarks. - Fix external audio and subtitle files not shown in all use cases. +- Fix mpv options not working in case of existing same line comments. - Fix crash choosing Matroska edition in the menu. - Fix auto-play and auto-load-folder not working with user scripts. - Fix slow startup using `osd-scale-by-window=no`. diff --git a/src/Misc/Player.cs b/src/Misc/Player.cs index da5e99d..947da64 100644 --- a/src/Misc/Player.cs +++ b/src/Misc/Player.cs @@ -359,7 +359,17 @@ namespace mpvnet if (File.Exists(ConfPath)) foreach (var i in File.ReadAllLines(ConfPath)) if (i.Contains("=") && !i.TrimStart().StartsWith("#")) - _Conf[i.Substring(0, i.IndexOf("=")).Trim()] = i.Substring(i.IndexOf("=") + 1).Trim(); + { + string key = i.Substring(0, i.IndexOf("=")).Trim(); + string value = i.Substring(i.IndexOf("=") + 1).Trim(); + + if (value.Contains("#") && !value.StartsWith("#") && + !value.StartsWith("'#") && !value.StartsWith("\"#")) + + value = value.Substring(0, value.IndexOf("#")).Trim(); + + _Conf[key] = value; + } foreach (var i in _Conf) ProcessProperty(i.Key, i.Value);