• Gear
  • Shots
  • Photo Craft
  • Video
  • Wide Angle
  • Support
  • New Stuff
  • More
Support SmugMug APIs, Hacks & Tricks RSS parsing help - plex plugin dev

FAQtoid

Ever wanted to create an Avatar? Creating an Avatar!

Searching Dgrin with Google Searching with Google

Dgrin Challenges

Congratulations to the Winner of DSS #128 (Sunrise or Sunset), ShootingStar.

The next Dgrin Challenge DSS #129 (Silhouette Revisited ) is open for entries through May 27th, 2013 at 8:00pm PDT.

As always, we look forward to your participation but please do take a moment to read through the rules before posting your entry.

Past DSS Challenge Winners, DSS Challenge Rules, and other important DSS Challenge information is here.

Need some help with Accessories?

Tutorials

Ever find yourself wondering just how someone managed to create an image using different effects?

Here are three simple tutorials we hope will encourage you to try something new.

The Hot Seat

A lifelong interest in landscape photography has led Eyal Oren to make a study of his adopted hometown of Marblehead, MA. As you can see, his dedication is paying off!

Africa!

Dgrinners Harryb, Pathfinder, and others joined Andy Williams and Marc Muench on Safari in East Africa recently. Here are some awesome threads to check out!

 
Thread Tools Display Modes
Old Mar-26-2009, 08:07 AM
#1
klphoto is offline klphoto OP
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
Old Apr-09-2009, 08:27 AM
#2
jernomer is offline jernomer
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?
Old Apr-25-2009, 09:22 AM
#3
mtnbiker is offline mtnbiker
Major grins
please oh please...someone, this would be GREAT
__________________
http://www.jonpratt.com
Old May-01-2009, 08:30 PM
#4
devbobo is offline devbobo
technicolored
devbobo's Avatar
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.
__________________
David Parry
SmugMug API Developer
My Photos
Old May-02-2009, 07:05 AM
#5
jernomer is offline jernomer
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.
Old Mar-20-2010, 12:48 AM
#6
bobmorane is offline bobmorane
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
Old Oct-10-2011, 10:37 PM
#7
sg_is_me is offline sg_is_me
Big grins
sg_is_me's Avatar
Bump?
__________________
http://eye-m-stassi.smugmug.com
Tell The World!  

Thread Tools
Display Modes

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump