Skip to content
Permalink
Browse files

Internet Content: Update Dailymotion grabber to allow remote control.

Dailymotion is painfully slow and has a tendency to start playing before it has nearly enough buffered, but it does work, as do all the supported controls.
  • Loading branch information
Robert McNamara
Robert McNamara committed Dec 8, 2010
1 parent 5b7b93d commit 1b639d7a1d12dde1f91411b3f2f01334070f79bd
@@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
</style>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
/* gup function by R.D. Vaughan */
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var myth_player = null;
var videocode = gup('videocode');
var params = {
allowScriptAccess: "always",
allowfullscreen: 'true',
wmode: 'opaque'
};
var flashvars = {
autoStart: 1
};
var atts = { id: "mydmplayer" };
swfobject.embedSWF('http://www.dailymotion.com/swf/' + videocode + '&enableApi=1&playerapiid=dmplayer&autoPlay=1',
"myth_player", window.innerWidth, window.innerHeight, "8", null, flashvars, params, atts);
function onDailymotionPlayerReady(playerId) {
myth_player = document.getElementById("mydmplayer");
myth_player.setVolume(50);
if (videocode != "") {
myth_player.loadVideoById(videocode);
myth_player.playVideo();
}
}
function play() {
if (myth_player) {
var state = myth_player.getPlayerState();
if (state == 1) // Playing
myth_player.pauseVideo();
else if (state != 3) // Video is either unstarted, ended, paused or cued
myth_player.playVideo();
}
}
function seek(amount) {
if (myth_player) {
myth_player.seekTo(myth_player.getCurrentTime() + amount);
}
}
function adjustVolume(amount) {
if (myth_player) {
myth_player.setVolume(myth_player.getVolume() + amount);
}
}
window.onresize = function() {
document.body.style.width = window.innerWidth;
document.body.style.height = window.innerHeight;
if (myth_player) {
// myth_player.setSize(window.innerWidth, window.innerHeight);
document.getElementById("mydmplayer").width = window.innerWidth;
document.getElementById("mydmplayer").height = window.innerHeight;
}
};
</script>
</head>
<body>
<div id="myth_player"/>
</body>
</html>
@@ -37,6 +37,7 @@
import os, struct, sys, re, time
import urllib, urllib2
import logging
from MythTV import MythXML

try:
import xml.etree.cElementTree as ElementTree
@@ -147,6 +148,7 @@ def __init__(self,
"""
self.config = {}
self.mythxml = MythXML()

if apikey is not None:
self.config['apikey'] = apikey
@@ -697,6 +699,10 @@ def setTreeViewIcon(self, dir_icon=None):
#
###########################################################################################################

def processVideoUrl(self, url):
playerUrl = self.mythxml.getInternetContentUrl("nv_python_libs/configs/HTML/dailymotion.html", \
url.replace(u'http://www.dailymotion.com/swf/video/', ''))
return self.ampReplace(playerUrl)

def searchTitle(self, title, pagenumber, pagelen):
'''Key word video search of the Dailymotion web site
@@ -927,7 +933,7 @@ def getVideosForURL(self, url, dictionaries):
for elem in e:
if elem.tag.endswith('content') and elem.get('type') == 'application/x-shockwave-flash':
if elem.get('url'):
meta_data['video'] = self.ampReplace((elem.get('url')+u'?autoPlay=1'))
meta_data['video'] = self.processVideoUrl(elem.get('url'))
if elem.get('duration'):
meta_data['duration'] = elem.get('duration').strip()
if elem.get('width'):

0 comments on commit 1b639d7

Please sign in to comment.
You can’t perform that action at this time.