Lock for Plex Google Chrome App

Viola!

Ok - so, the packaged sqlite3 file also needs to be executable, so another chmod a+x on that file.  Secondly, the sqlite command needed to be updated to explicitly call the packaged version in the lock_support directory via the change below:

./sqlite3 $PLEX_HOME/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "$lockplex"

I also commented out the .exit line as I do not think it is needed, seems to work OK without it.

With those changes, explicitly calling the lock/unlock shell scripts has the intended effects on my library.  The section is fully hidden for lock and fully restored on unlock.

I do not seem to get the intended behavior working within the channel control however, so I'm thinking there might be a bad path in there too.

Did a little more digging - in Lock.bundle/Contents/Code... __init__.py, bad base paths - they were referencing the .bat versions of your code, probably from your Windows version.  I modified them as below:

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')
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')

However, still not getting the expected behavior out of the channel controls.  I'm not very familiar with Python - so I'm kind of at a loss for debugging past here for the time being.  The output from logs you are writing out are as follows, not sure if they will add any insight for you, but I figured I'd add them anyway:

2014-09-16 01:31:38,198 (7f196ac77700) :  DEBUG (runtime:717) - Handling request GET /video/lock
2014-09-16 01:31:38,200 (7f196ac77700) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2014-09-16 01:31:38,201 (7f196ac77700) :  DEBUG (runtime:814) - Found route matching /video/lock
2014-09-16 01:31:38,202 (7f196ac77700) :  DEBUG (base:125) - Checking if com.plexapp.plugins.lockunlock is broken
2014-09-16 01:31:38,203 (7f196ac77700) :  DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0b3JlU2VydmljZTpJc0NoYW5uZWxCcm9rZW4_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMQpzMzAKY29tLnBsZXhhcHAucGx1Z2lucy5sb2NrdW5sb2NrczEwCmlkZW50aWZpZXJyMAo_'
2014-09-16 01:31:38,213 (7f196ac77700) :  DEBUG (runtime:106) - Sending packed state data (111 bytes)
2014-09-16 01:31:38,214 (7f196ac77700) :  DEBUG (runtime:918) - Response: [200] MediaContainer, 1035 bytes
2014-09-16 01:31:41,788 (7f196ac77700) :  DEBUG (runtime:717) - Handling request GET /video/lock
2014-09-16 01:31:41,789 (7f196ac77700) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2014-09-16 01:31:41,791 (7f196ac77700) :  DEBUG (runtime:814) - Found route matching /video/lock
2014-09-16 01:31:41,791 (7f196ac77700) :  DEBUG (base:125) - Checking if com.plexapp.plugins.lockunlock is broken
2014-09-16 01:31:41,792 (7f196ac77700) :  DEBUG (networking:172) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0b3JlU2VydmljZTpJc0NoYW5uZWxCcm9rZW4_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMQpzMzAKY29tLnBsZXhhcHAucGx1Z2lucy5sb2NrdW5sb2NrczEwCmlkZW50aWZpZXJyMAo_'
2014-09-16 01:31:41,802 (7f196ac77700) :  DEBUG (runtime:106) - Sending packed state data (111 bytes)
2014-09-16 01:31:41,803 (7f196ac77700) :  DEBUG (runtime:918) - Response: [200] MediaContainer, 1035 bytes
2014-09-16 01:31:41,818 (7f196ac77700) :  DEBUG (runtime:717) - Handling request GET /video/lock/lock?path=%2Fvar%2Flib%2Fplexmediaserver%2FLibrary%2FApplication+Support%2FPlex+Media+Server%2FPlug-ins%2FLock.bundle%2FContents%2FResources%2Flock_support%2Flock.sh&task=Locked&query=
2014-09-16 01:31:41,820 (7f196ac77700) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2014-09-16 01:31:41,821 (7f196ac77700) :  DEBUG (runtime:814) - Found route matching /video/lock/lock
2014-09-16 01:31:41,821 (7f196ac77700) :  DEBUG (__init__:64) - ======LOCK======Locking
2014-09-16 01:31:41,827 (7f196ac77700) :  DEBUG (__init__:64) - ======LOCK======Locked
2014-09-16 01:31:41,830 (7f196ac77700) :  DEBUG (runtime:106) - Sending packed state data (111 bytes)
2014-09-16 01:31:41,830 (7f196ac77700) :  DEBUG (runtime:918) - Response: [200] MediaContainer, 576 bytes

I gotta hit the sack for a few hours, if you need me to try anything out I'll give it a go tomorrow sometime.

Thanks.

https://twitter.com/lockforplex/status/663283582832480256

https://twitter.com/lockforplex/status/663283582832480256

This is terrific!  There are two problems however.  One is small, and the other is big.  The small problem is that when you have this lock plugin, it can't do it by device, but does it for the entire library.  So if you have quite a few users logged in, then it will lock it for ALL users. 

The second problem which is much bigger deal is that when you select your TV shows selection to lock, when you unlock them, they come back extremely disorganized and scattered.  Right now I have 27 TV shows in one library that I am testing this with.  However after locking and then unlocking the section it then shows I have 2400 items.  Alot of them are blank tiles with no info whatsoever. 

https://twitter.com/lockforplex/status/663283582832480256

Ok - back at it.  I downloaded your latest build and most everything looked OK as per the changes we discussed last night.  The __init__.py still had an error in the Base Unlock Path, it was referencing the lock shell script rather than unlock

BASEPATHUNLOCK = '$PLEX_HOME/Library/Application Support/Plex Media Server/Plug-ins/Lock.bundle/Contents/Resources/lock_support/unlock.sh'

After fixing that, I still don't get prompted for the password nor does it lock the library when using the channel controls.  Is there a specific log file that would help debug?  I have the Plex logging turned up to debug, so I can send over anything that would be helpful.  Just let me know.

Thanks again!

https://twitter.com/lockforplex/status/663283582832480256

Yup - those snippets from last night were the logs from the actions taken after click for lock/unlock.  Here are the full log files from fresh restart of PMS.

After Lock Attempt: Log File 1

After Unlock Attempt: Log File 2

https://twitter.com/lockforplex/status/663283582832480256

https://twitter.com/lockforplex/status/663283582832480256

Np iSh0w - thank you for taking the time to debug through this with me (since I'm currently the only Linux user :P)

I tried the changes to the __init__.py, still no avail.

New log here

Yeah, I'm not getting the lock to work, trying to start there first.  You are correct, I'm using the web-client to do this - not mobile.  Going into Channels and clicking the Lock icon and it switching to a Check-mark, but doesn't seem to do the locking on the library.

https://twitter.com/lockforplex/status/663283582832480256

Still no luck... here's the log

That was my bad - I copied the quotes for the paths... think that is definitely screwing something up. 1 moment, let me re-run the test.

https://twitter.com/lockforplex/status/663283582832480256

Still same - here is the updated log file

https://twitter.com/lockforplex/status/663283582832480256

Yup, it will lock all users out! A quick tip/trick for all reading this. You could unlock, start a movie/video from the unlocked section and then lock the section using another device/client. The movie you have started can be paused, played, watched ; ) however, all other users will not be able to see the section, since it is locked!

Your second problem is quite frankly a problem with your library, not the channel, of this I am sure, the lock channel does not touch parts of the data you are referring to! Can someone else confirm if this is an issue for TVShows? I’m stumped.

Oh! and btw, welcome to the plex forums, I see this is your first post! ;) Good luck!

/iSh0w

Thanks for a quick response, and warm welcome.  Yeah I've seen it happen two different times.  I did a test run here at the office on my work computer that has a small plex library with several tv shows.  After unlocking them maybe a few times it seems, then suddenly the amount of items under TV shows exploded.  It's like it takes episodes of a TV show and just puts it under TV shows as it's own thing.  I've seen it do it on two different locations.  The fix so far has been to delete the TV shows section, and then rescan.  It then comes across all clean.  So far I am not locking down the TV shows section in fear of this happening again.  If anyone else can test it a few times and let me know if they get different results the better.  Thanks!

Made that change, still no luck sorry :(

Here's the log