Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/MusterGit/xbmc-urlresolver
Browse files Browse the repository at this point in the history
…into MusterGit-master
  • Loading branch information
t0mm0 committed Oct 31, 2011
2 parents ed868f2 + f2fdcee commit 1e994f2
Show file tree
Hide file tree
Showing 8 changed files with 696 additions and 39 deletions.
91 changes: 52 additions & 39 deletions plugin.video.t0mm0.test/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,65 +46,78 @@
urlresolver.display_settings()

elif mode == 'test':
addon.add_video_item({'url': 'http://www.2gb-hosting.com/v/94fb733db6e9f984b07da3cb238eb277/2074fe10f41c7e1.flv.html'},
addon.add_video_item({'url': 'http://skyload.net/File/a25454887fd8cce41bac2e316d9d0a51.flv'},
{'title': 'skyload url'})
addon.add_video_item({'host': 'skyload', 'media_id': 'a25454887fd8cce41bac2e316d9d0a51'},
{'title': 'skyload media id'})
addon.add_video_item({'url': 'http://server4.stream2k.com/playerjw/vConfig56.php?vkey=1d8dc00940da661ffba9'},
{'title': 'stream2k url'})
addon.add_video_item({'host': 'stream2k', 'media_id': '1d8dc00940da661ffba9'},
{'title': 'stream2k media id'})
addon.add_video_item({'url': 'http://www.ecostream.tv/stream/b83c3c5d07b1ab195fb8245576c27daa.html?' +
'width=679&height=365&bGetRedirectUrl=False&sFileName=Larry+Crowne'},
{'title': 'ecostream url'})
addon.add_video_item({'host': 'ecostream', 'media_id': 'b83c3c5d07b1ab195fb8245576c27daa'},
{'title': 'ecostream media id'})
addon.add_video_item({'url': 'http://www.2gb-hosting.com/v/94fb733db6e9f984b07da3cb238eb277/2074fe10f41c7e1.flv.html'},
{'title': '2gbhosting url'})
addon.add_video_item({'host': '2gb-hosting.com', 'media_id': 'e1593e96e19f7ecced3778668e809c77/efc5d03968fbca6.avi.html'},
addon.add_video_item({'host': '2gb-hosting.com', 'media_id': 'e1593e96e19f7ecced3778668e809c77/efc5d03968fbca6.avi.html'},
{'title': '2gbhosting media id'})
addon.add_video_item({'url': 'http://www.divxstage.eu/video/eb20c352c3ccc'},
addon.add_video_item({'url': 'http://www.divxstage.eu/video/eb20c352c3ccc'},
{'title': 'divxstage url'})
addon.add_video_item({'host': 'divxstage.eu', 'media_id': 'eb20c352c3ccc'},
addon.add_video_item({'host': 'divxstage.eu', 'media_id': 'eb20c352c3ccc'},
{'title': 'divxstage media id'})
addon.add_video_item({'url': 'http://www.megaupload.com/?d=9T8NHCK4'},
addon.add_video_item({'url': 'http://www.megaupload.com/?d=9T8NHCK4'},
{'title': 'megaupload url'})
addon.add_video_item({'host': 'megaupload.com', 'media_id': '9T8NHCK4'},
addon.add_video_item({'host': 'megaupload.com', 'media_id': '9T8NHCK4'},
{'title': 'megaupload media id'})
addon.add_video_item({'url': 'http://www.megavideo.com/?v=LYWNYM1J'},
addon.add_video_item({'url': 'http://www.megavideo.com/?v=LYWNYM1J'},
{'title': 'megavideo url'})
addon.add_video_item({'host': 'megavideo.com', 'media_id': 'LYWNYM1J'},
addon.add_video_item({'host': 'megavideo.com', 'media_id': 'LYWNYM1J'},
{'title': 'megavideo media id'})
addon.add_video_item({'url': 'http://www.movshare.net/video/rnqmuilri1b71'},
addon.add_video_item({'url': 'http://www.movshare.net/video/rnqmuilri1b71'},
{'title': 'movshare url'})
addon.add_video_item({'host': 'movshare.net', 'media_id': 'rnqmuilri1b71'},
addon.add_video_item({'host': 'movshare.net', 'media_id': 'rnqmuilri1b71'},
{'title': 'movshare media id'})
addon.add_video_item({'url': 'http://www.nolimitvideo.com/video/bdb6e2c62fe027a7b20a/friends-with-benefits-ts'},
addon.add_video_item({'url': 'http://www.nolimitvideo.com/video/bdb6e2c62fe027a7b20a/friends-with-benefits-ts'},
{'title': 'nolimitvideo url'})
addon.add_video_item({'host': 'nolimitvideo.com', 'media_id': 'bdb6e2c62fe027a7b20a'},
addon.add_video_item({'host': 'nolimitvideo.com', 'media_id': 'bdb6e2c62fe027a7b20a'},
{'title': 'nolimitvideo media id'})
addon.add_video_item({'url': 'http://embed.novamov.com/embed.php?width=600&height=480&v=kdshwq2cj6vxv&px=1'},
addon.add_video_item({'url': 'http://embed.novamov.com/embed.php?width=600&height=480&v=kdshwq2cj6vxv&px=1'},
{'title': 'novamov url'})
addon.add_video_item({'host': 'novamov.com', 'media_id': 'kdshwq2cj6vxv'},
addon.add_video_item({'host': 'novamov.com', 'media_id': 'kdshwq2cj6vxv'},
{'title': 'novamov media id'})
addon.add_video_item({'url': 'http://www.putlocker.com/file/DFE7599AE064911A'},
addon.add_video_item({'url': 'http://www.putlocker.com/file/DFE7599AE064911A'},
{'title': 'putlocker url'})
addon.add_video_item({'host': 'putlocker.com', 'media_id': 'DFE7599AE064911A'},
addon.add_video_item({'host': 'putlocker.com', 'media_id': 'DFE7599AE064911A'},
{'title': 'putlocker media id'})
addon.add_video_item({'url': 'http://www.seeon.tv/view/19412/CBS'},
addon.add_video_item({'url': 'http://www.seeon.tv/view/19412/CBS'},
{'title': 'seeon.tv url'})
addon.add_video_item({'host': 'seeon.tv', 'media_id': '19412'},
addon.add_video_item({'host': 'seeon.tv', 'media_id': '19412'},
{'title': 'seeon.tv media id'})
addon.add_video_item({'url': 'http://www.tubeplus.me/player/1962655/Entourage/season_8/episode_2/Out_With_a_Bang_/'},
addon.add_video_item({'url': 'http://www.tubeplus.me/player/1962655/Entourage/season_8/episode_2/Out_With_a_Bang_/'},
{'title': 'tubeplus url'})
addon.add_video_item({'host': 'tubeplus.me', 'media_id': '1962655'},
addon.add_video_item({'host': 'tubeplus.me', 'media_id': '1962655'},
{'title': 'tubeplus media id'})
addon.add_video_item({'url': 'http://videobb.com/video/8FvAG6AQpHi8'},
addon.add_video_item({'url': 'http://videobb.com/video/8FvAG6AQpHi8'},
{'title': 'videobb url'})
addon.add_video_item({'host': 'videobb.com', 'media_id': '8FvAG6AQpHi8'},
addon.add_video_item({'host': 'videobb.com', 'media_id': '8FvAG6AQpHi8'},
{'title': 'videobb media id'})
addon.add_video_item({'url': 'http://www.videoweed.es/file/crirmdz3tj116'},
addon.add_video_item({'url': 'http://www.videoweed.es/file/crirmdz3tj116'},
{'title': 'videoweed url'})
addon.add_video_item({'host': 'videoweed.com', 'media_id': 'crirmdz3tj116'},
addon.add_video_item({'host': 'videoweed.com', 'media_id': 'crirmdz3tj116'},
{'title': 'videoweed media id'})
addon.add_video_item({'url': 'http://www.vidxden.com/rn3h4gbh5se7/kdshn-4x4_watchseries-online.dot.com.avi.html'},
addon.add_video_item({'url': 'http://www.vidxden.com/rn3h4gbh5se7/kdshn-4x4_watchseries-online.dot.com.avi.html'},
{'title': 'vidxden url'})
addon.add_video_item({'host': 'vidxden.com', 'media_id': 'rn3h4gbh5se7'},
addon.add_video_item({'host': 'vidxden.com', 'media_id': 'rn3h4gbh5se7'},
{'title': 'vidxden media id'})
addon.add_video_item({'url': 'http://www.vimeo.com/30081785'},
addon.add_video_item({'url': 'http://www.vimeo.com/30081785'},
{'title': 'vimeo url'})
addon.add_video_item({'host': 'vimeo.com', 'media_id': '30081785'},
addon.add_video_item({'host': 'vimeo.com', 'media_id': '30081785'},
{'title': 'vimeo media id'})
addon.add_video_item({'url': 'http://www.youtube.com/watch?v=Q3VJOl_XeGs'},
addon.add_video_item({'url': 'http://www.youtube.com/watch?v=Q3VJOl_XeGs'},
{'title': 'youtube url'})
addon.add_video_item({'host': 'youtube.com', 'media_id': 'Q3VJOl_XeGs'},
addon.add_video_item({'host': 'youtube.com', 'media_id': 'Q3VJOl_XeGs'},
{'title': 'youtube media id'})
elif mode == 'tv':
browse = addon.queries.get('browse', False)
Expand All @@ -118,20 +131,20 @@
regex = re.finditer(r, html, re.DOTALL)
for s in regex:
thumb, url, title, plot = s.groups()
addon.add_directory({'mode': 'series',
'url': base_url + url},
{'title': title},
addon.add_directory({'mode': 'series',
'url': base_url + url},
{'title': title},
img=base_url+thumb)

else:
addon.add_directory({'mode': 'tv',
addon.add_directory({'mode': 'tv',
'browse': 'alpha',
'letter': '-'}, {'title': '#'})
for l in string.uppercase:
addon.add_directory({'mode': 'tv',
addon.add_directory({'mode': 'tv',
'browse': 'alpha',
'letter': l}, {'title': l})

else:
addon.add_directory({'mode': 'tv', 'browse': 'alpha'}, {'title': 'A-Z'})

Expand All @@ -147,17 +160,17 @@
params = episode.split('_')
if len(params) == 5:
ep_url = '%s/player/%s/' % (base_url, params[2])
title = 'S%sE%s - %s (%s)' % (params[0], params[1],
title = 'S%sE%s - %s (%s)' % (params[0], params[1],
params[3], params[4])
addon.add_video_item({'url': ep_url}, {'title': title})


elif mode == 'main':
addon.show_small_popup('t0mm0 test addon', 'Is now loaded enjoy', 6000,
logo)
addon.add_directory({'mode': 'test'}, {'title': '*test links*'})
addon.add_directory({'mode': 'tv'}, {'title': 'tubeplus.me tv'})
addon.add_directory({'mode': 'resolver_settings'}, {'title': 'resolver settings'},
addon.add_directory({'mode': 'resolver_settings'}, {'title': 'resolver settings'},
is_folder=False)


Expand Down
94 changes: 94 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/ecostream.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
"""
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/>.
"""

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

# Custom imports
import re



class EcostreamResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "ecostream"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
self.pattern = 'http://((?:www.)?ecostream.tv)/(?:stream|embed)?/([0-9a-zA-Z]+).html'


def get_media_url(self, host, media_id):
# emulate click on button "Start Stream" (ss=1)
web_url = self.get_url(host, media_id) + "?ss=1"

try:
html = self.net.http_GET(web_url).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, web_url))
return False

# get vars
sPattern = "var t=setTimeout\(\"lc\('([^']+)','([^']+)','([^']+)'\)"
r = re.findall(sPattern, html)
if r:
for aEntry in r:
sS = str(aEntry[0])
sK = str(aEntry[1])
sT = str(aEntry[2])

# send vars and retrieve stream url
sNextUrl = 'http://www.ecostream.tv/object.php?s='+sS+'&k='+sK+'&t='+sT

try:
html = self.net.http_GET(sNextUrl).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, web_url))
return False

sPattern = '<param name="flashvars" value="file=(.*?)&'
r = re.search(sPattern, html)
if r:
sLinkToFile = r.group(1)
return sLinkToFile


return False


def get_url(self, host, media_id):
return 'http://www.ecostream.tv/stream/%s.html' % (media_id)

def get_host_and_id(self, url):
r = re.search(self.pattern, url.replace('embed','stream'))
if r:
return r.groups()
else:
return False


def valid_url(self, url, host):
return re.match(self.pattern, url) or self.name in host
77 changes: 77 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/skyload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""
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/>.
"""

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

# Custom imports
import re



class SkyloadResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "skyload"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
self.pattern = 'http://((?:www.)?skyload.net)/File/([0-9a-zA-Z]+).flv'


def get_media_url(self, host, media_id):
web_url = self.get_url(host, media_id)

try:
html = self.net.http_GET(web_url).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, web_url))
return False

sPattern = 'var targetURL="([^"]+)"'
r = re.search(sPattern, html)
if r:
return r.group(1)
else:
sPattern= "file','([^']+)'"
r = re.search(sPattern, html)
if r:
return r.group(1)

return False


def get_url(self, host, media_id):
return 'http://skyload.net/File/%s.flv' % (media_id)

def get_host_and_id(self, url):
r = re.search(self.pattern, url)
if r:
return r.groups()
else:
return False


def valid_url(self, url, host):
return re.match(self.pattern, url) or self.name in host
Loading

0 comments on commit 1e994f2

Please sign in to comment.