Skip to content

Commit

Permalink
Merge branch 'videoid' of https://github.com/adq/xbmc-urlresolver int…
Browse files Browse the repository at this point in the history
…o adq-videoid
  • Loading branch information
t0mm0 committed Oct 30, 2011
2 parents 050d68a + e57c96c commit f7198ca
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
57 changes: 57 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/tedtalks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import re
from t0mm0.common.net import Net
import urllib
import urllib2
from urlresolver import common
from urlresolver.plugnplay.interfaces import UrlResolver
from urlresolver.plugnplay.interfaces import PluginSettings
from urlresolver.plugnplay import Plugin

class TedTalksResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "tedtalks"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)

def get_media_url(self, host, media_id):
plugin = 'plugin://plugin.video.ted.talks/?mode=playVideo&name=ted&icon=ted&url=' +\
urllib.quote_plus(media_id)
return plugin


def get_url(self, host, media_id):
return media_id


def get_host_and_id(self, url):
return ('ted.com', url)


def valid_url(self, url, host):
return re.match('http://(www.)?ted.com/.+', url)

def get_settings_xml(self):
xml = PluginSettings.get_settings_xml(self)
xml += '<setting label="This plugin calls the tedtalks addon - '
xml += 'change settings there." type="lsep" />\n'
return xml
65 changes: 65 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/vimeo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import re
from t0mm0.common.net import Net
import urllib2
from urlresolver import common
from urlresolver.plugnplay.interfaces import UrlResolver
from urlresolver.plugnplay.interfaces import PluginSettings
from urlresolver.plugnplay import Plugin

class VimeoResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "vimeo"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)

def get_media_url(self, host, media_id):
#just call vimeo addon
plugin = 'plugin://plugin.video.vimeo/?action=play_video&videoid=' +\
media_id
return plugin


def get_url(self, host, media_id):
return 'http://vimeo.com/%s' % media_id


def get_host_and_id(self, url):
r = re.findall('/([0-9]+)', url)
if r:
video_id = r[-1]
if video_id:
return ('vimeo.com', video_id)
else:
common.addon.log_error('vimeo: video id not found')
return False


def valid_url(self, url, host):
return re.match('http://(www.)?vimeo.com/[0-9]+',
url)

def get_settings_xml(self):
xml = PluginSettings.get_settings_xml(self)
xml += '<setting label="This plugin calls the vimeo addon - '
xml += 'change settings there." type="lsep" />\n'
return xml

0 comments on commit f7198ca

Please sign in to comment.