diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index f2de5776..6c1ee9cb 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -832,7 +832,7 @@
-

Global Notification Toggles

+

Global Notification Settings

Enable to upload Plex posters to Imgur for notifications. Disable if posters are not being used to save bandwidth.

+
+
+ +
+
+ +
+
+

Enter your Imgur API client ID in order to upload posters. + You can register a new anonymous usage application here. +

+

Current Activity Notifications

@@ -2148,6 +2160,20 @@ $(document).ready(function() { } }); + if ($("#notify_upload_posters").is(":checked")) { + $("#imgur_upload_options").show(); + } else { + $("#imgur_upload_options").hide(); + } + + $("#notify_upload_posters").click(function(){ + if ($("#notify_upload_posters").is(":checked")) { + $("#imgur_upload_options").slideDown(); + } else { + $("#imgur_upload_options").slideUp(); + } + }); + $( ".http-settings" ).change(function() { httpChanged = true; }); diff --git a/plexpy/config.py b/plexpy/config.py index 19230bed..2604735b 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -203,6 +203,7 @@ _CONFIG_DEFINITIONS = { 'IFTTT_ON_EXTUP': (int, 'IFTTT', 0), 'IFTTT_ON_INTUP': (int, 'IFTTT', 0), 'IFTTT_ON_PMSUPDATE': (int, 'IFTTT', 0), + 'IMGUR_CLIENT_ID': (str, 'Monitoring', ''), 'JOURNAL_MODE': (str, 'Advanced', 'wal'), 'LAUNCH_BROWSER': (int, 'General', 1), 'LOG_BLACKLIST': (int, 'General', 1), diff --git a/plexpy/helpers.py b/plexpy/helpers.py index 07f42ca0..98487f0e 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -525,9 +525,14 @@ def anon_url(*url): return '' if None in url else '%s%s' % (plexpy.CONFIG.ANON_REDIRECT, ''.join(str(s) for s in url)) def uploadToImgur(imgPath, imgTitle=''): - client_id = '743b1a443ccd2b0' + """ Uploads an image to Imgur """ + client_id = plexpy.CONFIG.IMGUR_CLIENT_ID img_url = '' + if not client_id: + logger.error(u"PlexPy Helpers :: Cannot upload poster to Imgur. No client id specifiec in the settings.") + return img_url + try: with open(imgPath, 'rb') as imgFile: img = imgFile.read() diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 7bebef50..4591c967 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -2237,7 +2237,8 @@ class WebInterface(object): "buffer_threshold": plexpy.CONFIG.BUFFER_THRESHOLD, "buffer_wait": plexpy.CONFIG.BUFFER_WAIT, "group_history_tables": checked(plexpy.CONFIG.GROUP_HISTORY_TABLES), - "git_token": plexpy.CONFIG.GIT_TOKEN + "git_token": plexpy.CONFIG.GIT_TOKEN, + "imgur_client_id": plexpy.CONFIG.IMGUR_CLIENT_ID } return serve_template(templatename="settings.html", title="Settings", config=config)