FichteFoll / hexchat-addons

Addons for hexchat
MIT License
9 stars 1 forks source link

[mpv_np] Script falls back to legacy mode consistantly #3

Open Moodkiller opened 6 years ago

Moodkiller commented 6 years ago

From the bit of testing I've done along with other users, this seems to happen almost every time on Windows 1803. The Windows version before seemed fine and it only fell back to legacy mode if there was something in the title that the script/mpv didnt like.

Wondering if you could look into this at all? Alternatively, is there more styling options available for legacy mode? Currently I have {filename}, {file-size}, {time-pos}${!duration==0: / ${duration}}] and {mpv-version} in the CMD_FMT version, would be great to somehow get these into the LEGACY_CMD_FMT function.

FichteFoll commented 6 years ago

I don't really use Windows anymore so it could take some time until I get to investigate into this. Since apparently it started with the new Windows build, it might be something with Powershell here.

FichteFoll commented 6 years ago

However, adding more variables for the legacy mode should be easy enough. You can even do it yourself since the code is really simple: https://github.com/FichteFoll/hexchat-addons/blob/230a42a21ac71badd1d53fa6b775c4a9e926158b/mpv_np.py#L239-240

Moodkiller commented 6 years ago

Hmm potentially could be. There have been a few changes around it thinking back now. Also regarding the more variables to legacy mode, I'll have a play around again - tried it before but I don't think I could get it to work when following the same format. Iirc, it was the syntax here I was struggling with... i.e, how would one add more variables to that line once defined?

FichteFoll commented 6 years ago

Yes, the legacy version uses simple Python string formatting, so you'll only be able to insert variables like {title} when you define them in the line of code I referenced, and most specifically no conditionals.

The syntax would be to pass a keyword argument with the field's name as they key and whatever value as its value (like with mpv.command("get_property", "media-title") previously).

Moodkiller commented 6 years ago

Alright, will give it another shot. Thanks for the explanation. Also for what its worth, increasing the timeout from 1.5 to 5 seems to result in less fallbacks but of course a longer delay/lockup if it doesn't spit the non legacy format

FichteFoll commented 6 years ago

I suppose the best option would be to ask for an IPC command that does property expansion to be added in mpv natively rather than trying to hack around it using the run command… It's really not a great hack.

Or to at least try to emulate it in a feasible way.

Moodkiller commented 6 years ago

Ideally yeah. Is it feasible to write the variables used for the rich formatted version (i.e the CMD_FMT) to a temp text file and then apply the formatting in there and making Hexchat read that text file instead?? Im assuming the script is failing on grabbing said variables, but if the legacy mode works 100%, the output could be reconfigured (of course I type this before I've had a chance to play around with the legacy variables)