Title says it all, if I try to execute a command Resource.ExternalPath('icon+test.png') (or R('icon+test.png') for short) this is what I get in my logs and image does not show:
@shopgirl284 no, it does not work either. Whether usePlus is set to True or False it returns same icon%2Btest.png, and R(String.Quote('icon+test.png', usePlus = False)) gives me same as R('icon%2Btest.png'), nothing
@Cigaras
is it possible for you to use Core.bundle_path? Then you are not limited by the sandbox-restrictions of the resourcekit and the suggestions @shopgirl284 and @czukowski should work.
PlexPluginCodePolicy in Info.plist must be set (Elevated).
/R
The Server logs the right path: url => http://127.0.0.1:32400/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/StreamTest.bundle/Contents/Resources/ico+n.png'
but logs then an 404-Error: Completed: [192.168.0.100:51532] 404 GET /photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Fvar%2Flib%2Fplexmediaserver%2FLibrary%2FApplication%20Support%2FPlex%20Media%20Server%2FPlug-ins%2FStreamTest.bundle%2FContents%2FResources%2Fico%2Bn.png&width=150&height=150&minSize=1 (8 live) GZIP 1ms 379 bytes (pipelined: 9)
@rols1
Is using a full path in URL like that some kind of feature I haven’t known about before? If it is, that seems pretty unsafe to me because anything on your computer may be accessible. Although 404 error indicates that it’s not working that way.
Anyway, from the OP, it seems like Plex framework code is converting plus sign to space, but I’ve read somewhere that plus is reserved for space only in URL query part, which filename quite isn’t. Therefore it appears like there’s a bug with URL decoding in Plex framework. It could still be decoding %2B correctly, but Resource.ExternalPath won’t return it.
@Cigaras
Have you tried something like R('icon+test.png').replace('+', '%2B')? If Plex does indeed urldecode correctly (other than the plus sign), it might be just what’s needed to generate the working URL.
My idea to use Core-functions comes from the updater-modules , because many of them uses Core.storage.save() to put the zip-data into Plugin-directory. My next idea: if this would works, we could store the loaded icon-data with an acceptable filename und use it in the normal way with R(icon).
But my last tests shows, that I’m not able (until yet) to load the binary data of a icon in the Resource-directory.
Core.storage.load() fails and HTTP.Request("%s/:/plugins/%s/%s" % (myhost, myplugin, icon_path), immediate=True).content also fails.
@Cigaras
it’s more easier than i thought:
I only copy the icon to an icon with a ‘normal’ name (import shutil is needed for this solution). This happens inside Resources-directory of Plugin: