How to add "DailyMotion" in the Cinema GameMode ??

Hello guys
I’m a fan of Dailymotion, and i want to include it on my cinema gamemode

Does anyone know how ?? and thanks you!

[editline]1st July 2014[/editline]

Here is the youtube plugin used to include youtube in the cinema:

[lua]
local SERVICE = {}

SERVICE.Name = “YouTube”
SERVICE.IsTimed = true

function SERVICE:Match( url )
return string.match( url.host, “youtu.?be[.com]?” )
end

function SERVICE:GetURLInfo( url )

local info = {}

-- http://www.youtube.com/watch?v=(videoId)
if url.query and url.query.v then
	info.Data = url.query.v

-- http://www.youtube.com/v/(videoId)
elseif url.path and string.match(url.path, "^/v/([%a%d-_]+)") then
	info.Data = string.match(url.path, "^/v/([%a%d-_]+)")

-- http://youtu.be/(videoId)
elseif string.match(url.host, "youtu.be") and 
	url.path and string.match(url.path, "^/([%a%d-_]+)$") and
	( !info.query or #info.query == 0 ) then -- short url
	info.Data = string.match(url.path, "^/([%a%d-_]+)$")
end

-- Start time, #t=123s or ?t=123s
if (url.fragment and url.fragment.t) or (url.query and url.query.t) then

	local time = (url.fragment and url.fragment.t) and url.fragment.t or url.query.t

	local seconds = tonumber(string.match(time, "(%d+)s"))
	local minutes = tonumber(string.match(time, "(%d+)m"))
	local hours = tonumber(string.match(time, "(%d+)h"))

	if seconds then
		time = seconds
	end

	if minutes then
		time = tonumber(time) and time or 0
		time = time + (minutes * 60)
	end
	
	if hours then
		time = tonumber(time) and time or 0
		time = time + (hours * 60 * 60)
	end

	if time then
		info.StartTime = time
	end

end

if info.Data then
	return info
else
	return false
end

end

function SERVICE:GetVideoInfo( data, onSuccess, onFailure )

local onReceive = function( body, length, headers, code )

	if string.match( body, "noembed" ) then
		return onFailure( 'Service_EmbedDisabled' )
	elseif string.match( body, "paidContent" ) then
		return onFailure( 'Service_PurchasableContent' )
	end

	local info = {}
	info.title = string.match( body, "<title type='text'>([^

]+)</title>" )
info.duration = string.match( body, “duration seconds=’(%d+)’” )
info.thumbnail = string.match( body, “thumbnail url=’(.+)0.jpg’” )

	if info.thumbnail then
		info.thumbnail = info.thumbnail .. "0.jpg"
	end

	if string.match( body, "&lt;yt:state name='processing'/&gt;" ) then
		info.type = 'youtubelive'
	end

	if onSuccess then
		pcall(onSuccess, info)
	end

end

local url = string.format( "http://gdata.youtube.com/feeds/api/videos/%s", data )
self:Fetch( url, onReceive, onFailure )

end

theater.RegisterService( ‘youtube’, SERVICE )

local SERVICE = {}

SERVICE.Name = “YouTube Live”
SERVICE.IsTimed = false
SERVICE.TheaterType = THEATER_PRIVATE

– Implementation is found in ‘youtube’ service.
– GetVideoInfo switches to ‘youtubelive’

theater.RegisterService( ‘youtubelive’, SERVICE )
[/lua]

Look up the DailyMotion API and how to retrieve video sources.

Look : i tried and when i click on : Request video i get this message:
Processing Dailymotion request…
unsuccessful

Here is the code i tried:
(Can you try to tell me what’s wrong with it? ) please :’(

[lua]
local SERVICE = {}

SERVICE.Name = “Dailymotion”
SERVICE.IsTimed = true

function SERVICE:Match( url )
return string.match( url.host, “dailymotion[.com]?” )
end

function SERVICE:GetURLInfo( url )

local info = {}

-- http://www.youtube.com/watch?v=(videoId)
if url.query and url.query.v then
	info.Data = url.query.v

-- http://www.youtube.com/v/(videoId)
elseif url.path and string.match(url.path, "^/video/([%a%d-_]+)") then
	info.Data = string.match(url.path, "^/video/([%a%d-_]+)")

-- http://youtu.be/(videoId)
elseif string.match(url.host, "dailymotion.com") and 
	url.path and string.match(url.path, "^/([%a%d-_]+)$") and
	( !info.query or #info.query == 0 ) then -- short url
	info.Data = string.match(url.path, "^/([%a%d-_]+)$")
end

-- Start time, #t=123s or ?t=123s
if (url.fragment and url.fragment.t) or (url.query and url.query.t) then

	local time = (url.fragment and url.fragment.t) and url.fragment.t or url.query.t

	local seconds = tonumber(string.match(time, "(%d+)s"))
	local minutes = tonumber(string.match(time, "(%d+)m"))
	local hours = tonumber(string.match(time, "(%d+)h"))

	if seconds then
		time = seconds
	end

	if minutes then
		time = tonumber(time) and time or 0
		time = time + (minutes * 60)
	end
	
	if hours then
		time = tonumber(time) and time or 0
		time = time + (hours * 60 * 60)
	end

	if time then
		info.StartTime = time
	end

end

if info.Data then
	return info
else
	return false
end

end

function SERVICE:GetVideoInfo( data, onSuccess, onFailure )

local onReceive = function( body, length, headers, code )

	if string.match( body, "noembed" ) then
		return onFailure( 'Service_EmbedDisabled' )
	elseif string.match( body, "paidContent" ) then
		return onFailure( 'Service_PurchasableContent' )
	end

	local info = {}
	info.title = string.match( body, "&lt;title type='text'&gt;([^

]+)</title>" )
info.duration = string.match( body, “duration seconds=’(%d+)’” )
info.thumbnail = string.match( body, “thumbnail url=’(.+)0.jpg’” )

	if info.thumbnail then
		info.thumbnail = info.thumbnail .. "0.jpg"
	end

	if string.match( body, "&lt;yt:state name='processing'/&gt;" ) then
		info.type = 'Dailymotionlive'
	end

	if onSuccess then
		pcall(onSuccess, info)
	end

end

local url = string.format( "http://api.dailymotion.com/video/%s", data )
self:Fetch( url, onReceive, onFailure )

end

theater.RegisterService( ‘youtube’, SERVICE )

local SERVICE = {}

SERVICE.Name = “Dailymotion”
SERVICE.IsTimed = false
SERVICE.TheaterType = THEATER_PRIVATE

– Implementation is found in ‘youtube’ service.
– GetVideoInfo switches to ‘youtubelive’

theater.RegisterService( ‘youtubelive’, SERVICE )
[/lua]

[editline]1st July 2014[/editline]

Dailymotion URL scheme:
http://www.dailymotion.com/video/*

[editline]1st July 2014[/editline]

Dailymotion API scheme:
https://api.dailymotion.com/video/*
Example:

https://api.dailymotion.com/video/x7lni3_mario-kart-remi-gaillard_fun