Playlist2XBMC – Chrome Extension
#1
Hey everyone,

I find myself using XBMC a lot as a supplementary tool to my desktop computer instead of just as something to play media while I sit on the couch. So, to make the process of sending web-media to XBMC more comfortable I wrote this chrome extension: Playlist2XBMC

The extension has the following features:

- Adds a play button to every YouTube page which 'inserts' the video into your playlist and plays it right away
- Adds a plus button to every YouTube page which adds the video at the end of the playlist queue
- Adds a clear button to every YouTube page to clear your current playlist
- In case of a YouTube playlist-bar, it adds a button to play that YouTube playlist on your XBMC
- Adds play and plus buttons to the search results on YouTube

The extension talks to the jsonrpc of XBMC and therefore it only supports Eden (and beyond probably). In the future I'd like to build in support for other other media sites and perhaps some options in the right-click menu when you hover over a random media link to add it to the playlist.

Code on github: link

changelog

1.1.3
- ajax content-type set to "application/json" for new XBMC Nightly builds
- fixes the 'plays the wrong video' issue on the search page
- updates manifest version to 2.0, changes some security policies

1.1.2
- fixes the 'appearing menu-bar' bug when playing an inserted video
- updates the button injection script to work with some of the new yt html (they made some small changes)
- adds injection of play/plus buttons to HD-specific search pages
- adds a 'queue all' button to the search page

1.1.1
- updates the video id filter for the youtube search page

1.1
- added buttons to the homepage of YouTube

Screenshots:
ImageImageImage
Reply
#2
Looks really, really cool - will give it a shot tonight! Thanks!
Need help? Check out my XBMC Frodo Guide. It contains full featured guides to Sickbeard and CouchPotato as well.

Image
Reply
#3
Works excellent, thx man, great addition!

LoL Wink
Reply
#4
This looks brilliant, looks slicker than the current Userscript/GreaseMonkey offerings for Firefox (That I can find anyway).

Any chance of a Firefox version?!!

The Capt.
Image
Reply
#5
Great extension! I was looking for something exactly like this.

The only problem I have, is that when you click play while a video is already playing, the new video start to play in the background, with the menus still present in the foreground. Does anyone else have this problem as well?
Reply
#6
Capt.Insano Wrote:Any chance of a Firefox version?!!
I'd love to look into that but that probably won't happen anytime soon. Thanks for the input though, I appreciate it!

(2012-05-06, 12:52)tojnk Wrote: The only problem I have, is that when you click play while a video is already playing, the new video start to play in the background, with the menus still present in the foreground. Does anyone else have this problem as well?

Yeah, I noticed that too during development but I figured it was due to me testing everything on Windows on a second monitor and the cursor getting in the way. Apparently that wasn't the case, I wasn't at home so my HTPC was far away and I'm not too familiar with the behavior of a Windows version. It seems to be happening when the extension sends the following json to the XBMC:

'{"jsonrpc": "2.0", "method": "Playlist.Insert", "params":{"playlistid":1,"position":'+insert_position+',"item":{ "file" : "plugin://plugin.video.youtube/?action=play_video&videoid='+video_id+'"} }, "id": 1}';

So I think it's the "method": "Playlist.Insert" that is causing this. As far as I know there isn't any way I can send key-presses to XBMC using the JSON-RPC right? If that was the case I could just send 'tab' after that part of the interaction and everything would be fine. Does anyone have a clue on how to hide the menu bar using the JSON-RPC or even better, stop it from showing up when we 'Insert'?

Cheers
Reply
#7
to play
Playlist.Clear, Playlist.Add(file), Player.Open(playlist)

to queue its just Playlist.Add

This is how we do it for Maraschino.. not sure if its the best way. If you only want to add files to end of queue, Playlist.Add should work just fine.

Great work BTW, very useful as i dont have speakers on my pc Smile
EDIT: just noticed your inserting at top of queue and not the end (should have read first Tongue)
Reply
#8
(2012-05-07, 11:10)N3MIS15 Wrote: to play
Playlist.Clear, Playlist.Add(file), Player.Open(playlist)

to queue its just Playlist.Add

Yes, that is how I did it for the plus button. I put the code up on github so you guys can see how I did things. https://github.com/vdloo/Playlist2XBMC
Reply
#9
Very very nice. Runs smooth and is really useful. Thanks a lot.

FFY
Reply
#10
Fantastic! Thank you very much. I only wish for an option to change the buttons to triggered by double clicks instead of clicks - far too often do I click the Play button instead of pressing the button that reveals more videos from the user…
Reply
#11
(2012-05-06, 12:52)tojnk Wrote: The only problem I have, is that when you click play while a video is already playing, the new video start to play in the background, with the menus still present in the foreground. Does anyone else have this problem as well?

I think this problem is caused by sending a "Player.Open" command while the previous command ("Playlist.Clear") is still running. A workaround is to make jquery calls synchronous by using:
Code:
$.ajaxSetup({async:false});
or to make use of the jquery callback functions.
Reply
#12
(2012-06-09, 21:13)tojnk Wrote: I think this problem is caused by sending a "Player.Open" command while the previous command ("Playlist.Clear") is still running. A workaround is to make jquery calls synchronous by using:
Code:
$.ajaxSetup({async:false});
or to make use of the jquery callback functions.

Making the calls synchronous didn't stop it from happening, however your advice did point me in the right direction. The fix turned out to be changing the 'Player.Open' command to 'Player.GoTo' for when the a video is already playing.
Reply
#13
Hey, nice work.. BUT - Just a heads up for you (in case you want to head this off early):

The XBMC Nightly builds recently changed to require the content-type set to "application/json" in your ajax request..
Without the content-type set, you get a 415 "Unsupported Media Type"

Cheers!
ObM.
Reply
#14
(2012-07-05, 08:16)Outbreak Monkey Wrote: The XBMC Nightly builds recently changed to require the content-type set to "application/json" in your ajax request..
Without the content-type set, you get a 415 "Unsupported Media Type"

Thanks for the heads up, I changed the content-type so it should work now.
Reply
#15
Cool, quick response! Smile

The guys in our office made their own plugin a while back. We started using yours because they never got around to building support for playlists and queueing videos (they just used player.open).. THOUGH we do have support for Vimeo and College Humour.

Just another thought for you (I think I saw you said you wanted to support other video sites) - to give you some feedback on our experience:
Your UI stuff for YouTube is nice.. BUT to make support easier, have you thought about moving your UI to an extension button beside the URL/Omni bar?
This will save you rewriting your UI for each of the video sites and make for a consistent experience across all video sites.
Image
(This is just a quick hacked up UI we're using)
Again, just thoughts - there's definite merit in integrating with the Youtube UI..
BUT it makes support a biatch for multiple sites. Also if they decide to screw with IDs you're forever updating your code! Smile

Anyway, keep up the good work!
Cheers,
ObM.
Reply

Logout Mark Read Team Forum Stats Members Help
Playlist2XBMC – Chrome Extension 2