I'm working on a ZShare plugin but having a bit of trouble
Code:
Code:
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 ZShareResolver(Plugin, UrlResolver, PluginSettings):
implements = [urlResolver, PluginSettings]
name = "zshare"
def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
def get_media_url(self, web_url):
#find key
try:
html = self.net.http_GET(web_url).content
except urllib2.URLError, e:
common.addon.log_error('zshare: got http error %d fetching %s' %
(e.code, web_url))
return False
r = re.search('<iframe src="(.+?)" .+? id="videoframe"',html)
if r:
videourl = r.group(1)
else:
common.addon.log_error('zshare: filename and filekey not found')
return False
try:
html = self.net.http_GET(videourl).content
except urllib2.URLError, e:
common.addon.log_error('zshare: got http error %d fetching %s' %
(e.code, api))
return False
r = re.search('file: "(.+?)",',html)
if r:
stream_url = r.group(1) + '?start=0'
else:
common.addon.log_error('zshare: stream url not found')
return False
return stream_url
def valid_url(self, web_url):
return re.match('http://(www.)?zshare.net/video/(?:[0-9a-zA-Z]+)',
web_url)
Rather simple as I don't know how to do any fancy python stuff yet
First - when I pass in zshare links to either urlresolver.choose_source() or urlresolver.filter_urls() they don't come back in the filtered list
**Edit - oops, was a typo error in my addon!
Second - the link I am returning doesn't seem to be playable when used via urlresolver
eg.
addon.add_video_item('http://www.zshare.net/video/93296873f03a68ec',
{'title': 'zshare'})
Logs show errors trying to open the stream
Code:
13:20:39 T:1740 M:1387261952 NOTICE: DVDPlayer: Opening: http://dl005.zshare.net/stream/e0fa06c3aa46583713037cbe84b53d78/93296873/1314292839/QSSDivX_lap-bdtc.avi.flv//5257303228/?start=0
13:20:39 T:1740 M:1387261952 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
13:20:39 T:8036 M:1387261952 DEBUG: thread start, auto delete: 0
13:20:39 T:8036 M:1387261952 NOTICE: Creating InputStream
13:20:39 T:8036 M:1387261952 DEBUG: CFileCache::Open - opening <stream/e0fa06c3aa46583713037cbe84b53d78/93296873/1314292839/QSSDivX_lap-bdtc.avi.flv//5257303228/> using cache
13:20:39 T:8036 M:1387261952 DEBUG: Using proxy http://mcapproxy2:8080
13:20:39 T:8036 M:1387261952 DEBUG: FileCurl::Open(085E1928) http://dl005.zshare.net/stream/e0fa06c3aa46583713037cbe84b53d78/93296873/1314292839/QSSDivX_lap-bdtc.avi.flv//5257303228/?start=0
13:20:39 T:1740 M:1387266048 DEBUG: ------ Window Init (DialogBusy.xml) ------
13:20:39 T:8036 M:1387257856 INFO: CDVDFactorySubtitle::GetSubtitles, searching subtitles
13:20:39 T:8036 M:1387257856 DEBUG: CUtil::CacheSubtitles: START
13:20:39 T:8036 M:1387257856 INFO: CDVDFactorySubtitle::GetSubtitles, searching subtitles done
13:20:39 T:8036 M:1387257856 NOTICE: Creating Demuxer
13:20:39 T:2532 M:1387257856 DEBUG: thread start, auto delete: 0
13:20:39 T:2532 M:1387257856 INFO: CFileCache::Process - Hit eof.
13:20:39 T:8036 M:1387257856 DEBUG: CDVDDemuxFFmpeg::Open - probing failed, re-probing with probe size [2048]
13:20:39 T:8036 M:1387257856 DEBUG: CDVDDemuxFFmpeg::Open - probing failed, re-probing with probe size [4096]
13:20:39 T:8036 M:1387257856 DEBUG: CDVDDemuxFFmpeg::Open - probing failed, re-probing with probe size [8192]
13:20:39 T:8036 M:1387257856 ERROR: CDVDDemuxFFmpeg::Open - error probing input format, http://dl005.zshare.net/stream/e0fa06c3aa46583713037cbe84b53d78/93296873/1314292839/QSSDivX_lap-bdtc.avi.flv//5257303228/?start=0
13:20:39 T:8036 M:1387257856 ERROR: CDVDPlayer::OpenDemuxStream - Error creating demuxer
Yet when I put this same resolved link into a STRM file it plays fine:
Code:
13:20:15 T:1740 M:1408155648 NOTICE: DVDPlayer: Opening: http://dl005.zshare.net/stream/f16aaf43283b78078c651d5ffc00de7a/93296873/1314216558/QSSDivX_lap-bdtc.avi.flv//5256998104/?start=0
13:20:15 T:1740 M:1408151552 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
13:20:15 T:2376 M:1408151552 DEBUG: thread start, auto delete: 0
13:20:15 T:2376 M:1408147456 NOTICE: Creating InputStream
13:20:15 T:2376 M:1408110592 DEBUG: CFileCache::Open - opening <stream/f16aaf43283b78078c651d5ffc00de7a/93296873/1314216558/QSSDivX_lap-bdtc.avi.flv//5256998104/> using cache
13:20:15 T:2376 M:1408110592 DEBUG: Using proxy http://mcapproxy2:8080
13:20:15 T:2376 M:1408110592 DEBUG: FileCurl::Open(036BFC70) http://dl005.zshare.net/stream/f16aaf43283b78078c651d5ffc00de7a/93296873/1314216558/QSSDivX_lap-bdtc.avi.flv//5256998104/?start=0
13:20:15 T:2376 M:1408114688 INFO: CDVDFactorySubtitle::GetSubtitles, searching subtitles
13:20:15 T:2376 M:1408110592 DEBUG: CUtil::CacheSubtitles: START
13:20:15 T:2760 M:1408110592 DEBUG: thread start, auto delete: 0
13:20:15 T:2376 M:1408110592 INFO: CDVDFactorySubtitle::GetSubtitles, searching subtitles done
13:20:15 T:2376 M:1408106496 NOTICE: Creating Demuxer
13:20:15 T:2376 M:1408081920 DEBUG: Win32DllLoader::Load(special://xbmcbin/system/players/dvdplayer/avutil-50.dll)
13:20:15 T:2376 M:1408057344 DEBUG: Win32DllLoader::Load(special://xbmcbin/system/players/dvdplayer/avcodec-52.dll)
13:20:15 T:2376 M:1407942656 DEBUG: Win32DllLoader::Load(special://xbmcbin/system/players/dvdplayer/libfaad.dll)
13:20:15 T:2376 M:1407922176 DEBUG: Win32DllLoader::Load(special://xbmcbin/system/players/dvdplayer/avformat-52.dll)
13:20:15 T:1740 M:1407807488 DEBUG: ------ Window Init (DialogBusy.xml) ------
13:20:15 T:1740 M:1407807488 INFO: Loading skin file: DialogBusy.xml
13:20:15 T:2376 M:1404284928 DEBUG: CDVDDemuxFFmpeg::Open - probing detected format [flv]
13:20:15 T:2376 M:1404252160 DEBUG: CDVDDemuxFFmpeg::Open - av_find_stream_info starting
13:20:15 T:2376 M:1404129280 DEBUG: CDVDDemuxFFmpeg::Open - av_find_stream_info finished
13:20:15 T:2376 M:1404129280 INFO: ffmpeg[948]: Input #0, flv, from 'http://dl005.zshare.net/stream/f16aaf43283b78078c651d5ffc00de7a/93296873/1314216558/QSSDivX_lap-bdtc.avi.flv//5256998104/?start=0':
Again.. something I'm missing? The url does look odd ending with '//5256998104/?start=0', but this is what I found works and is what URL Snooper reports as the file being played