I’ve been a long time user of Plex and frequent visitor to these forums…and several times I have started a plugin, but have always been side tracked by something else and never finished
I’m currently in the process of developing a Media Server plugin for SmugMug, but I have a few issues that I’m trying to solve.
Custom dialog generation
Is it possible for me to generate a custom dialog that I can use/display within my plugin ? I assume it is…but I couldn’t find any information about that. For my plugin, I want to allow a user to add multiple accounts for viewing. I planned on storing this information as a serialised JSON object within a preference field, but would obviously need a custom screen to be able add/update this info. Unless someone else has other ideas on how to achieve this ?
2.Overriding ViewMode layouts
Currently within the ‘Pictures’ layout, the ‘thumb’ size image is also used for displaying a larger preview of the selected image while the full size image is loaded in the background. SmugMug provides 8 different image sizes (ranging from 100px thumbnail to up to 1600x1200px image) and I’m allowing the user to customise what image sizes to use as the ‘thumb’ and full viewing size. The problem I’m experiencing is that what the user selects one of our thumbnail sizes to use as the ‘thumb’, the preview image ends up being stretched and obviously becomes pixelated, as below…
Also, if the image happened to be a portrait image, once the full size image has been downloaded and replaced, it seems it just overlays the original preview instead of replacing the whole element...
What I'd love to have is a 'preview' parameter on a media item (such as PhotoItem) that allows me to customise that image, but that obviously requires core functionality changes. Is there some way that I can extend/customise existing layouts through my plugin ?
David, welcome, and please PM me if you'd like an invite to our plug-in development chat room.
Right now the only sort of dialog (besides a simple input dialog used for search) is the preferences dialog. You can put lots of things in there, but lists of things is not something that is supported currently. However, you can see a way in which clever developers have worked around this in the Feed Me plug-in, which allows adding arbitrary RSS feeds.
Perhaps I'm missing the exact problem here, but the PhotoItem has a thumb= and key= element, the former of which is used for previewing and the latter for the full image. I believe that the thumbnail is replaced by the full image in the background, and perhaps that's the issue you're running into?
The problem is two fold...aesthetics and bandwidth.
Aesthetically, I think square thumbs look better than portrait or landscape thumbs...
But if I use square thumbs now, I end up with a ugly preview image until the full size image has downloaded.
From a bandwidth perspective, say I load the thumb image (thumb element) as SmugMug's medium size image (600x400px, ~65KB) and load the full size image (key element) as SmugMug's largest size (1600x1200px, ~300+KB). So for this example, say there are 10 images in the MediaContainer. Initially, it downloads 650KB as thumbs (10x65KB)...we browse through all the images, starting on each image for long enough for the full size image to be loaded in the back. So in total, we have download 3650KB of data...even though we have never viewed a single image in full resolution.
If the PhotoItem had an additional element (let's call it preview for example)..so that the preview element is loaded as below...
In this case, I load the thumb image (thumb element) as SmugMug's tiny thumbnail size (100x100px, ~6KB), load the preview image (preview element) as SmugMug's medium size image (600x400px, ~65KB) and load the full size image (key element) as SmugMug's largest size (1600x1200px, ~300+KB). The initial download is only 60KB (10x6KB) and after browsing through the MediaContainer I've only downloaded an additional 650KB (10x65KB)....710KB in total.
I’ve raised the square thumbs with the skinners, I think it makes lots of sense to crop them to square in that view.
In terms of the thumb/preview, we only maintain one entity for it at the moment. Plex is pretty agressive about caching in the background, so that may need some tweaking.
For now, though, I think if we crop the thumbs to square, you may have some of the flexibility you need (or at least you’ll get square thumbs on the left with a lower res (but correct aspect ratio) preview. Please let me know if this is not the case
ok, so I have made some good progress, using the method from the FeedMe plugin (thanks, for the pointer)...I now have Accounts working.
The only issue I have now, is when I add/remove an account, I need to exit the plugin in order to refresh the base MediaContainer...is there some other way to do this ?
if I have caching enabled for my API requests to SmugMug…is there a way that I can manually expire them from the cache, if I receive an error from SmugMug ?
Ah, excellent question. I’m not sure how to manually expire a single request, but you can set cacheTime = None so as to not cache any of the API requests.
Again, if you’d like access to our chat room which lots of pleasant, helpful people, just shoot me a PM with your email