Add self-hosted notificaation images

This commit is contained in:
JonnyWong16 2018-03-24 22:09:37 -07:00
parent 90f3d597dc
commit e23b1a0603
11 changed files with 110 additions and 72 deletions

View file

@ -226,6 +226,7 @@ _CONFIG_DEFINITIONS = {
'HTTP_ROOT': (str, 'General', ''),
'HTTP_USERNAME': (str, 'General', ''),
'HTTP_PLEX_ADMIN': (int, 'General', 0),
'HTTP_BASE_URL': (str, 'General', ''),
'HIPCHAT_URL': (str, 'Hipchat', ''),
'HIPCHAT_COLOR': (str, 'Hipchat', ''),
'HIPCHAT_INCL_SUBJECT': (int, 'Hipchat', 1),
@ -310,7 +311,6 @@ _CONFIG_DEFINITIONS = {
'NEWSLETTER_TEMPLATES': (str, 'Newsletter', 'newsletters'),
'NEWSLETTER_DIR': (str, 'Newsletter', ''),
'NEWSLETTER_SELF_HOSTED': (int, 'Newsletter', 0),
'NEWSLETTER_BASE_URL': (str, 'Newsletter', ''),
'NMA_APIKEY': (str, 'NMA', ''),
'NMA_ENABLED': (int, 'NMA', 0),
'NMA_PRIORITY': (int, 'NMA', 0),

View file

@ -458,7 +458,7 @@ class Newsletter(object):
def _build_params(self):
date_format = helpers.momentjs_to_arrow(plexpy.CONFIG.DATE_FORMAT)
base_url = plexpy.CONFIG.NEWSLETTER_BASE_URL or helpers.get_plexpy_url()
base_url = plexpy.CONFIG.HTTP_BASE_URL or helpers.get_plexpy_url()
parameters = {
'server_name': plexpy.CONFIG.PMS_NAME,

View file

@ -632,10 +632,15 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
else:
poster_thumb = ''
if plexpy.CONFIG.NOTIFY_UPLOAD_POSTERS:
if plexpy.CONFIG.NOTIFY_UPLOAD_POSTERS == 1:
imgur_info = get_imgur_info(img=poster_thumb, rating_key=poster_key, title=poster_title, fallback='poster')
poster_info = {'poster_title': imgur_info['imgur_title'], 'poster_url': imgur_info['imgur_url']}
notify_params.update(poster_info)
elif plexpy.CONFIG.NOTIFY_UPLOAD_POSTERS == 2 and plexpy.CONFIG.HTTP_BASE_URL:
img_hash = set_hash_image_info(img=poster_thumb, fallback='poster')
poster_info = {'poster_title': poster_title,
'poster_url': plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'image/' + img_hash}
notify_params.update(poster_info)
if ((manual_trigger or plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_GRANDPARENT)
and notify_params['media_type'] in ('show', 'artist')):

View file

@ -960,8 +960,8 @@ class ANDROIDAPP(Notifier):
config_option.append({
'label': 'Device',
'description': 'No devices registered. '
'<a data-tab-destination="tabs-android_app" data-toggle="tab" data-dismiss="modal" '
'style="cursor: pointer;">Get the Android App</a> and register a device.',
'<a data-tab-destination="tabs-android_app" data-toggle="tab" data-dismiss="modal">'
'Get the Android App</a> and register a device.',
'input_type': 'help'
})
else:
@ -970,8 +970,8 @@ class ANDROIDAPP(Notifier):
'value': self.config['device_id'],
'name': 'androidapp_device_id',
'description': 'Set your Android app device or '
'<a data-tab-destination="tabs-android_app" data-toggle="tab" data-dismiss="modal" '
'style="cursor: pointer;">register a new device</a> with Tautulli.',
'<a data-tab-destination="tabs-android_app" data-toggle="tab" data-dismiss="modal">'
'register a new device</a> with Tautulli.',
'input_type': 'select',
'select_options': devices
})
@ -1224,7 +1224,7 @@ class DISCORD(Notifier):
'value': self.config['incl_card'],
'name': 'discord_incl_card',
'description': 'Include an info card with a poster and metadata with the notifications.<br>'
'Note: Imgur upload may need to be enabled under the notifications settings tab.',
'Note: Image hosting must be enabled under the notifications settings tab.',
'input_type': 'checkbox'
},
{'label': 'Include Plot Summaries',
@ -1574,7 +1574,7 @@ class FACEBOOK(Notifier):
'value': self.config['incl_card'],
'name': 'facebook_incl_card',
'description': 'Include an info card with a poster and metadata with the notifications.<br>'
'Note: Imgur upload may need to be enabled under the notifications settings tab.',
'Note: Image hosting must be enabled under the notifications settings tab.',
'input_type': 'checkbox'
},
{'label': 'Movie Link Source',
@ -1895,7 +1895,7 @@ class HIPCHAT(Notifier):
'value': self.config['incl_card'],
'name': 'hipchat_incl_card',
'description': 'Include an info card with a poster and metadata with the notifications.<br>'
'Note: Imgur upload may need to be enabled under the notifications settings tab.<br>'
'Note: Image hosting must be enabled under the notifications settings tab.<br>'
'Note: This will change the notification type to HTML and emoticons will no longer work.',
'input_type': 'checkbox'
},
@ -2114,7 +2114,7 @@ class JOIN(Notifier):
'value': self.config['incl_poster'],
'name': 'join_incl_poster',
'description': 'Include a poster with the notifications.<br>'
'Note: Imgur upload may need to be enabled under the notifications settings tab.',
'Note: Image hosting must be enabled under the notifications settings tab.',
'input_type': 'checkbox'
},
{'label': 'Movie Link Source',
@ -3223,7 +3223,7 @@ class SLACK(Notifier):
'value': self.config['incl_card'],
'name': 'slack_incl_card',
'description': 'Include an info card with a poster and metadata with the notifications.<br>'
'Note: Imgur upload may need to be enabled under the notifications settings tab.',
'Note: Image hosting must be enabled under the notifications settings tab.',
'input_type': 'checkbox'
},
{'label': 'Include Plot Summaries',
@ -3455,7 +3455,7 @@ class TWITTER(Notifier):
'value': self.config['incl_poster'],
'name': 'twitter_incl_poster',
'description': 'Include a poster with the notifications.<br>'
'Note: Imgur upload may need to be enabled under the notifications settings tab.',
'Note: Image hosting must be enabled under the notifications settings tab.',
'input_type': 'checkbox'
}
]

