I am busy with creating a plugin for Break.com
I am quite new with python and plugins and it all went pretty good untill I came to the xml and xpath section.
Can anyone please tell me what i am doing wrong and why the plugin won’t showup in plex any more?
This is what I brought up so far…
from PMS import *<br />
from PMS.Objects import *<br />
from PMS.Shortcuts import *<br />
<br />
VIDEO_TITLE = 'Break.com'<br />
VIDEO_PREFIX = '/video/break'<br />
BREAK_ROOT = 'http://www.break.com'<br />
BREAK_NEWEST = 'http://www.break.com/videos/newest/'<br />
BREAK_MVDAILY = 'http://www.break.com/videos/most-viewed-daily/'<br />
BREAK_MVWEEKLY = 'http://www.break.com/videos/most-viewed-weekly/'<br />
BREAK_MVMONTHLY = 'http://www.break.com/videos/most-viewed-monthly/'<br />
BREAK_MVALLTIME = 'http://www.break.com/videos/most-viewed/'<br />
BREAK_TRDAILY = 'http://www.break.com/videos/top-rated-daily/'<br />
BREAK_TRWEEKLY = 'http://www.break.com/videos/top-rated-weekly/'<br />
BREAK_TRMONTHLY = 'http://www.break.com/videos/top-rated-monthly/'<br />
BREAK_TRALLTIME = 'http://www.break.com/videos/top-rated/'<br />
BREAK_MDDAILY = 'http://www.break.com/videos/most-discussed-daily/'<br />
BREAK_MDWEEKLY = 'http://www.break.com/videos/most-discussed-weekly/'<br />
BREAK_MDMONTHLY = 'http://www.break.com/videos/most-discussed-monthly/'<br />
BREAK_MDALLTIME = 'http://www.break.com/videos/most-discussed/'<br />
BREAK_MSDAILY = 'http://www.break.com/videos/most-shared-daily/'<br />
BREAK_MSWEEKLY = 'http://www.break.com/videos/most-shared-weekly/'<br />
BREAK_MSMONTHLY = 'http://www.break.com/videos/most-shared-monthly/'<br />
BREAK_MSALLTIME = 'http://www.break.com/videos/most-shared/'<br />
<br />
XPATH_VIDEOS = '//div[@class='cat-cnt-item-th']'<br />
<br />
ART = 'art-back.png'<br />
ICON = 'icon-main.png'<br />
<br />
<br />
####################################################################################################<br />
<br />
def Start():<br />
<br />
Plugin.AddPrefixHandler(VIDEO_PREFIX, MainMenu, "Break.com", ICON, ART)<br />
<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
Plugin.AddViewGroup("List", viewMode="List", mediaType="items")<br />
<br />
MediaContainer.art = R('art-default.png')<br />
MediaContainer.title1 = "BREAK Videos"<br />
DirectoryItem.thumb = R('icon-default.png')<br />
<br />
####################################################################################################<br />
<br />
def MainMenu():<br />
<br />
dir = MediaContainer(viewGroup="InfoList")<br />
<br />
dir.Append(Function(DirectoryItem(Video, "Newest",thumb=R(ICON),art=R(ART)), title="Newest", url=BREAK_NEWEST))<br />
<br />
dir.Append(Function(DirectoryItem(Video, "Most Viewed Daily",thumb=R(ICON),art=R(ART)), title="Most Viewed Daily", url=BREAK_MVDAILY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Viewed Weekly",thumb=R(ICON),art=R(ART)), title="Most Viewed Weekly", url=BREAK_MVWEEKLY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Viewed Monthly",thumb=R(ICON),art=R(ART)), title="Most Viewed Monthly", url=BREAK_MVMONTHLY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Viewed All Time",thumb=R(ICON),art=R(ART)), title="Most Viewed All Time", url=BREAK_MVALLTIME))<br />
<br />
dir.Append(Function(DirectoryItem(Video, "Top Rated Daily",thumb=R(ICON),art=R(ART)), title="Top Rated Daily", url=BREAK_TRDAILY))<br />
dir.Append(Function(DirectoryItem(Video, "Top Rated Weekly",thumb=R(ICON),art=R(ART)), title="Top Rated Weekly", url=BREAK_TRWEEKLY))<br />
dir.Append(Function(DirectoryItem(Video, "Top Rated Monthly",thumb=R(ICON),art=R(ART)), title="Top Rated Monthly", url=BREAK_TRMONTHLY))<br />
dir.Append(Function(DirectoryItem(Video, "Top Rated All Time",thumb=R(ICON),art=R(ART)), title="Top Rated All Time", url=BREAK_TRALLTIME))<br />
<br />
dir.Append(Function(DirectoryItem(Video, "Most Discussed Daily",thumb=R(ICON),art=R(ART)), title="Most Discussed Daily", url=BREAK_MDDAILY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Discussed Weekly",thumb=R(ICON),art=R(ART)), title="Most Discussed Weekly", url=BREAK_MDWEEKLY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Discussed Monthly",thumb=R(ICON),art=R(ART)), title="Most Discussed Monthly", url=BREAK_MDMONTHLY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Discussed All Time",thumb=R(ICON),art=R(ART)), title="Most Discussed All Time", url=BREAK_MDALLTIME))<br />
<br />
dir.Append(Function(DirectoryItem(Video, "Most Shared Daily",thumb=R(ICON),art=R(ART)), title="Most Shared Daily", url=BREAK_MSDAILY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Shared Weekly",thumb=R(ICON),art=R(ART)), title="Most Shared Weekly", url=BREAK_MSWEEKLY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Shared Monthly",thumb=R(ICON),art=R(ART)), title="Most Shared Monthly", url=BREAK_MSMONTHLY))<br />
dir.Append(Function(DirectoryItem(Video, "Most Shared All Time",thumb=R(ICON),art=R(ART)), title="Most Shared All Time", url=BREAK_MSALLTIME))<br />
<br />
return dir<br />
<br />
####################################################################################################<br />
<br />
def Video(sender, title, url):<br />
<br />
dir = MediaContainer(title3=title, art=R(ART), viewGroup="InfoList")<br />
<br />
videos = XML.ElementFromURL(url, isHTML=True, errors='ignore').xpath(XPATH_VIDEOS)<br />
for content in videos:<br />
title = content.xpath("a/img/span")[0].txt<br />
thumb = content.xpath("/a/img")[0].get('src')<br />
url = content.xpath("/a")[0].get('href')<br />
<br />
dir.Append(Function(DirectoryItem(VideoFile, "Test", thumb=thumb), title=title, url=url))<br />
<br />
return dir<br />
<br />
####################################################################################################<br />
<br />
def VideoFile(sender, title, url):<br />
<br />
dir = MediaContainer(viewGroup="InfoList")<br />
<br />
return MessageContainer("Test")