Lock for Plex Google Chrome App

Zarquon, I have included your tips and tricks ;)

NB: I found that I had to check both for Client.Product 'Web Client' and 'Plex Web'.

[After deleting all my plugins and restarting PMS, I arrived indeed on a dashboard with a layout that I never saw before...

And the Product was 'Web Client'...]

if Client.Product and Client.Product in ('Plex Web', 'Web Client') :
   DoSomething
else :
   DoSomethingElse

So:

- I use now the "current path" in all the shell scripts.

- the plugin detects if it's a web client or not, offering the most "user friendly experience" depending on the Client Product  :)

- I have set a default delay in a Defaults.json file + used the API Prefs to pass the value to the script ShortUnl0ck....

- and added a settings icon to change that value ;)

 

I have also improved a bit (IMHO) the user experience : If one types a wrong password when trying to unlock, no need to come back to the previous screen to retry.

This is especially convenient for the web client as one can retype immediately in the search box. Within PHT, you won't spare a hit.

Unfortunately, I ended by putting a mess in the plugin with the @routes...

In the Web Client, everything worked fine, but in PHT, the "Lock" button didn't work anymore...

The only solution I found was to remove the route on the function 'L0ck' ... I wonder how to fix this issue properly.

It's most probably because I call that method from various "routes" ? (I am not yet comfortable with that principle)...

Next step:

- if possible, return to the home/main screen directly after unlocking/locking (without navigating back to quite the plugin) <= still didn't find how to do that

iSh0w, if you could validate my change... I am really not yet comfortable with the Plex API and would benefit of some feedback.

By the way, shouldn't I post in the Dev thread instead ?  :wacko:  :huh:

Your modifications worked for Lock and Unlock but Short Lock was broken.  I was able to see what was wrong and fixed it,  Your suggestion of moving this to the Dev thread is probably correct so I will post my solutions for you there.

is there a way to unlock so i can see the content and then relock so no one can see but me, as i am already in the folder i can continue to view.

thanks

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

To make the answer of iShow explicit: once locked, one cannot browse the library anymore and, if I understand how it works, there is no workaround...

This is one reason why voting for a native Parental Control within Plex (unlocking a.o. on a "per device" basis) is still important ;)

V.

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

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

Hi,

When I click on this link, it gives me a not-found or permissions error.  Should the content at this link still be available?  Do I have to do anything in order to gain access?

Thanks in advance

This is brilliant :)

https://forums.plex.tv/topic/46225-very-popular-parental-controls/ - im sure 724 people will be happy from this thread

I have tested and it works on my platforms

Absolutely awesome! Exactly what I needed, and super easy.

My PMS is Windows 7; and for my main client I'm using the Plex app on the Amazon Fire TV Stick (multiple actually). Works great!

I do notice that on the Amazon Fire TV Stick interface, after unlocking, I have to do a manual Options>Refresh to get the folder to show up. Then after it locks (either manual or timeout), the folder does continue to show-up at the bottom of the My Media section for an hour or two (unless you again manually Refresh); but in this state, when you try to access the folder it shows up empty and nothing will play.

Can L0ck support different passwords to unlock different folders? I didn't test, cause I didn't want to lock myself out of anything, and because I don't need it at the moment. Here's my line of thought: I want to lock out the PG13 and R content from the 5-year-old, but would like the 14-year-old to be able to unlock that when wanted; but still keep the adult content only available to me and the wife.

A small side note for feedback:

  • The 'plug-in generator' page refuses to load in Chrome (v40.0.2214.111); just clocks at a while screen forever (tried on 2 other PCs on my network besides the PMS).
  • The 'plug-in generator' page loads up and goes through the motions in Internet Explorer (v11.0.9600.17501); but then the 'Download Plugin' button does nothing.

I then watched the video in the top post and noticed Fire Fox is used, so downloaded it and everything worked fine (not catastrophic obviously, but slight inconvenience).

If any of this was already mentioned in the 16 pages of replies, please forgive me; I just couldn't bring myself to read everyone of them.

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

Hi guys,

So I'm trying to do the lock plug in generation and having an issue.  When I put in my IP address, I get a message that:

It looks like you have enabled "Require authentication on local networks" or "Plex Home" on your Plex Media server. Pl. navigate to "Settings > Connect" and temporarily uncheck the "Require authentication on local networks" and/or disable "Plex Home" temporarily, you can check/enable those options again later once you finish generating your personalized L0ck plugin!

Except that I don't have Require authentication set, and although I'm a Plex newbie, I don't believe I have a Plex Home setup.  I only have one user setup.  Am I overlooking something stupid here?  

Using Chrome to try to do the plug in generator, but Firefox gave the same message, and IE gave this message:

Pl. check the Plex Media Server IP address entered.

Any suggestions here?  Am I missing something obvious?

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

Hey Banedon,

Pl. double check the IP address your using.

The best way to check is to open a new tab and try opening plex/web(plex manager)
in the same browser window next to the tab that has plex/web(plex manager) open and load the L0ck plugin generator and enter the IP address that you used to open Plex/web(plex manager)

Hope this helps!

/iSh0w

Sent from my iPhone using Tapatalk

Oh for pete's sake.  I was using the IP address from ipconfig, which didn't work, but 127.0.0.1 did.  Derp.  Wouldn't have thought to try that till I did what you said though and actually looked at the address the web manager was using. 

Thanks.

Any way to add windows 10 to supported list of os?  I get this

Sorry, your Plex Media Server() version( 0.9.11.7.803-87d0708 ) running on operating system Windows&nbsp;10.0 (Build 9926) is currently&nbsp;<span style="margin:0px;color:#FF0000;">NOT</span>&nbsp;supported!<br><br>
If possible will either add your operating system to the list or try to work on a solution for your operating system.<br><br>
Click on the button below to anonymously send me the above data!

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

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

"Creating your personalized L0ck plugin, hold on..."

 

It goes like this forever...

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

Check your internet connection/speed!
Use Firefox if possible.

Thanks,
/iSh0w


Sent from my iPhone using Tapatalk

It worked. Awesome plugin. Thank you!

Hello guys,

I am trying to get this plugin also running on my PMS on an OMV (Debian) server.

I have managed to get the channel showing up on my PMS, however after pressing LOCK nothing happens.

Attached is the log file.

Further, this is my config.

import os
import thread
import time
PREFIX = "/video/l0ck" 
PASSWORD = "030813"
BASEPATHL0CK = '/media/645f4371-4869-43f4-b76d-b29ceb355057/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/L0ck.bundle/Contents/Resources/l0ck_support/l0ck.sh'
BASEPATHUNL0CK ='/media/645f4371-4869-43f4-b76d-b29ceb355057/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/L0ck.bundle/Contents/Resources/l0ck_support/unl0ck.sh'
GENERATE_DATE = "24th MAR 2015"
TIMER = 0
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'
UPDATES_ICON = 'updates.png'
 
def Start():
HTTP.CacheTime = 0
ObjectContainer.art = R(ART)
DirectoryObject.thumb = R(ICON)
Plugin.AddViewGroup("Details", viewMode="InfoList", mediaType="items")
Plugin.AddViewGroup("List", viewMode="List", 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)
Logger('BASEPATHL0CK: ' + BASEPATHL0CK, force=True)
Logger('BASEPATHUNL0CK: ' + BASEPATHUNL0CK, force=True)
Logger('L0ck plugin generated on: ' + GENERATE_DATE, force=True)
 
@handler(PREFIX, NAME, ICON, ART)
@route(PREFIX + '/mainmenu')
def MainMenu():
oc = ObjectContainer(no_cache=True)
oc.add(DirectoryObject(key=Callback(L0ck), title="L0ck", thumb=R(L0CK_ICON)))
oc.add(InputDirectoryObject(key=Callback(UnL0ck), title="UnL0ck", thumb=R(UNL0CK_ICON), prompt="Enter your password"))
oc.add(DirectoryObject(key=Callback(Updates), title="Update Feed", thumb=R(UPDATES_ICON)))
return oc
 
@route(PREFIX + '/Updates')
def Updates():
oc = ObjectContainer(title2='You generated the L0ck plugin on ['+ GENERATE_DATE +']', view_group='List', no_cache=True)
updatedata = ''
updatedate = ''
for item in xml.entries:
updatedata = item.description
updatedate = item.title
Logger(updatedate, force=True)
Logger(updatedata, force=True)
oc.add(DirectoryObject(key=Callback(MainMenu),title='[' + updatedate +'] - ' + updatedata))
 
