Hi,
I installed the new version on a Mac OS X 10.9.4 and it is not working. I get "This Channel is not responding" answer when I try to lock the section. It still works with the scripts that I have in the applications folder.
Hi,
I installed the new version on a Mac OS X 10.9.4 and it is not working. I get "This Channel is not responding" answer when I try to lock the section. It still works with the scripts that I have in the applications folder.
Hi,
I installed the new version on a Mac OS X 10.9.4 and it is not working. I get "This Channel is not responding" answer when I try to lock the section. It still works with the scripts that I have in the applications folder.
Will investigate, thank you for trying it out and sharing feedback. Pl. use the "Mac OS X" option to generate the plugin from here it will work for OS X 10.9.4. Thank you once again for trying it out, I felt there might have been something wrong but couldn't be sure, till now!
Excellent now it works like a charm !!!
Ok, testing under linux.
It doesn't seem to work correctly on my end, here's what happens:
I threw debug logging up but I don't see a viable cause from that - running the script by hand works though.
I didn't have more time this morning to play with it unfortunately - ideas about where else should I look are welcome.
General thoughts:
The 777 permission won't be something linux folks like a lot (777 similarly to 666 is from the devil). The best way to approach the right permission set is:
1. Change owner on the lock.bundle directory to the user you use to run plex with, i.e chown -R plex:users Lock.bundle
2. Make sure the following files are executable: chmod 750 Contents/Code/__init__.py Contents/Resources/lock_support/*
3. Your scripts look quite static - at least the os.path.expanduser in lock.js doesn't resolve to what my server has as config. They expect library content to be under /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Lock.bundle/Contents/Resources/lock_support/ - this is not always the case.
Two ways around it:
a. Get the location from Plex - probably not the right way but when I hit /system/help the exception being thrown reveals my PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR. This sounds like an easy way to get that extra information with the JS
b. Get the user to feed that in manually (i.e. get config options in the scripts)
In my struggle I rewrote the scripts to a single one, pasting here in case you want to consider a single param'd script call with standalone SQL files:
#!/bin/bashpiLoc=
dirname "$(realpath $0)"
dbLoc=echo "$piLoc"|sed 's#/Plug-ins/.*#/Plug-in Support/Databases/com.plexapp.plugins.library.db#'
function err { echo “ERROR: $1”; exit 1; }if [[ $1 == “lock” && -f “$piLoc/sqlite3” && -f “$piLoc/lock.sql” && -f “$dbLoc” ]]; then
“$piLoc/sqlite3” “$dbLoc” < “$piLoc/lock.sql” || err “error locking section(s)”;
elif [[ $1 == “unlock” && -f “$piLoc/sqlite3” && -f “$piLoc/unlock.sql” && -f “$dbLoc” ]]; then
“$piLoc/sqlite3” “$dbLoc” < “$piLoc/unlock.sql” || err “error unlocking section(s)”;
else err “Check if you use lock/unlock param and files exist. I’ve got: “$piLoc/sqlite3”, “$piLoc/unlock.sql”, “$dbLoc””
fiexit 0;
This way you can ditch the BASEPATHLOCK and BASEPATHUNLOCK and use a BASEPATHLOCKSCRIPT or something instead with a lock or unlock parameter.
Thanks,
M
Ok, testing under linux.
- 3.12.0-sabayon #1 SMP Mon Aug 4 02:37:12 UTC 2014 x86_64 Intel(R) Atom(TM) CPU D525 @ 1.80GHz GenuineIntel GNU/Linux
- Sabayon Linux amd64 14.09 (Gentoo Base System release 2.2)
It doesn't seem to work correctly on my end, here's what happens:I threw debug logging up but I don't see a viable cause from that - running the script by hand works though.
- Over the web interface I see no unlock button, only lock - reading your previous comments this may be normal.
- Using plex theatre on Mac shows both lock/unlock, but they just won't lock. If I lock manually (i.e. executing the SQL from a script), it won't unlock either.
I didn't have more time this morning to play with it unfortunately - ideas about where else should I look are welcome.
General thoughts:
The 777 permission won't be something linux folks like a lot (777 similarly to 666 is from the devil). The best way to approach the right permission set is:
1. Change owner on the lock.bundle directory to the user you use to run plex with, i.e chown -R plex:users Lock.bundle
2. Make sure the following files are executable: chmod 750 Contents/Code/__init__.py Contents/Resources/lock_support/*
3. Your scripts look quite static - at least the os.path.expanduser in lock.js doesn't resolve to what my server has as config. They expect library content to be under /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Lock.bundle/Contents/Resources/lock_support/ - this is not always the case.
Two ways around it:
a. Get the location from Plex - probably not the right way but when I hit /system/help the exception being thrown reveals my PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR. This sounds like an easy way to get that extra information with the JS
b. Get the user to feed that in manually (i.e. get config options in the scripts)
In my struggle I rewrote the scripts to a single one, pasting here in case you want to consider a single param'd script call with standalone SQL files:#!/bin/bashpiLoc=`dirname "$(realpath $0)"`dbLoc=`echo "$piLoc"|sed 's#/Plug-ins/.*#/Plug-in Support/Databases/com.plexapp.plugins.library.db#'`function err { echo "ERROR: $1"; exit 1; }if [[ $1 == "lock" && -f "$piLoc/sqlite3" && -f "$piLoc/lock.sql" && -f "$dbLoc" ]]; then "$piLoc/sqlite3" "$dbLoc" < "$piLoc/lock.sql" || err "error locking section(s)";elif [[ $1 == "unlock" && -f "$piLoc/sqlite3" && -f "$piLoc/unlock.sql" && -f "$dbLoc" ]]; then "$piLoc/sqlite3" "$dbLoc" < "$piLoc/unlock.sql" || err "error unlocking section(s)";else err "Check if you use lock/unlock param and files exist. I've got: \"$piLoc/sqlite3\", \"$piLoc/unlock.sql\", \"$dbLoc\""fiexit 0;This way you can ditch the BASEPATHLOCK and BASEPATHUNLOCK and use a BASEPATHLOCKSCRIPT or something instead with a lock or unlock parameter.
Thanks,
M
mbjr,
This code below should give you the path of the dir the bash script is in and then go to the database path.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
This should help you get the plugin path in pyhton
BASEPATHLOCK = (Core.storage.join_path(Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name+"/Lock.bundle/Contents/Resources/lock_support/lock.sh"))).replace(" ","\\ ") BASEPATHUNLOCK = (Core.storage.join_path(Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name+"/Lock.bundle/Contents/Resources/lock_support/unlock.sh"))).replace(" ","\\ ")
Wish I had the bandwidth to use some vmware to simulate, will try to add later, but in all honesty, just sticking to the standard installation paths that plex docs mentions here as of now many users don't fidgit with plex to make it their own and just use it out of the box, banking on that at the moment ;)
Pushed an update for linux testers, pl. try and revert!
Thanks iShow, I'll dig in weekendish and report back asap - crazy week this is.
Thanks iShow, I'll dig in weekendish and report back asap - crazy week this is.
Thank you, appreciate it! Pl. take your time, no hurry! Seems like you rthe only Linux user thus far ;)
The update you pushed is only working on Linux? Should be very similar for Mac, no? Happy to test !
The update you pushed is only working on Linux? Should be very similar for Mac, no? Happy to test !
Hey, thanks for the positive response, however, testing requires a linux OS.
Most likely it won't work :/ will get there for linux eventually!
Have used the logic on linux a very long time ago *sigh*
Hi iSh0w, I've just installed Plex today and have been shocked to discover there are no access controls!
I am running Plex 0.9.9.13.525 in a FreeNAS (BSD) jail and would like to test out your plug-in... I won't blame you if it screws anything up :)
Sorry, your Plex Media Server(PMS1) version( 0.9.9.13.525-197d5ed ) running on operating system FreeBSD (FreeBSD 9.2-RELEASE-p10 #0 r262572+4fb5adc: Wed Aug 6 17:07:16 PDT 2014 root@build3.ixsystems.com:/fusion/jkh/921/freenas/os-base/amd64/fusion/jkh/921/freenas/FreeBSD/src/sys/FREENAS.amd64) is currently NOT supported!
I guess a start would be finding the plugins directory?
Let me know if you feel like helping me out.
root@plexmediaserver_1:/ # nice find / -type d -iname 'plug-ins' /usr/local/share/plexmediaserver/Resources/Plug-ins /usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins /usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins root@plexmediaserver_1:/ # ls -lF /usr/local/share/plexmediaserver/Resources/Plug-ins total 314 drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Framework.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 HTbackdrops.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 IMDB.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 LastFM.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 LocalMedia.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Media-Flags.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 MoviePosterDB.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 OpenSubtitles.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 PersonalMedia.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 PlexThemeMusic.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 Scanners.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 Services.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 SiteConfigurations.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 System.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 The-Movie-Database.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 TheTVDB.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 WebClient.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 WebManager.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Wikipedia.bundle/ root@plexmediaserver_1:/ # ls -lF /usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins total 314 drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Framework.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 HTbackdrops.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 IMDB.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 LastFM.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 LocalMedia.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Media-Flags.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 MoviePosterDB.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 OpenSubtitles.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 PersonalMedia.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 PlexThemeMusic.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 Scanners.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 Services.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 SiteConfigurations.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 System.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 The-Movie-Database.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 TheTVDB.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 WebClient.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 WebManager.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Wikipedia.bundle/ root@plexmediaserver_1:/ # ls -lF '/usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins' total 314 drwxr-xr-x 3 plex plex 3 Aug 4 02:26 Framework.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 HTbackdrops.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 IMDB.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 LastFM.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 LocalMedia.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Media-Flags.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 MoviePosterDB.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 OpenSubtitles.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 PersonalMedia.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 PlexThemeMusic.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Scanners.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:13 Services.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 SiteConfigurations.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 System.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 The-Movie-Database.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 TheTVDB.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 13:58 WebClient.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 WebManager.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Wikipedia.bundle/
Sjmik,Hi iSh0w, I've just installed Plex today and have been shocked to discover there are no access controls!
I am running Plex 0.9.9.13.525 in a FreeNAS (BSD) jail and would like to test out your plug-in... I won't blame you if it screws anything up :)Sorry, your Plex Media Server(PMS1) version( 0.9.9.13.525-197d5ed ) running on operating system FreeBSD (FreeBSD 9.2-RELEASE-p10 #0 r262572+4fb5adc: Wed Aug 6 17:07:16 PDT 2014 root@build3.ixsystems.com:/fusion/jkh/921/freenas/os-base/amd64/fusion/jkh/921/freenas/FreeBSD/src/sys/FREENAS.amd64) is currently NOT supported!I guess a start would be finding the plugins directory?
Let me know if you feel like helping me out.root@plexmediaserver_1:/ # nice find / -type d -iname 'plug-ins' /usr/local/share/plexmediaserver/Resources/Plug-ins /usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins /usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins root@plexmediaserver_1:/ # ls -lF /usr/local/share/plexmediaserver/Resources/Plug-ins total 314 drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Framework.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 HTbackdrops.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 IMDB.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 LastFM.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 LocalMedia.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Media-Flags.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 MoviePosterDB.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 OpenSubtitles.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 PersonalMedia.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 PlexThemeMusic.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 Scanners.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 Services.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 SiteConfigurations.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 System.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 The-Movie-Database.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 TheTVDB.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 WebClient.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 WebManager.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Wikipedia.bundle/ root@plexmediaserver_1:/ # ls -lF /usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins total 314 drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Framework.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 HTbackdrops.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 IMDB.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 LastFM.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 LocalMedia.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Media-Flags.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 MoviePosterDB.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 OpenSubtitles.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 PersonalMedia.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 PlexThemeMusic.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 Scanners.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 Services.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 SiteConfigurations.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 System.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 The-Movie-Database.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 TheTVDB.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 WebClient.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 WebManager.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Wikipedia.bundle/ root@plexmediaserver_1:/ # ls -lF '/usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins' total 314 drwxr-xr-x 3 plex plex 3 Aug 4 02:26 Framework.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 HTbackdrops.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 IMDB.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 LastFM.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 LocalMedia.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Media-Flags.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 MoviePosterDB.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 OpenSubtitles.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 PersonalMedia.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 PlexThemeMusic.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Scanners.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:13 Services.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 SiteConfigurations.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 System.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 The-Movie-Database.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 TheTVDB.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 13:58 WebClient.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 WebManager.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Wikipedia.bundle/
Hi iSh0w, I've just installed Plex today and have been shocked to discover there are no access controls!
I am running Plex 0.9.9.13.525 in a FreeNAS (BSD) jail and would like to test out your plug-in... I won't blame you if it screws anything up :)
Sorry, your Plex Media Server(PMS1) version( 0.9.9.13.525-197d5ed ) running on operating system FreeBSD (FreeBSD 9.2-RELEASE-p10 #0 r262572+4fb5adc: Wed Aug 6 17:07:16 PDT 2014 root@build3.ixsystems.com:/fusion/jkh/921/freenas/os-base/amd64/fusion/jkh/921/freenas/FreeBSD/src/sys/FREENAS.amd64) is currently NOT supported!I guess a start would be finding the plugins directory?
Let me know if you feel like helping me out.
root@plexmediaserver_1:/ # nice find / -type d -iname 'plug-ins' /usr/local/share/plexmediaserver/Resources/Plug-ins /usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins /usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins root@plexmediaserver_1:/ # ls -lF /usr/local/share/plexmediaserver/Resources/Plug-ins total 314 drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Framework.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 HTbackdrops.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 IMDB.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 LastFM.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 LocalMedia.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Media-Flags.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 MoviePosterDB.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 OpenSubtitles.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 PersonalMedia.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 PlexThemeMusic.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 Scanners.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 Services.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 SiteConfigurations.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 System.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 The-Movie-Database.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 TheTVDB.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 WebClient.bundle/ drwxr-xr-x 3 root wheel 4 Oct 19 13:55 WebManager.bundle/ drwxr-xr-x 3 root wheel 3 Oct 19 13:55 Wikipedia.bundle/ root@plexmediaserver_1:/ # ls -lF /usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins total 314 drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Framework.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 HTbackdrops.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 IMDB.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 LastFM.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 LocalMedia.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Media-Flags.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 MoviePosterDB.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 OpenSubtitles.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 PersonalMedia.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 PlexThemeMusic.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 Scanners.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 Services.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 SiteConfigurations.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 System.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 The-Movie-Database.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 TheTVDB.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 WebClient.bundle/ drwxr-xr-x 3 root wheel 4 Aug 4 02:26 WebManager.bundle/ drwxr-xr-x 3 root wheel 3 Aug 4 02:26 Wikipedia.bundle/ root@plexmediaserver_1:/ # ls -lF '/usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins' total 314 drwxr-xr-x 3 plex plex 3 Aug 4 02:26 Framework.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 HTbackdrops.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 IMDB.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 LastFM.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 LocalMedia.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Media-Flags.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 MoviePosterDB.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 OpenSubtitles.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 PersonalMedia.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 PlexThemeMusic.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Scanners.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:13 Services.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 SiteConfigurations.bundle/ drwxr-xr-x 3 plex plex 3 Aug 4 02:26 System.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 The-Movie-Database.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 TheTVDB.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 13:58 WebClient.bundle/ drwxr-xr-x 3 plex plex 4 Aug 4 02:26 WebManager.bundle/ drwxr-xr-x 3 plex plex 4 Oct 19 14:18 Wikipedia.bundle/
Opened up the Ubuntu Linux release for FreeBSD and Synology users/devs to have a look!
Share your thoughts, keen of figuring a solution for FreeBSD users as well!
/iSh0w
Alright!
I've finally got it running, and it works a treat!
I did away with the shell scripts and just did the database calls in the python file.
I've attached a diff of the python so you can see what I changed from the original.
I placed the bundle here: /usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins/L0ck.bundle
This is on FreeNAS-9.2.1.7-RELEASE-x64, with the plexmediaserver-0.9.9.13.525-amd64 plugin.
Here is the modified python file:
import sqlite3PREFIX = “/video/l0ck”
PASSWORD = “locktest”
DEV_MODE = False
NAME = ‘L0ck’
ART = ‘art-default.jpg’
ICON = ‘icon-default.png’
L0CK_ICON = ‘L0ck.png’
UNL0CK_ICON = ‘unL0ck.png’
SUCCESS_ICON = ‘success.png’
ERROR_ICON = ‘error.png’SQLITE_PATH = Core.plugin_support_path + ‘/Databases/com.plexapp.plugins.library.db’
SQL_LOCK_1 = “UPDATE metadata_items SET metadata_type=20 WHERE library_section_id=3 and metadata_type=1;”
SQL_LOCK_2 = “DELETE FROM library_sections WHERE id=3;”
SQL_UNLOCK_1 = “UPDATE metadata_items SET metadata_type=1 WHERE library_section_id=3 and metadata_type=20;”
SQL_UNLOCK_2 = “INSERT OR REPLACE INTO library_sections (id,name,section_type,language,agent,scanner,created_at,updated_at,scanned_at,user_fields,uuid) VALUES (3,‘LockTest’,1,‘en’,‘com.plexapp.agents.imdb’,‘Plex Movie Scanner’,‘2014-10-21 23:06:57’,‘2014-10-21 23:06:58’,‘2014-10-21 23:06:58’,‘pr%3AincludeInGlobal=0’,‘fcfcc690-d692-4288-a0ef-e9a33a8a337f’);”def Start():
HTTP.CacheTime = 0
ObjectContainer.art = R(ART)
DirectoryObject.thumb = R(ICON)
Plugin.AddViewGroup(“Details”, viewMode=“InfoList”, mediaType=“items”)
ObjectContainer.view_group = ‘Details’
Logger(‘Platform: ’ + Platform.OS +’ Version: '+Platform.OSVersion, force=True)
Logger('PMS Server: ’ + Platform.ServerVersion, force=True)
Logger('Plex Media Server at ’ + Core.app_support_path, force=True)
Logger('Plug-in bundles are located in ’ + Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name), force=True)
Logger('Plug-in support files are located in ’ + Core.storage.join_path(Core.app_support_path, Core.config.plugin_support_dir_name), force=True)
Logger('L0ck Bundle path is ’ + Core.storage.join_path(Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name), ‘L0ck.bundle’), force=True)@handler(PREFIX, NAME, ICON, ART)
@route(PREFIX + ‘/mainmenu’)
def MainMenu():
oc = ObjectContainer(no_cache=True)
oc.add(DirectoryObject(key=Callback(L0ck, task=‘L0cked’, query=""), title=“L0ck”, thumb=R(L0CK_ICON)))
oc.add(InputDirectoryObject(key=Callback(L0ck, task=‘UnL0cked’), title=“UnL0ck”, thumb=R(UNL0CK_ICON), prompt=“Enter your password”))
return oc@route(PREFIX + ‘/L0ck’)
def L0ck(query, task):
oc = ObjectContainer(title2=“L0ck”, no_cache=True)conn=sqlite3.connect(SQLITE_PATH) if task == 'UnL0cked': if query == PASSWORD: Logger('Password correct about to launch unL0ck', force=True) conn.execute(SQL_UNLOCK_1) conn.execute(SQL_UNLOCK_2) Logger('Launched unL0ck', force=True) oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="UnL0cked", duration=3, summary="Section(s) successfully UnL0cked!", thumb=R(SUCCESS_ICON))) else: Logger('Password Incorrect, someone is trying to get in!', force=True) oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="Incorrect Password", duration=3, summary="Try Again!", thumb=R(ERROR_ICON))) elif task == 'L0cked': Logger('L0cking', force=True) conn.execute(SQL_LOCK_1) conn.execute(SQL_LOCK_2) Logger('L0cked', force=True) oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="L0cked", duration=3, summary="Section(s) successfully L0cked!", thumb=R(SUCCESS_ICON))) conn.commit() conn.close() return oc
@route(PREFIX + ‘/logger’)
def Logger(message, force=False):
if DEV_MODE:
force = True
if force:
Log.Debug(’======L0CK======’+message)
else:
pass
Great stuff! Mikedm139, who helped develop the .py had similar code/thought(github.com/mikedm139/Lock.bundle) Glad you got it to work for you :)Alright!
I've finally got it running, and it works a treat!
I did away with the shell scripts and just did the database calls in the python file.
I've attached a diff of the python so you can see what I changed from the original.
I placed the bundle here: /usr/pbi/plexmediaserver-amd64/plexdata/Plex Media Server/Plug-ins/L0ck.bundle
This is on FreeNAS-9.2.1.7-RELEASE-x64, with the plexmediaserver-0.9.9.13.525-amd64 plugin.
Here is the modified python file:import sqlite3PREFIX = "/video/l0ck"PASSWORD = "locktest"DEV_MODE = FalseNAME = 'L0ck'ART = 'art-default.jpg'ICON = 'icon-default.png'L0CK_ICON = 'L0ck.png'UNL0CK_ICON = 'unL0ck.png'SUCCESS_ICON = 'success.png'ERROR_ICON = 'error.png'SQLITE_PATH = Core.plugin_support_path + '/Databases/com.plexapp.plugins.library.db'SQL_LOCK_1 = "UPDATE metadata_items SET metadata_type=20 WHERE library_section_id=3 and metadata_type=1;"SQL_LOCK_2 = "DELETE FROM library_sections WHERE id=3;"SQL_UNLOCK_1 = "UPDATE metadata_items SET metadata_type=1 WHERE library_section_id=3 and metadata_type=20;"SQL_UNLOCK_2 = "INSERT OR REPLACE INTO library_sections (id,name,section_type,language,agent,scanner,created_at,updated_at,scanned_at,user_fields,uuid) VALUES (3,'LockTest',1,'en','com.plexapp.agents.imdb','Plex Movie Scanner','2014-10-21 23:06:57','2014-10-21 23:06:58','2014-10-21 23:06:58','pr%3AincludeInGlobal=0','fcfcc690-d692-4288-a0ef-e9a33a8a337f');"def Start(): HTTP.CacheTime = 0 ObjectContainer.art = R(ART) DirectoryObject.thumb = R(ICON) Plugin.AddViewGroup("Details", viewMode="InfoList", mediaType="items") ObjectContainer.view_group = 'Details' Logger('Platform: ' + Platform.OS +' Version: '+Platform.OSVersion, force=True) Logger('PMS Server: ' + Platform.ServerVersion, force=True) Logger('Plex Media Server at ' + Core.app_support_path, force=True) Logger('Plug-in bundles are located in ' + Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name), force=True) Logger('Plug-in support files are located in ' + Core.storage.join_path(Core.app_support_path, Core.config.plugin_support_dir_name), force=True) Logger('L0ck Bundle path is ' + Core.storage.join_path(Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name), 'L0ck.bundle'), force=True)@handler(PREFIX, NAME, ICON, ART)@route(PREFIX + '/mainmenu')def MainMenu(): oc = ObjectContainer(no_cache=True) oc.add(DirectoryObject(key=Callback(L0ck, task='L0cked', query=""), title="L0ck", thumb=R(L0CK_ICON))) oc.add(InputDirectoryObject(key=Callback(L0ck, task='UnL0cked'), title="UnL0ck", thumb=R(UNL0CK_ICON), prompt="Enter your password")) return oc@route(PREFIX + '/L0ck')def L0ck(query, task): oc = ObjectContainer(title2="L0ck", no_cache=True) conn=sqlite3.connect(SQLITE_PATH) if task == 'UnL0cked': if query == PASSWORD: Logger('Password correct about to launch unL0ck', force=True) conn.execute(SQL_UNLOCK_1) conn.execute(SQL_UNLOCK_2) Logger('Launched unL0ck', force=True) oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="UnL0cked", duration=3, summary="Section(s) successfully UnL0cked!", thumb=R(SUCCESS_ICON))) else: Logger('Password Incorrect, someone is trying to get in!', force=True) oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="Incorrect Password", duration=3, summary="Try Again!", thumb=R(ERROR_ICON))) elif task == 'L0cked': Logger('L0cking', force=True) conn.execute(SQL_LOCK_1) conn.execute(SQL_LOCK_2) Logger('L0cked', force=True) oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="L0cked", duration=3, summary="Section(s) successfully L0cked!", thumb=R(SUCCESS_ICON))) conn.commit() conn.close() return oc@route(PREFIX + '/logger')def Logger(message, force=False): if DEV_MODE: force = True if force: Log.Debug('======L0CK======'+message) else: pass
Off topic:
The problem is generalizing such a solution coz not all systems have the required version of sqlite3 that is required to edit the database. So if you updated FeeBSD 9.2's sqlite3 or not, earlier versions of FreeBSD might not work by just importing sqlite3 in .py. Due to sqlite3 version mismatch with plex db.
Since your clearly a dev, what was also tried was accessing using plex's SQLite.so, it was all weirdness and there was no clarity on how to do that!
Long story short, ended up packing the sqlite3 for all OS's.
Yeah, it was a bit of a ■■■■■ getting sqlite3 working until I just abandoned the batch scripts.
The included binary obviously didn't work since it was built for a different system.
There are technically 4 different versions in the default install (I didn't change anything):
root@plexmediaserver_1:/ # /usr/pbi/plexmediaserver-amd64/bin/sqlite3 -version 3.8.1 2013-10-17 12:57:35 c78be6d786c19073b3a6730dfe3fb1be54f5657aroot@plexmediaserver_1:/ # /usr/local/bin/sqlite3 -version
3.8.4.3 2014-04-03 16:53:12 a611fa96c4a848614efe899130359c9f6fb889c3root@plexmediaserver_1:/usr/pbi/plexmediaserver-amd64/bin # python2.7
Python 2.7.6 (default, May 30 2014, 17:28:26)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type “help”, “copyright”, “credits” or “license” for more information.import sys
sys.path
[‘’, ‘/usr/local/lib/python27.zip’, ‘/usr/local/lib/python2.7’, ‘/usr/local/lib/python2.7/plat-freebsd9’, ‘/usr/local/lib/python2.7/lib-tk’, ‘/usr/local/lib/python2.7/lib-old’, ‘/usr/local/lib/python2.7/lib-dynload’, ‘/usr/local/lib/python2.7/site-packages’]
import sqlite3
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/sqlite3/init.py”, line 24, in
from dbapi2 import *
File “/usr/local/lib/python2.7/sqlite3/dbapi2.py”, line 27, in
from _sqlite3 import *
ImportError: No module named _sqlite3
sys.path.insert(0,‘/usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload’)
import sqlite3
sqlite3.version
‘2.6.0’
sqlite3.sqlite_version
‘3.8.4.3’root@plexmediaserver_1:/usr/pbi/plexmediaserver-amd64/bin # python2.7
Python 2.7.6 (default, May 30 2014, 17:28:26)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type “help”, “copyright”, “credits” or “license” for more information.import sys
sys.path.insert(0,‘/usr/pbi/plexmediaserver-amd64/lib/python2.7/lib-dynload’)
import sqlite3
sqlite3.version
‘2.6.0’
sqlite3.sqlite_version
‘3.8.1’
Something else I forgot to mention...
In __init__.py you're calling: os.system('sh ' + filepath)
In the shell scripts you're specifying: #!/bin/bash
The default FreeNAS jails do not have bash, so you can't even run that script directly.
Also, calling sh will give you a very limited shell.
FreeNAS uses csh or tcsh.
Both of which have a different syntax for declaring variables.
Something else I forgot to mention...
In __init__.py you're calling: os.system('sh ' + filepath)
In the shell scripts you're specifying: #!/bin/bash
The default FreeNAS jails do not have bash, so you can't even run that script directly.
Also, calling sh will give you a very limited shell.
FreeNAS uses csh or tcsh.
Both of which have a different syntax for declaring variables.
Something else I forgot to mention...
In __init__.py you're calling: os.system('sh ' + filepath)
In the shell scripts you're specifying: #!/bin/bash
The default FreeNAS jails do not have bash, so you can't even run that script directly.
Also, calling sh will give you a very limited shell.
FreeNAS uses csh or tcsh.
Both of which have a different syntax for declaring variables.
sjmik,
Tried to install FreeBSD 9.1 on both virtual box and vmware, got to the point where I was installing gnome2 and realized it was a 32bit iso. Long story short, cannot install the 64bit iso (Computer chip isn’t supported, although the computer is 64bit). Plex only dishes out a 64bit release for FreeBSD, so cannot work on FreeBSD :/
If anyone has any other suggestions to get FreeBSD 64bit running virtually, pl. advice, for now L0ck for FreeBSD is on hold :/
Hope your solution you’ve shared in the forum will help other FreeBSD users!
/iSh0w