Kodi Community Forum

Full Version: still working hard need help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
still working hard on the script had good feed back from the beta i need some help i have no idea about python but have spent the last 2 days thats 2 days i have known python strait trying to get this plugin to work i have it playing live streams torrents sopcast acestream i cheered when i got them going youtube there all work fine the only thing i cant get working is the urlresolver could someone take a look at my script please this final stage once done i can finish the site then anybody who wants there own plugin can create one at a few clicks of a mouse please try for yourself http://pipcan.info/register.php of go pipcan.info

login: aa
pass:aa

Have tryed every combination every location before and after evrything
urlresolver.resolve()
media_url = urlresolver.resolve(web_url)
HostedMediaFile(url='http://movreel.com/ABC123XYZ') [/b]
no luck

just want links that come from vh.php?u= to be resolved

THANKS IN ADVANCED

Code:
import xbmc,xbmcplugin,xbmcgui,xbmcaddon,xbmcvfs

import urllib,urllib2,re,os,sys,htmllib,string,StringIO,logging,random,array,time,datetime,copy,HTMLParser,htmlentitydefs,urlresolver

BASE = "http://pipcan.info/"
def CATEGORIES():
        addDir('Video Hosted Files ','vh.php?u=a',1,'')
        addDir('live Streams ','ls.php?u=a',1,'')
        addDir('torrent ','to.php?u=a',1,'')
        addDir('YouTube ','yt.php?u=a',1,'')
        addDir('Search','browse.php?q=',1,'')
        
                      
def INDEX(url):
    if url=="browse.php?q=":
      searchString = addSearch()
      url="browse.php?q="+searchString
    after = url
    url = BASE + url
        req = urllib2.Request(url)
        req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()
    try:
      appdg = after.split('&')[1]
      before = after.split('&')[0]
      appdg = int(appdg.split('=')[1]) + 1
      newURL = before + "" + str(appdg)
    except:
      newURL = after + ""
      appdg = 2
    

        match=re.compile('<a href="(.+?)"><img class="thumbnail_image" src="(.+?)" alt="(.+?)"').findall(link)
        for url,thumbnail,name, in match:
      req = urllib2.Request(url)
      req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
      response = urllib2.urlopen(req)
      link=response.read()
      response.close()
      match=re.compile('file: "(.+?)",').findall(link)
      for url in match:
                addLink(name,url,thumbnail,"")
          match=re.compile('src="http://www.youtube.com/embed/(.+?)?rel=0').findall(link)
          for url in match:
        youtubeurl = 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % url
        addLink(name,youtubeurl,thumbnail,"")
          match=re.compile('acestream: "acestream://(.+?)",').findall(link)
          for url in match:
        acestream = 'plugin://plugin.video.p2p-streams/?url=acestream://%s&mode=1&name=Acestream' % url
        addLink(name,acestream,thumbnail,"")
          match=re.compile('torrent: "(.+?).torrent",').findall(link)
          for url in match:
        torrent = 'plugin://plugin.video.p2p-streams/?url=http://%s.torrent&mode=1&name=Acestream' % url
        addLink(name,torrent,thumbnail,"")        
          match=re.compile('sop: "sop://(.+?)",').findall(link)
          for url in match:
        sop = 'plugin://plugin.video.p2p-streams/?url=sop://%s&mode=2&name=title+sopcast' % url
        addLink(name,sop,thumbnail,"")
        
def VIDEOLINKS(url,name):
        req = urllib2.Request(url)
        req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()
        match=re.compile('file: "(.+?)",').findall(link)
        for url in match:
                addLink(name,url,'',"")
        
        
    [b]    urlresolver.resolve()                                      [b]Have tryed every combination every location before and after evrything[/b]
        media_url = urlresolver.resolve(web_url)                                          
        HostedMediaFile(url='http://movreel.com/ABC123XYZ') [/b]
                
