Skip to content

Commit

Permalink
Change mpv link title detection (online files doesn't have metadata)
Browse files Browse the repository at this point in the history
  • Loading branch information
datasone committed Mar 12, 2022
1 parent d6b2621 commit 69c5213
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MPVMediaControl/PipeServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private static string FromHexString(string hexString)
return Encoding.UTF8.GetString(bytes); // returns: "Hello world" for "48656C6C6F20776F726C64"
}

private static void ParseFile(MediaController controller, Dictionary<string, string> parameters, bool nonHexPath = false)
private static void ParseFile(MediaController controller, Dictionary<string, string> parameters)
{
var title = FromHexString(parameters["title"]);
var artist = FromHexString(parameters["artist"]);
Expand Down
3 changes: 2 additions & 1 deletion notify_media.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function notify_metadata_updated()
end

if not title or title == "" then
title = mp.get_property_native("filename/no-ext")
title = mp.get_property_native("media-title")
end

path = mp.get_property_native("path")
Expand Down Expand Up @@ -180,6 +180,7 @@ end
mp.set_property("options/input-ipc-server", "\\\\.\\pipe\\mpvsocket_" .. pid)

mp.register_event("file-loaded", notify_current_file)
mp.observe_property("media-title", nil, notify_metadata_updated)
mp.observe_property("metadata", nil, notify_metadata_updated)
mp.observe_property("chapter", nil, notify_metadata_updated)
mp.register_event("end-file", play_state_changed)
Expand Down

0 comments on commit 69c5213

Please sign in to comment.