\
Step 1: Visit \
- Facebook Developers to create a new app using advanced setup. \
- Step 2: Go to Settings > Advanced and fill in \
+ Facebook Developers to add a new app using basic setup. \
+ Step 2: Go to Settings > Basic and fill in a \
+ Contact Email. \
+ Step 3: Go to Settings > Advanced and fill in \
Valid OAuth redirect URIs with your PlexPy URL (i.e. http://localhost:8181). \
- Step 3: Fill in the PlexPy URL below with the exact same URL from Step 2. \
- Step 4: Fill in the App ID and App Secret below. \
- Step 5: Click the Request Authorization button below.',
+ Step 4: Go to App Review and toggle public to Yes. \
+ Step 5: Fill in the PlexPy URL below with the exact same URL from Step 3. \
+ Step 6: Fill in the App ID and App Secret below. \
+ Step 7: Click the Request Authorization button below. \
+ Step 8: Fill in the Group ID below.',
'input_type': 'help'
},
{'label': 'PlexPy URL',
From a9ce92decb9f7d65fd0221baf3454ba3c61649d3 Mon Sep 17 00:00:00 2001
From: JonnyWong16
Date: Wed, 27 Jan 2016 21:30:35 -0800
Subject: [PATCH 07/14] Change Telegram wording
---
plexpy/notifiers.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py
index bb5d8947..1623cd8d 100644
--- a/plexpy/notifiers.py
+++ b/plexpy/notifiers.py
@@ -1677,10 +1677,10 @@ class TELEGRAM(object):
'description': 'Your Telegram bot token. Contact @BotFather on Telegram to get one.',
'input_type': 'text'
},
- {'label': 'Telegram Chat ID',
+ {'label': 'Telegram Chat ID, Group ID, or Channel Username',
'value': self.chat_id,
'name': 'telegram_chat_id',
- 'description': 'Your Telegram Chat ID, Group ID, or channel username. Contact @myidbot on Telegram to get an ID.',
+ 'description': 'Your Telegram Chat ID, Group ID, or @channelusername. Contact @myidbot on Telegram to get an ID.',
'input_type': 'text'
}
]
From a8aae9f1f5e036c5bd0b3fb784c85fb9876725a8 Mon Sep 17 00:00:00 2001
From: JonnyWong16
Date: Wed, 27 Jan 2016 23:32:01 -0800
Subject: [PATCH 08/14] Fix libraries and users refresh
---
data/interfaces/default/settings.html | 7 +++++--
data/interfaces/default/welcome.html | 1 +
plexpy/__init__.py | 2 +-
plexpy/libraries.py | 14 +++++++++-----
plexpy/users.py | 3 +--
plexpy/webserve.py | 18 +++++++++++-------
6 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html
index 92134041..96c2f14f 100644
--- a/data/interfaces/default/settings.html
+++ b/data/interfaces/default/settings.html
@@ -359,6 +359,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
Force PlexPy to connect to your Plex Server via SSL. Your server needs to have remote access enabled.
+
+
+
+
Plex Logs
@@ -374,8 +378,6 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
Click here for help. This is required if you enable IP logging (for PMS 0.9.12 and below).
-
-
@@ -1554,6 +1556,7 @@ $(document).ready(function() {
serverChanged = true;
$("#pms_identifier").val("");
$("#pms-verify-status").html("");
+ $("#server_changed").prop('checked', true);
verifyServer();
});
diff --git a/data/interfaces/default/welcome.html b/data/interfaces/default/welcome.html
index 0b19eca1..a717ad0e 100644
--- a/data/interfaces/default/welcome.html
+++ b/data/interfaces/default/welcome.html
@@ -169,6 +169,7 @@ from plexpy import common
+
diff --git a/plexpy/__init__.py b/plexpy/__init__.py
index c59ee7a2..1bc46e8c 100644
--- a/plexpy/__init__.py
+++ b/plexpy/__init__.py
@@ -176,7 +176,7 @@ def initialize(config_file):
plextv.refresh_users()
# Refresh the libraries list on startup
- if CONFIG.PMS_TOKEN and CONFIG.REFRESH_LIBRARIES_ON_STARTUP:
+ if CONFIG.PMS_IP and CONFIG.PMS_TOKEN and CONFIG.REFRESH_LIBRARIES_ON_STARTUP:
pmsconnect.refresh_libraries()
# Store the original umask
diff --git a/plexpy/libraries.py b/plexpy/libraries.py
index 61a2f621..ca60e11c 100644
--- a/plexpy/libraries.py
+++ b/plexpy/libraries.py
@@ -22,8 +22,6 @@ def update_section_ids():
plexpy.CONFIG.UPDATE_SECTION_IDS = -1
- logger.info(u"PlexPy Libraries :: Updating section_id's in database.")
-
#logger.debug(u"PlexPy Libraries :: Disabling monitoring while update in progress.")
#plexpy.schedule_job(activity_pinger.check_active_sessions, 'Check for active sessions',
# hours=0, minutes=0, seconds=0)
@@ -51,6 +49,13 @@ def update_section_ids():
#plexpy.initialize_scheduler()
return None
+ if not history_results:
+ plexpy.CONFIG.__setattr__('UPDATE_SECTION_IDS', 0)
+ plexpy.CONFIG.write()
+ return None
+
+ logger.info(u"PlexPy Libraries :: Updating section_id's in database.")
+
# Add thread filter to the logger
#logger.debug(u"PlexPy Libraries :: Disabling logging in the current thread while update in progress.")
#thread_filter = logger.NoThreadFilter(threading.current_thread().name)
@@ -572,11 +577,10 @@ class Libraries(object):
return library_details
else:
logger.warn(u"PlexPy Libraries :: Unable to retrieve library from local database. Requesting library list refresh.")
- # Let's first refresh the user list to make sure the user isn't newly added and not in the db yet
+ # Let's first refresh the libraries list to make sure the library isn't newly added and not in the db yet
+ pmsconnect.refresh_libraries()
try:
if section_id:
- # Refresh libraries
- pmsconnect.refresh_libraries()
query = 'SELECT section_id, section_name, section_type, count, parent_count, child_count, ' \
'thumb AS library_thumb, custom_thumb_url AS custom_thumb, art, ' \
'do_notify, do_notify_created, keep_history ' \
diff --git a/plexpy/users.py b/plexpy/users.py
index d4221efa..19294285 100644
--- a/plexpy/users.py
+++ b/plexpy/users.py
@@ -292,10 +292,9 @@ class Users(object):
else:
logger.warn(u"PlexPy Users :: Unable to retrieve user from local database. Requesting user list refresh.")
# Let's first refresh the user list to make sure the user isn't newly added and not in the db yet
+ plextv.refresh_users()
try:
if str(user_id).isdigit():
- # Refresh users
- plextv.refresh_users()
query = 'SELECT user_id, username, friendly_name, thumb AS user_thumb, custom_avatar_url AS custom_thumb, ' \
'email, is_home_user, is_allow_sync, is_restricted, do_notify, keep_history ' \
'FROM users ' \
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index c1cb3df1..f3f18dfc 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -1151,6 +1151,7 @@ class WebInterface(object):
del kwargs[use_config]
# Check if we should refresh our data
+ server_changed = False
refresh_libraries = False
refresh_users = False
reschedule = False
@@ -1173,11 +1174,6 @@ class WebInterface(object):
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
reschedule = True
- if 'pms_ip' in kwargs:
- if kwargs['pms_ip'] != plexpy.CONFIG.PMS_IP:
- refresh_libraries = True
- refresh_users = True
-
# Remove config with 'hscard-' prefix and change home_stats_cards to list
if 'home_stats_cards' in kwargs:
for k in kwargs.keys():
@@ -1198,16 +1194,24 @@ class WebInterface(object):
if kwargs['home_library_cards'] == ['first_run_wizard']:
refresh_libraries = True
+ if 'server_changed' in kwargs:
+ del kwargs['server_changed']
+ server_changed = True
+ refresh_users = True
+ refresh_libraries = True
+
plexpy.CONFIG.process_kwargs(kwargs)
# Write the config
plexpy.CONFIG.write()
# Get new server URLs for SSL communications.
- plextv.get_real_pms_url()
+ if server_changed:
+ plextv.get_real_pms_url()
# Get new server friendly name.
- pmsconnect.get_server_friendly_name()
+ if server_changed:
+ pmsconnect.get_server_friendly_name()
# Reconfigure scheduler if intervals changed
if reschedule:
From 67377a256157a9a42c09577b75eeadfd4d015bc9 Mon Sep 17 00:00:00 2001
From: JonnyWong16
Date: Wed, 27 Jan 2016 23:32:21 -0800
Subject: [PATCH 09/14] Fix server verification in settings
---
plexpy/webserve.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index f3f18dfc..a70b8252 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -1382,9 +1382,16 @@ class WebInterface(object):
@cherrypy.expose
def get_server_id(self, hostname=None, port=None, identifier=None, ssl=0, remote=0, **kwargs):
- from plexpy import http_handler
+ if not identifier:
+ plex_tv = plextv.PlexTV()
+ servers = plex_tv.discover()
- if hostname and port:
+ for server in servers:
+ if server['ip'] == hostname and server['port'] == port:
+ identifier = server['clientIdentifier']
+ break
+
+ if identifier and hostname and port:
# Set PMS attributes to get the real PMS url
plexpy.CONFIG.__setattr__('PMS_IP', hostname)
plexpy.CONFIG.__setattr__('PMS_PORT', port)
From 0eaea4d011c1378a7a3f1d058a321161920ee63c Mon Sep 17 00:00:00 2001
From: JonnyWong16
Date: Fri, 29 Jan 2016 18:38:19 -0800
Subject: [PATCH 10/14] Fix empty libraries not added
---
plexpy/pmsconnect.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py
index 2a1a76b0..b31e56e9 100644
--- a/plexpy/pmsconnect.py
+++ b/plexpy/pmsconnect.py
@@ -1694,8 +1694,8 @@ class PmsConnect(object):
section_id = library['section_id']
children_list = self.get_library_children_details(section_id=section_id, section_type=section_type, count='1')
- if children_list and children_list['library_count'] != '0':
- library_stats = {'section_id': library['section_id'],
+ if children_list:
+ library_stats = {'section_id': section_id,
'section_name': library['section_name'],
'section_type': section_type,
'thumb': library['thumb'],
From 1cb75bd05318beda184bdce046df249dca6de566 Mon Sep 17 00:00:00 2001
From: JonnyWong16
Date: Fri, 29 Jan 2016 18:47:12 -0800
Subject: [PATCH 11/14] Remove unnecessary quoting of script arguments
---
plexpy/notification_handler.py | 8 --------
1 file changed, 8 deletions(-)
diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py
index fab5803d..cea0b601 100644
--- a/plexpy/notification_handler.py
+++ b/plexpy/notification_handler.py
@@ -586,10 +586,6 @@ def build_notify_text(session=None, timeline=None, state=None):
# Default scripts args
script_args = []
- # Regex to match {param} but not "{param}"
- params_to_quote = re.compile(r'(?"', script_args_text)
-
if script_args_text:
try:
script_args = [unicode(arg).format(**available_params) for arg in script_args_text.split()]
@@ -805,10 +801,6 @@ def build_server_notify_text(state=None):
# Default scripts args
script_args = []
- # Regex to match {param} but not "{param}"
- params_to_quote = re.compile(r'(?"', script_args_text)
-
if script_args_text:
try:
script_args = [unicode(arg).format(**available_params) for arg in script_args_text.split()]
From 01fe7bf6121f4d96590814cb6f57737c1689f8bd Mon Sep 17 00:00:00 2001
From: JonnyWong16
Date: Fri, 29 Jan 2016 19:06:08 -0800
Subject: [PATCH 12/14] Reorganize notification options
---
data/interfaces/default/settings.html | 80 +++++++++++++++------------
plexpy/notification_handler.py | 4 +-
2 files changed, 47 insertions(+), 37 deletions(-)
diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html
index 96c2f14f..f05d4ba7 100644
--- a/data/interfaces/default/settings.html
+++ b/data/interfaces/default/settings.html
@@ -1074,7 +1074,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()