def get_params():
        param=[]
        paramstring=sys.argv[2]
        if len(paramstring)>=2:
                params=sys.argv[2]
                cleanedparams=params.replace('?','')
                if (params[len(params)-1]=='/'):
                        params=params[0:len(params)-2]
                pairsofparams=cleanedparams.split('&')
                param={}
                for i in range(len(pairsofparams)):
                        splitparams={}
                        splitparams=pairsofparams[i].split('=')
                        if (len(splitparams))==2:
                                param[splitparams[0]]=splitparams[1]
                                
        return param

def addLink(name,url,iconimage,urlType):
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        liz.setProperty('IsPlayable','true')
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
        return ok

def addSearch():
    searchStr = ''
    keyboard = xbmc.Keyboard(searchStr, 'Search')
    keyboard.doModal()
    if (keyboard.isConfirmed()==False):
      return
    searchStr=keyboard.getText()
    if len(searchStr) == 0:
      return
    else:
      return searchStr

def addDir(name,url,mode,iconimage):
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
        return ok
        
              
params=get_params()
url=None
name=None
mode=None

try:
        url=urllib.unquote_plus(params["url"])
except:
        pass
try:
        name=urllib.unquote_plus(params["name"])
except:
        pass
try:
        mode=int(params["mode"])
except:
        pass

print "Mode: "+str(mode)
print "URL: "+str(url)
print "Name: "+str(name)

if mode==None or url==None or len(url)<1:
        print ""
        CATEGORIES()
      
elif mode==1:
        print ""+url
        INDEX(url)
        
elif mode==2:
        print ""+url
        addSearch()



xbmcplugin.endOfDirectory(int(sys.argv[1]))

watch gallery
come on guys the tutorial give me these snippets to go with have read the tutorial but cant make head no tail of it just feel like in the right order they will work trial and error is how i got the torrent to work why could it not be easy like below

Example
match=re.compile('file: "http://(host)/(media_id)",').findall(link)
for url in match:
url = 'plugin://script.urlresolver/?url=http://%s&mode=1&name=Host' % url
addLink(name,url,thumbnail,"")





puzzle 1

Code:
import urlresolver
media_url = urlresolver.resolve(web_url)

puzzle 2

Code:
HostedMediaFile(url='http://youtube.com/watch?v=ABC123XYZ')

puzzle3

Code:
stream_url = HostedMediaFile(host='youtube.com', media_id='ABC123XYZ').resolve()

puzzle 4

Code:
if HostedMediaFile('http://youtube.com/watch?v=ABC123XYZ').valid_url():
    print 'resolvable!'

if HostedMediaFile('http://youtube.com/watch?v=ABC123XYZ'):
    print 'resolvable!

puzzle 5

Code:
sources = [HostedMediaFile(url='http://youtu.be/VIDEOID', title='Youtube [verified] (20 views)'),
           HostedMediaFile(url='http://putlocker.com/file/VIDEOID', title='Putlocker (3 views)')]
        source = urlresolver.choose_source(sources)
        if source:
                stream_url = source.resolve()
                addon.resolve_url(stream_url)
        else:
                addon.resolve_url(False)



I Have this where do they go

Code:
import xbmc,xbmcplugin,xbmcgui,xbmcaddon,xbmcvfs

import urllib,urllib2,re,os,sys,htmllib,string,StringIO,logging,random,array,time,datetime,copy,HTMLParser,htmlentitydefs,urlresolver

BASE = "http://pipcan.info/"
def CATEGORIES():
        addDir('Video Hosted Files ','vh.php?u=a',1,'')
        addDir('live Streams ','ls.php?u=a',1,'')
        addDir('torrent ','to.php?u=a',1,'')
        addDir('YouTube ','yt.php?u=a',1,'')
        addDir('Search','browse.php?q=',1,'')
        
                      
