I have been using plex for over an year and absolutely love it. I have started writing a new plugin for NDTV (an Indian News Channel) and ran into some issues. I am new to plugin development, this is my first plugin, so I am not sure what I am doing wrong. I started with an existing plugin and modified for my needs. The way it is now, when I select a video to play, plex media server dies and there is no information in the log files why it died. Below is the plugin code, hope somebody could help me figure out what I am doing wrong. I am suspecting the problem is in the site config. file.
This is still work in progress and there is some unused code and some hard coded values.
<br />
import datetime, re, pickle<br />
<br />
###################################################################################################<br />
<br />
PLUGIN_PREFIX = '/video/ndtv'<br />
BASE_URL = "http://www.ndtv.com/video/list"<br />
RSS_FEED = '%s/v/feed/playlist/%%s.xml' % BASE_URL<br />
RSS_NS = {'mvn':'http://maven.net/mcr/4.1', 'media':'http://search.yahoo.com/mrss/'}<br />
<br />
# Default artwork and icon(s)<br />
ART_DEFAULT = 'art-default.png'<br />
ICON_DEFAULT = 'icon-default.png'<br />
<br />
###################################################################################################<br />
<br />
def Start():<br />
Plugin.AddPrefixHandler(PLUGIN_PREFIX, MainMenu, 'NDTV', ICON_DEFAULT, ART_DEFAULT)<br />
<br />
Plugin.AddViewGroup('Category', viewMode='List', mediaType='items')<br />
Plugin.AddViewGroup('Details', viewMode='InfoList', mediaType='items')<br />
<br />
# Set the default MediaContainer attributes<br />
MediaContainer.title1 = 'NDTV'<br />
MediaContainer.viewGroup = 'Category'<br />
MediaContainer.art = R(ART_DEFAULT)<br />
<br />
# Set the default cache time<br />
HTTP.SetCacheTime(CACHE_1HOUR)<br />
<br />
###################################################################################################<br />
<br />
def MainMenu():<br />
dir = MediaContainer()<br />
<br />
dir.Append(Function(DirectoryItem(Playlist, title='Top Videos', thumb=R(ICON_DEFAULT)), title='Top Videos', id=1))<br />
dir.Append(Function(DirectoryItem(Playlist, title='Latest', thumb=R(ICON_DEFAULT)), title='Latest', id=2))<br />
<br />
return dir<br />
<br />
###################################################################################################<br />
<br />
def Playlist(sender, title, id):<br />
dir = MediaContainer(viewGroup='Details', title2=title)<br />
<br />
i = HTML.ElementFromURL(BASE_URL).xpath('/html/body/div[@id="contentbody"]/div[@id="contentbodywrap"]/div[@id="contentbodycont"]/div[@id="insideleftcont"]/div[@id="storybody"]/div[@id="video_thumb_list"]/ul[@id="Related"]/li')<br />
#Log(i)<br />
for item in i:<br />
title = item.xpath('./p/a')[1].text<br />
media = item.xpath('./p/a')[1].get('href')<br />
mediaurl = "http://www.ndtv.com/%s" % media<br />
Log(mediaurl)<br />
description = title<br />
<br />
dir.Append(WebVideoItem(mediaurl, title=title, subtitle='', duration=50, summary=description, thumb=R(ICON_DEFAULT)))<br />
<br />
return dir<br />
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<site site="http://www.ndtv.com//video/player/news/.*/.*"<br />
plugin="http://www.ndtv.com/news/flash/video_622x386/KKSPlayer.swf"<br />
version="1.0"><br />
<crop x="20" y="470" width="622" height="386" /><br />
</site><br />