Created
December 11, 2013 00:51
-
-
Save irq0/7903248 to your computer and use it in GitHub Desktop.
Play a nice fireplace video on XBMC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
xbmc_play_url $(youtube-dl -g $(youtube_search.py fireplace hd | sort -R | cut -f1 -d " " | head -1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependencies:
Change username and password in the curl command line in the
xbmc_play_url
script ("xbmc:WUT?")