def INDEX(url):
    if url=="browse.php?q=":
      searchString = addSearch()
      url="browse.php?q="+searchString
    after = url
    url = BASE + url
        req = urllib2.Request(url)
        req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()
    try:
      appdg = after.split('&')[1]
      before = after.split('&')[0]
      appdg = int(appdg.split('=')[1]) + 1
      newURL = before + "" + str(appdg)
    except:
      newURL = after + ""
      appdg = 2
    

        match=re.compile('<a href="(.+?)"><img class="thumbnail_image" src="(.+?)" alt="(.+?)"').findall(link)
        for url,thumbnail,name, in match:
      req = urllib2.Request(url)
      req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
      response = urllib2.urlopen(req)
      link=response.read()
      response.close()
      match=re.compile('file: "(.+?)",').findall(link)
      for url in match:
                addLink(name,url,thumbnail,"")
          match=re.compile('src="http://www.youtube.com/embed/(.+?)?rel=0').findall(link)
          for url in match:
        youtubeurl = 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % url
        addLink(name,youtubeurl,thumbnail,"")
          match=re.compile('acestream: "acestream://(.+?)",').findall(link)
          for url in match:
        acestream = 'plugin://plugin.video.p2p-streams/?url=acestream://%s&mode=1&name=Acestream' % url
        addLink(name,acestream,thumbnail,"")
          match=re.compile('torrent: "(.+?).torrent",').findall(link)
          for url in match:
        torrent = 'plugin://plugin.video.p2p-streams/?url=http://%s.torrent&mode=1&name=Acestream' % url
        addLink(name,torrent,thumbnail,"")        
          match=re.compile('sop: "sop://(.+?)",').findall(link)
          for url in match:
        sop = 'plugin://plugin.video.p2p-streams/?url=sop://%s&mode=2&name=title+sopcast' % url
        addLink(name,sop,thumbnail,"")
        
def VIDEOLINKS(url,name):
        req = urllib2.Request(url)
        req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()
        match=re.compile('file: "(.+?)",').findall(link)
        for url in match:
                addLink(name,url,'',"")
        

                
def get_params():
        param=[]
        paramstring=sys.argv[2]
        if len(paramstring)>=2:
                params=sys.argv[2]
                cleanedparams=params.replace('?','')
                if (params[len(params)-1]=='/'):
                        params=params[0:len(params)-2]
                pairsofparams=cleanedparams.split('&')
                param={}
                for i in range(len(pairsofparams)):
                        splitparams={}
                        splitparams=pairsofparams[i].split('=')
                        if (len(splitparams))==2:
                                param[splitparams[0]]=splitparams[1]
                                
        return param

def addLink(name,url,iconimage,urlType):
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        liz.setProperty('IsPlayable','true')
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
        return ok

def addSearch():
    searchStr = ''
    keyboard = xbmc.Keyboard(searchStr, 'Search')
    keyboard.doModal()
    if (keyboard.isConfirmed()==False):
      return
    searchStr=keyboard.getText()
    if len(searchStr) == 0:
      return
    else:
      return searchStr

def addDir(name,url,mode,iconimage):
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
        return ok
        
              
params=get_params()
url=None
name=None
mode=None

try:
        url=urllib.unquote_plus(params["url"])
except:
        pass
try:
        name=urllib.unquote_plus(params["name"])
except:
        pass
try:
        mode=int(params["mode"])
except:
        pass

print "Mode: "+str(mode)
print "URL: "+str(url)
print "Name: "+str(name)

if mode==None or url==None or len(url)<1:
        print ""
        CATEGORIES()
      
elif mode==1:
        print ""+url
        INDEX(url)
        
elif mode==2:
        print ""+url
        addSearch()



xbmcplugin.endOfDirectory(int(sys.argv[1]))
Used it for a couple of da. it has, for me, lots of potentiality.
really simple and fast to set.
can collect several kind of videos for different services and create your own addon.
able to share your streams with friends and relatives that aren't to expert to do the job itself.
hope someone would help to complete the urlresolver side.
Peppe
This is awesome work pipcan!
Once the majority of the coding work is done and you are happy with the system i will be helping by doing some documentation.
For others, this is a great way of being able to feed multiple sources of media into your (or someone elses) XBMC / Kodi.

The interface is great and clean and with a few more days work i imagine will be extremely polished.
Pipcan has done an amazing bit of work here and with the contribs of a few others this could help a lot of people out.

I will defintely be using this with my record label to help get media onto peoples tele's!

Said it lots already and im sure i'll say it another 20 times, but thanks pipcan, this is great work!
updates

  • Added panel from when the script is avalible for download features inclued creating help text iin easy steps edit users allow uploads file exstentions put admin message to header
  • mailbox now up and running to message each other
  • file storage now availible
  • site settings has been updated

XBMC ADDON CHANGES
  • search now workes
  • now adds you creaated catagorys to script
  • able to upload .m3u to site is readble by plugin
  • llive streams have option to show online or offline to stream in real time

see for yourself at pipcan.info
watch gallery
[/size]
Great work mate!
i'm going to try.
Peppe
thank you for you post hope your enjoying the website
another 12 hours wasted on the stupid urlresolver and no close to getting anything to resolve edit site for hour then back to copying and pasting different combination of any ideas anyone

Code:
import urlresolver

stream_url = urlresolver.resolve(web_url)

if stream_url:
    xbmcplugin.setResolvedUrl(plugin_handle, True,
                              xbmcgui.ListItem(path=stream_url))
else:
    xbmcplugin.setResolvedUrl(plugin_handle, False,
                              xbmcgui.ListItem())


Code:
sources = []
    media = urlresolver.HostedMediaFile(host=host, media_id=linkid, title='Some Host')
    sources.append(media)

    source = urlresolver.choose_source(sources)
    if source:
        stream_url = source.resolve()
    else:
        stream_url = False
      
    #Play the stream
    if stream_url:
        addon.resolve_url(stream_url)


Code:
filtered_list = urlresolver.filter_source_list(host_list)

Code:
stream_url = urlresolver.resolve(url)
Keep up the hard work friend. Hope help isnt hard to find....
thanks mate





ok url resolver loading but it strats to resolve but at the end it dose nothing and it wont show list it just resolves every link



Code:
import xbmc,xbmcplugin,xbmcgui,xbmcaddon,xbmcvfs

import urllib,urllib2,re,os,sys,htmllib,string,StringIO,logging,random,array,time,datetime,copy,HTMLParser,htmlentitydefs,urlresolver

BASE = "http://pipcansolutions.com/"
def CATEGORIES():
        addDir('helo ','cata.php?cat=helo&u=mm',1,'')
        addDir('Video Hosted Files ','vh.php?u=mm',1,'')
        addDir('live Streams ','ls.php?u=mm',1,'')
        addDir('torrent ','to.php?u=mm',1,'')
        addDir('YouTube ','yt.php?u=mm',1,'')
        addDir('Search','browse.php?q=',1,'')
        
                      
def INDEX(url):
    if url=="browse.php?q=":
      searchString = addSearch()
      url="browse.php?u=mm&q="+searchString
    after = url
    url = BASE + url
        req = urllib2.Request(url)
        req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()
    try:
      appdg = after.split('&')[1]
      before = after.split('&')[0]
      appdg = int(appdg.split('=')[1]) + 1
      newURL = before + "" + str(appdg)
    except:
      newURL = after + ""
      appdg = 2
    

        match=re.compile('<a href="(.+?)"><img class="thumbnail_image" src="(.+?)" alt="(.+?)"').findall(link)
        for url,thumbnail,name, in match:
      req = urllib2.Request(url)
      req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
      response = urllib2.urlopen(req)
      link=response.read()
      response.close()
      match=re.compile('file: "(.+?)",').findall(link)
      for url in match:
                listitem = urlresolver.HostedMediaFile(url).resolve()
          match=re.compile('src="http://www.youtube.com/embed/(.+?)?rel=0').findall(link)
          for url in match:
        youtubeurl = 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % url
        addLink(name,youtubeurl,thumbnail,"")
          match=re.compile('acestream: "acestream://(.+?)",').findall(link)
          for url in match:
        acestream = 'plugin://plugin.video.p2p-streams/?url=acestream://%s&mode=1&name=Acestream' % url
        addLink(name,acestream,thumbnail,"")
          match=re.compile('torrent: "(.+?).torrent",').findall(link)
          for url in match:
        torrent = 'plugin://plugin.video.p2p-streams/?url=http://%s.torrent&mode=1&name=Acestream' % url
        addLink(name,torrent,thumbnail,"")        
          match=re.compile('sop: "sop://(.+?)",').findall(link)
          for url in match:
        sop = 'plugin://plugin.video.p2p-streams/?url=sop://%s&mode=2&name=title+sopcast' % url
        addLink(name,sop,thumbnail,"")
        
