Skip to content

Instantly share code, notes, and snippets.

@irq0
Created December 11, 2013 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irq0/7903248 to your computer and use it in GitHub Desktop.
Save irq0/7903248 to your computer and use it in GitHub Desktop.
Play a nice fireplace video on XBMC
#!/bin/bash
xbmc_play_url $(youtube-dl -g $(youtube_search.py fireplace hd | sort -R | cut -f1 -d " " | head -1))
#!/bin/bash
url="$1"
payload='{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "'$url'" }}, "id": 1 }'
curl -v -u xbmc:WUT? -H "Content-type: application/json" -d "$payload" http://localhost:8080/jsonrpc
#!/usr/bin/env python
import sys
from gdata.youtube.service import *
c = YouTubeService()
q = YouTubeVideoQuery()
q.hd = True
q.vq = " ".join(sys.argv[1:])
r = c.YouTubeQuery(q)
for e in r.entry:
print "{url} {title:<30}".format(title=e.title.text, url=e.media.player.url)
@irq0
Copy link
Author

irq0 commented Aug 7, 2014

Dependencies:

  • python
  • python-gdata
  • youtube-dl
  • curl

Change username and password in the curl command line in the xbmc_play_url script ("xbmc:WUT?")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment