Hi,
I’m working on my first Plex plug-in and thought I would do an easy scrape of SomaFM’s site. The plan is to create a simple list of TrackItems which correspond to each station. Simple enough. I have everything working except the thumb for each TrackItem is exactly the same. I have no idea what’s going on here. If I change them to DirectoryItems (just to test) the thumbs are different.
Here’s the code I have for creating the items:
def MusicMainMenu():<br />
<br />
# Container acting sort of like a folder on<br />
# a file system containing other things like<br />
# "sub-folders", videos, music, etc<br />
# see:<br />
# http://dev.plexapp.com/docs/Objects.html#MediaContainer<br />
dir = MediaContainer(viewGroup="InfoList")<br />
<br />
<br />
root = XML.ElementFromURL(SOMAFM_BASE_URL, isHTML=True)<br />
Log(root)<br />
<br />
for liList in root.xpath("//div[@id='stations']/ul/li"):<br />
#Log(liList.xpath("h3")[0].text_content())<br />
name = liList.xpath("h3")[0].text_content()<br />
#Log(liList.xpath("p/a")[0].get('href'))<br />
url = SOMAFM_BASE_URL + liList.xpath("p/a")[0].get('href').replace('play/', '') + '.pls'<br />
#Log(url)<br />
#Log(liList.xpath("p/a/img")[0].get('src'))<br />
thumb = SOMAFM_BASE_URL + liList.xpath("p/a/img")[0].get('src').strip()<br />
Log('|' + thumb + '|');<br />
subtitle = liList.xpath("p[@class='descr']")[0].text_content();<br />
item = TrackItem(url, name, subtitle=subtitle, thumb=thumb)<br />
dir.Append(item)<br />
<br />
<br />
# ... and then return the container<br />
return dir
Does anyone have any idea what's wrong here?
Thanks!