def VIDEOLINKS(url,name):
        req = urllib2.Request(url)
        req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()
        match=re.compile('file: "(.+?)",').findall(link)
        for url in match:
           addlink = urlresolver.resolve(url)
        
def STREAM(stream_url):
               import urlresolver
               req = urllib2.Request(stream_url)
               req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
               stream_url = urlresolver.resolve(web_url)
               print streamlink
               addLink(stream_url,"")

                
def get_params():
        param=[]
        paramstring=sys.argv[2]
        if len(paramstring)>=2:
                params=sys.argv[2]
                cleanedparams=params.replace('?','')
                if (params[len(params)-1]=='/'):
                        params=params[0:len(params)-2]
                pairsofparams=cleanedparams.split('&')
                param={}
                for i in range(len(pairsofparams)):
                        splitparams={}
                        splitparams=pairsofparams[i].split('=')
                        if (len(splitparams))==2:
                                param[splitparams[0]]=splitparams[1]
                                
        return param

def addLink(name,url,iconimage,urlType):
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        liz.setProperty('IsPlayable','true')
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
        return ok

def addSearch():
    searchStr = ''
    keyboard = xbmc.Keyboard(searchStr, 'Search')
    keyboard.doModal()
    if (keyboard.isConfirmed()==False):
      return
    searchStr=keyboard.getText()
    if len(searchStr) == 0:
      return
    else:
      return searchStr

def addDir(name,url,mode,iconimage):
        u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
        return ok
        
              
params=get_params()
url=None
name=None
mode=None

try:
        url=urllib.unquote_plus(params["url"])
except:
        pass
try:
        name=urllib.unquote_plus(params["name"])
except:
        pass
try:
        mode=int(params["mode"])
except:
        pass

print "Mode: "+str(mode)
print "URL: "+str(url)
print "Name: "+str(name)

if mode==None or url==None or len(url)<1:
        print ""
        CATEGORIES()
      
elif mode==1:
        print ""+url
        INDEX(url)
        
elif mode==2:
        print ""+url
        addSearch()



xbmcplugin.endOfDirectory(int(sys.argv[1]))
Video is listed as private?

I had problems with URLRESOLVER, had removed it, will put it back in see if i still have issues
try now mate
i have like 1000 views between my asks for help, and not one solution, reason why, or advice in the right direction. to be honest starting to think is there anyone out there. I E-mailed the admin's of xbmc in a unrelated question. and guess what silence i see between xbmc suprrepo and tvaddons i count 1118 video addon's to choose from. There are 1,668 people who have viewed this forum in the last 15 mins. are you telling me that out of all them people not one person whats to say "urlresolver goes on this line" or something i am making this script for everyone, to allow everyone, to share. there own content. between whoever they want some people will never use it some people might but intill someone has that knows where i am to put the dam urlreslover in my script im sure the answer is up there already posted. still i am asking one more time for someone to give me a push in the right direction i have been at it 4 days runiing 12 hours a day so no one message search google so i await a reply
Pages: 1 2 3 4