View file

@ -2678,6 +2678,7 @@ class WebInterface(object):
"https_key": plexpy.CONFIG.HTTPS_KEY,
"https_domain": plexpy.CONFIG.HTTPS_DOMAIN,
"https_ip": plexpy.CONFIG.HTTPS_IP,
"http_base_url": plexpy.CONFIG.HTTP_BASE_URL,
"anon_redirect": plexpy.CONFIG.ANON_REDIRECT,
"api_enabled": checked(plexpy.CONFIG.API_ENABLED),
"api_key": plexpy.CONFIG.API_KEY,
@ -2719,7 +2720,7 @@ class WebInterface(object):
"refresh_users_on_startup": checked(plexpy.CONFIG.REFRESH_USERS_ON_STARTUP),
"logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL,
"notify_consecutive": checked(plexpy.CONFIG.NOTIFY_CONSECUTIVE),
"notify_upload_posters": checked(plexpy.CONFIG.NOTIFY_UPLOAD_POSTERS),
"notify_upload_posters": plexpy.CONFIG.NOTIFY_UPLOAD_POSTERS,
"notify_recently_added_upgrade": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_UPGRADE),
"notify_group_recently_added_grandparent": checked(plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_GRANDPARENT),
"notify_group_recently_added_parent": checked(plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_PARENT),
@ -2747,8 +2748,7 @@ class WebInterface(object):
"tvmaze_lookup": checked(plexpy.CONFIG.TVMAZE_LOOKUP),
"show_advanced_settings": plexpy.CONFIG.SHOW_ADVANCED_SETTINGS,
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR,
"newsletter_self_hosted": checked(plexpy.CONFIG.NEWSLETTER_SELF_HOSTED),
"newsletter_base_url": plexpy.CONFIG.NEWSLETTER_BASE_URL
"newsletter_self_hosted": checked(plexpy.CONFIG.NEWSLETTER_SELF_HOSTED)
}
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)
@ -2764,7 +2764,7 @@ class WebInterface(object):
"grouping_global_history", "grouping_user_history", "grouping_charts", "group_history_tables",
"pms_url_manual", "week_start_monday",
"refresh_libraries_on_startup", "refresh_users_on_startup",
"notify_consecutive", "notify_upload_posters", "notify_recently_added_upgrade",
"notify_consecutive", "notify_recently_added_upgrade",
"notify_group_recently_added_grandparent", "notify_group_recently_added_parent",
"monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password",
"allow_guest_access", "cache_images", "http_proxy", "http_basic_auth", "notify_concurrent_by_ip",