Help! How to jump from mode1 to mode2.
#1
Question 
Hello guys,


Im doing VOD plugin of a website that has few channels, but im facing a problem I couldn't solve it in 2 days, which is the plugin can't jump from index to index2 or other meaning mode==1 to mode==2.
Let me give more details, to make it clear.
So when i open the plugin it shows the CATEGORIES() for example ChannelOne,Two..etc, when i click on any of the channels, it shows the list of the TvShows, accidentally they have the same match, then when i click on any of the TvShow's name it will NOT jump to the list of TvShow's Episodes.

ChannelOne>>Series List>>Episodes , I can't jump from Series List to Episodes

Code:
def CATEGORIES():
      addDir("ChannelOne","",1,"")
      addDir( "ChannelTwo","",1,"")
      addDir( "ChannelThree","",1,"")

this is INDEX it list the Channels and the TVShows

Code:
def INDEX(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()
        match=re.compile('href="(.+?)" title=""><b><img src="(.+?)" width="" height="" border="0" alt="" /></b><span class=".+?">(.+?)</span>').findall(link)
        for url,thumbnail,name in match:
                addDir(name,url,1,thumbnail)

The INDEX2 that i have problem with will not jump to the Episodes , or can't call the INDEX above.:confused2:
Code:
def INDEX2(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()
        match=re.compile('</span><a href="(.+?)" title=""><b><img src="(.+?)" alt="" border="0" height="" width="" /><span class=".+?"></span><span class=".+?">.+?</span></b><span class=".+?">   </span><span class=".+?">.+?</span><span class=".+?">(.+?)</span>').findall(link)
        for url,thumbnail,name in match:
                addDir(name,url,2,thumbnail)

Here is the Mode
Code:
if mode==None or url==None or len(url)<1:
        print ""
        CATEGORIES()

elif mode==1:
        print ""+url
        INDEX(url)

elif mode==2:
        print ""+url
        INDEX2(url)

elif mode==3:
        print ""+url
        VIDEOLINKS(url,name)

Hope I explained it clear.
Please Can someone shows what im doing wrong.
Reply
#2
addDir(name,url,1,thumbnail)
from INDEX() should be
addDir(name,url,2,thumbnail)

I don't see your addDir function but i think thats the issue.

I would assume INDEX2() might need its mode changed for its addDir()
Reply
#3
BlueCop Wrote:addDir(name,url,1,thumbnail)
from INDEX() should be
addDir(name,url,2,thumbnail)

I don't see your addDir function but i think thats the issue.

I would assume INDEX2() might need its mode changed for its addDir()

I appreciate that BlueCop for replying,
Here is the addDir function,
Code:
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

Im following this tutorial HOW-TO:Write plugins for XBMC

If you want me to PM you the full code I will to make it more clear.

Thank you again.
Reply
#4
did changing the mode not fix it?
Reply
#5
BlueCop Wrote:did changing the mode not fix it?

Nope. :confused2:
Reply

Logout Mark Read Team Forum Stats Members Help
Help! How to jump from mode1 to mode2.0