[RELEASE] mIRC Now Playing script
#1
Update: I'm no longer maintaining this script. If you feel like taking over, you're free to use my code.

Hi guys,

I couldn't find anything else like this online so I put it together myself. It's a script that uses the xbmc web interface to retrieve and post currently playing media.

Original release is at http://pastebin.com/rQXbZcf0
0.9 update at http://pastebin.com/VavGkgpv with some error checking added
0.91 at http://pastebin.com/FtY6fdDU Modified for Eden nightly
0.92 at http://pastebin.com/SWm4iLat Small changes as documented in post #9. Verified on Eden beta 1 and mIRC 7.22.

It will automatically detect if you're playing a movie, TV show or music and format output accordingly.

To install:
Open the mIRC Script Editor
Select Remote tab
File -> New
Paste contents of pastebin
Modify host, port and digest appropriately
Click OK
Type /xbmc in channel to post now playing data

I just did it today so feel free to let me know if you find any bugs. It doesn't do any error checking yet (no connection, nothing playing, etc) so I'll probably implement that at least.

Edit 2011/10/23: Not sure if it's due to Eden nightly but something broke. Modified script to be a bit more robust.
Reply
#2
thank you.
Reply
#3
on Eden nightly from a few days ago, and getting "I was able to connect to XBMC but not to retrieve now playing data for some reason."

set %xbmc.digest eGJtYzoxMjM=
^^ thats the proper convert too? i know it depends on my L/P (xbmc/123) but just making sure since it is connecting.
Reply
#4
mrpink84 Wrote:on Eden nightly from a few days ago, and getting "I was able to connect to XBMC but not to retrieve now playing data for some reason."

set %xbmc.digest eGJtYzoxMjM=
^^ thats the proper convert too? i know it depends on my L/P (xbmc/123) but just making sure since it is connecting.

Your digest looks correct.

did you get 0.91? I updated it recently as Eden has changed the format of the reply slightly. I'm away at the moment but I can double-check it over the weekend - I think I may have made a few additional tweaks lately which I haven't posted yet.
Reply
#5
hjbotha Wrote:Your digest looks correct.

did you get 0.91? I updated it recently as Eden has changed the format of the reply slightly. I'm away at the moment but I can double-check it over the weekend - I think I may have made a few additional tweaks lately which I haven't posted yet.

Yes I'm on 0.91 as well. Strange. my host and port is right as well. Thanks for the hard work though hopefully it will get worked out. I'll update my nightly again tomorrow night or friday and see if that fixes it. Happy Thanksgiving!
Reply
#6
Thumbs Up 
OK I've fixed it!

http://pastebin.com/eSWbB5J3

I removed %xbmc.window and went with $active and it works now, both nick & chan windows. Before it kept trying to send a msg to "np" instead of using %xbmc.window as the recipient.
Also removed the error message since it was displaying even when the script outputted correctly. It was working but it was sending to "np" in my status window, and echoing the error message to me anyway. Hope this helps!
It obviously needs a "no filename" or "random error" put back in but for some reason I couldn't get the elseifs to play without outputting + the error message.
I also added filename functionality, so if you are playing a file from Videos instead of the library, it will return the filename to output!

Real quick, just noticed now instead of not returning anything its returning the tbn file if nothing is playing. I'll look at it when I return from some late thanksgiving festivities, still a WIP Tongue
Thank you for all your hard work again!
Reply
#7
I just realized that I had the char set to \ instead of / which works for Windows XBMC but not Linux XBMC. I fixed it locally since I'm using an appletv2 right now, but I'll add a proper catch and fix asap! Why am I always editing XBMC IRC scripts when I'm drunk in the wee hours of the morning? Wink
Reply
#8
In case anybody wants to fix it themselves here's what needs to be done:
In the script I posted it uses $chr(92) or \ for Windows-based XBMC
When switching to Linux-based XBMC, all the $chr(92) instances need to be switched to $chr(47) or /
Reply
#9
Thanks for the tweaks. Sorry, I completely forgot about this once I got back home.

I'm not sure why you had to change things, I'm using Linux as well (XBMC Live) and it works perfectly, both in channels and in private messages. What version of mIRC are you using out of curiosity? 7.22 here.

I've been adding small tweaks to it as I use it so I've put the latest (0.92) here:

http://pastebin.com/SWm4iLat

I'm using Eden beta 1 and it's confirmed working with TV, movies and music.

Changes:
Write "/xbmc COMMENT" and COMMENT will be inserted at the end of the np line.
Now shows the date aired for TV episodes

Edit: Ah, just realised that you tweaked slashes to backslashes for Windows. Understood.
Reply
#10
Has anybody had any luck making this work with Frodo? I guess it's something to do with the http interface requiring JSON interaction but I am not technically minded enough to fix it...
Reply
#11
(2013-02-03, 12:58)qpop Wrote: Has anybody had any luck making this work with Frodo? I guess it's something to do with the http interface requiring JSON interaction but I am not technically minded enough to fix it...

I've literally just discovered myself that it doesn't work with Frodo. Don't know anything about JSON so I'll have to do some research before I can rewrite the parser. Will post here when I do but could be a while.
Reply
#12
http://wiki.xbmc.org/index.php?title=JSON_RPC has some solid information.

If only there was a "if your script used to say this then make it say this..."!
Reply
#13
(2013-02-03, 13:03)qpop Wrote: http://wiki.xbmc.org/index.php?title=JSON_RPC has some solid information.

If only there was a "if your script used to say this then make it say this..."!

Indeed. It's a lot more complicated than one might think. I'd basically have to rewrite this from scratch to make it work properly and I don't currently have the time or inclination to do so. Sorry. If someone else feels like taking it on, feel free to use my code as you see fit, though, as I said, you're better off starting from scratch.

The hurdles I've identified so far are:

1. There is no good way of interacting with JSON from an mIRC script. There is a script snippet available but it's old and obtuse and uses an external javascript library. You're probably better off writing your own parser.
2. Whereas before all the information was available from XBMC on one neatly bulleted web page, now you'd have to make at least 3 separate queries if you want it not to be error-prone.

I think you would need to:
1. Get the active player ID
2. Get the currently playing media in that player
3. Determine if it's audio, a TV show or a movie
4. Get the media info
5. Parse and output

Probably the simplest solution, but not terribly elegant, is to use an external program written in some other language that will query XBMC and write details about the currently playing media to a file for mIRC to read and parse. I'll ponder this avenue but I don't know Python (the logical choice) at all.

Good luck! And sorry again...
Reply
#14
Thanks for the update - I have 0 technical knowledge with scripting so I will wait and hope!
Reply
#15
This is a great script! Hopefully it will be upgraded to Frodo sometime in future Smile I wish I had the needed skills...
Reply

Logout Mark Read Team Forum Stats Members Help
[RELEASE] mIRC Now Playing script1