|
|
Thread Tools | Display Modes |
|
#1
|
|
|
Big grins
|
RSS parsing help - plex plugin dev
Hi everyone,
I am trying to create a plugin for Plex media center so I and others can view my photos from Plex. Attached are two examples of python scripts that other plugins use in order to display photos by parsing through rss feeds. I was wondering if anyone could help me change one of them to work with smugmug because I haven't been able to get it to work yet. Thanks so much! Code:
from PMS import Plugin, Log, XML, HTTP, JSON, RSS, Utils
from PMS.MediaXML import MediaContainer, DirectoryItem, PhotoItem
PLUGIN_PREFIX = "/photos/JessicaClaire"
ROOT_URL = "http://www.jessicaclaire.net"
RSS_FEED = ROOT_URL + "/rss/"
####################################################################################################
def Start():
Plugin.AddRequestHandler(PLUGIN_PREFIX, HandlePhotosRequest, "Jessica Claire", "icon-default.png", "art-default.png")
Plugin.AddViewGroup("Pictures", viewMode="Pictures", contentType="photos")
####################################################################################################
def HandlePhotosRequest(pathNouns, count):
if count == 0:
dir = MediaContainer("art-default.png", None, "Jessica Claire")
for item in RSS.Parse(RSS_FEED).entries:
entry = XML.ElementFromString(item.description, True)
imgs = entry.xpath('//img')
if len(imgs) > 5:
thumb = ''
for img in imgs:
if img.get('src').find('jessicaclaire.net/images/content') != -1:
thumb = img.get('src')
summary = entry.text_content()[:400] + '...'
dir.AppendItem(DirectoryItem(Utils.EncodeStringToUrlPath(item.link)+'$'+Utils.EncodeStringToUrlPath(item.title), item.title, thumb, summary))
elif count == 1:
(url,title) = pathNouns[0].split('$')
dir = MediaContainer("art-default.png", "Pictures", "Jessica Claire", Utils.DecodeUrlPathToString(title))
count = 1
for img in XML.ElementFromURL(Utils.DecodeUrlPathToString(url), True).xpath('//img'):
if img.get('src').find('/images/content') != -1:
url = ROOT_URL + img.get('src')
dir.AppendItem(PhotoItem(url, 'Photo %d' % count, '', url))
count += 1
return dir.ToXML()
Code:
from PMS import Plugin, Log, DB, Thread, XML, HTTP, JSON, RSS, Utils
from PMS.MediaXML import MediaContainer, DirectoryItem, PhotoItem
import re
PLUGIN_PREFIX = "/photos/BraedonPhotography"
ROOT_URL = "http://braedonsblog.com"
RSS_FEED = ROOT_URL + "/feed/"
####################################################################################################
def Start():
Plugin.AddRequestHandler(PLUGIN_PREFIX, HandlePhotosRequest, "Braedon Photography", "icon-default.png", "art-default.jpg")
Plugin.AddViewGroup("Pictures", viewMode="Pictures", contentType="photos")
Plugin.AddViewGroup("Info", viewMode="InfoList", contentType="items")
####################################################################################################
def HandlePhotosRequest(pathNouns, count):
if count == 0:
dir = MediaContainer("art-default.jpg", "Info", "Braedon Photography")
for item in RSS.Parse(RSS_FEED).entries:
entry = XML.ElementFromString(item.content[0].value, True)
imgs = entry.xpath('//img')
Log.Add(imgs)
if len(imgs) >= 1:
thumb = ''
for img in imgs:
if img.get('src').find('http://braedonsblog.com/wp-content/uploads') != -1:
thumb = img.get('src')
dir.AppendItem(DirectoryItem(Utils.EncodeStringToUrlPath(item.link)+'$'+Utils.EncodeStringToUrlPath(item.title), item.title, thumb, item.description))
elif count == 1:
(url,title) = pathNouns[0].split('$')
dir = MediaContainer("art-default.pngg", "Pictures", "Braedon Photography", Utils.DecodeUrlPathToString(title))
count = 1
for img in XML.ElementFromURL(Utils.DecodeUrlPathToString(url), True).xpath('//img'):
if img.get('src').find('/wp-content/uploads') != -1:
url = img.get('src')
dir.AppendItem(PhotoItem(url, 'Photo %d' % count, '', url))
count += 1
return dir.ToXML()
__________________
www.kylelamyphoto.com |
|
|
|
|
#2
|
|
|
Big grins
|
Hi,
I've been trying to do the same thing! Unfortunately, I have no previous experience doing anything like this. I managed to get a plugin into Plex that show my recent photos (displaying the 'Original' size) by using the Chromasia plugin as a guide. It doesn't look that great (or very good, for that matter), but my photos do show up on my TV. It would be great if a general SmugMug plugin for Plex could be developed - I'm sure it would be better than the 'Recent Photo' feed I'm using right now. For one, I'd like to be able to browse my galleries. I put in a request on the Plex forums for a SmugMug plugin, but I don't think there are any takers. Any interest in giving it a go? |
|
|
|
|
#3
|
|
|
Major grins
|
please oh please...someone, this would be GREAT
__________________
http://www.jonpratt.com |
|
|
|
|
#4
|
|
|
technicolored
|
I recently started running a Mac Mini (with Plex) as my media server, so having a plugin is something that I really want.
I started playing around with the Plex plugins for the first time last night and made some good progress. Not sure how long it will take to get a plugin fully up and running...but i'm excited with what i have so far. ![]() Right now I only list galleries with no category/subcategory architecture, but that's definitely something I want. |
|
|
|
|
#5
|
|
|
Big grins
|
Hi David,
I'm looking forward to seeing what you've come up with. You should consider creating a SmuMug page over on the Plex wiki: http://wiki.plexapp.com/index.php/Plugin_development Also, while I don't have coding experience, I've done some testing for other Plex plugins, so let me know if you want any help in that regard. Cheers. |
|
|
|
|
#6
|
|
|
Beginner grinner
|
Hi,
Did someone finally achieve this ?
The plex appstore provides picasa or flickr plugins, that would be awesome to have a smugmug one... thanks |
|
|
|
|
#7
|
|
|
Big grins
|
Bump?
__________________
http://eye-m-stassi.smugmug.com |
|
|
|
| Tell The World! | |
| Thread Tools | |
| Display Modes | |
|
|