if len(oc) < 1:
Logger('Something went wrong while pulling xml', force=True)
return oc.add(DirectoryObject(key=Callback(MainMenu),title='Pl. ensure your connected to the internet and try again!')) 
else:
return oc
 
 
@route(PREFIX + '/L0ck')
def L0ck():
oc = ObjectContainer(title2="L0ck", no_cache=True)
Logger('L0cking', force=True)
filepath = '"' + BASEPATHL0CK + '"'
os.system('sh ' + filepath)
Logger('L0cked', force=True)
oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="L0cked", duration=3, summary="Section(s) successfuly L0cked!", thumb=R(SUCCESS_ICON)))
return oc
 
@route(PREFIX + '/UnL0ck')
def UnL0ck(query):
oc = ObjectContainer(title2="UnL0ck", no_cache=True)
if query == PASSWORD:
Logger('Password correct about to launch UnL0ck', force=True)
filepath = '"' + BASEPATHUNL0CK + '"'
os.system('sh ' + filepath)
Logger('Launched unL0ck', force=True)
oc.add(PopupDirectoryObject(key=Callback(MainMenu), title="UnL0cked", duration=3, summary="Section(s) successfully UnL0cked!", thumb=R(SUCCESS_ICON)))
if TIMER != 0:
Logger('Triggering Unl0ck in ' + str(TIMER) + ' seconds', force=True)
Thread.CreateTimer(TIMER, L0ck)
Logger('Successfully UnL0cked and thread/timer set', force=True)
else:
Logger('Timer feature is not being used!', force=True)
return oc
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)))
return oc
 
 
@route(PREFIX + '/logger')
def Logger(message, force=False):
if DEV_MODE:
force = True
if force:
Log.Debug('======L0CK======'+message)
else:
pass
 

Here are the l0ck. and unl0ck:

#!/bin/bash

 
l0ckplex="UPDATE metadata_items SET metadata_type=20 WHERE library_section_id=1 and metadata_type=1; DELETE FROM library_sections WHERE id=1;UPDATE metadata_items SET metadata_type=20 WHERE library_section_id=3 and metadata_type=2; DELETE FROM library_sections WHERE id=3;"
 
cd /media/645f4371-4869-43f4-b76d-b29ceb355057/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/L0ck.bundle/Contents/Resources/l0ck_support/
 
./sqlite3 /media/645f4371-4869-43f4-b76d-b29ceb355057/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "$l0ckplex" 
 
exit;
 
 

#!/bin/bash

 
unl0ckplex="UPDATE metadata_items SET metadata_type=1 WHERE library_section_id=1 and metadata_type=20; INSERT OR REPLACE INTO library_sections (id,name,section_type,language,agent,scanner,created_at,updated_at,scanned_at,user_fields,uuid) VALUES (1,'Filme',1,'de','com.plexapp.agents.themoviedb','Plex Movie Scanner','2015-03-13 08:27:02','2015-03-24 13:54:49','2015-03-24 13:54:49','pr%3AenableCinemaTrailers=0&pr%3AincludeInGlobal=0','113045f7-5745-43fc-b8ea-f616d47a02a0');UPDATE metadata_items SET metadata_type=2 WHERE library_section_id=3 and metadata_type=20; INSERT OR REPLACE INTO library_sections (id,name,section_type,language,agent,scanner,created_at,updated_at,scanned_at,user_fields,uuid) VALUES (3,'Serien',2,'de','com.plexapp.agents.thetvdb','Plex Series Scanner','2015-03-17 09:32:55','2015-03-25 10:15:50','2015-03-25 10:15:50','pr%3AincludeInGlobal=0','37c7155f-4c7f-43f2-96cb-86edfe3f2028');"
 
cd /media/645f4371-4869-43f4-b76d-b29ceb355057/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/L0ck.bundle/Contents/Resources/l0ck_support/
 
./sqlite3 /media/645f4371-4869-43f4-b76d-b29ceb355057/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "$unl0ckplex" 
 
exit;
 

Can someone tell me and help me, why it is not working and not locking the two sections ? 

This plugin would be sooo usefull for me, to get my daughter access to the plex server.

Regards,

mihai

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