diff --git a/plexpy/config.py b/plexpy/config.py index 7afbee09..027965ff 100644 --- a/plexpy/config.py +++ b/plexpy/config.py @@ -212,6 +212,25 @@ _CONFIG_DEFINITIONS = { 'HTTP_PROXY': (int, 'General', 0), 'HTTP_ROOT': (str, 'General', ''), 'HTTP_USERNAME': (str, 'General', ''), + 'HIPCHAT_URL': (str, 'Hipchat', ''), + 'HIPCHAT_COLOR': (str, 'Hipchat', 'green'), + 'HIPCHAT_INCL_SUBJECT': (int, 'Hipchat', 1), + 'HIPCHAT_INCL_EMOTICON': (int, 'Hipchat', 0), + 'HIPCHAT_ENABLED': (int, 'Hipchat', 0), + 'HIPCHAT_ON_PLAY': (int, 'Hipchat', 0), + 'HIPCHAT_ON_STOP': (int, 'Hipchat', 0), + 'HIPCHAT_ON_PAUSE': (int, 'Hipchat', 0), + 'HIPCHAT_ON_RESUME': (int, 'Hipchat', 0), + 'HIPCHAT_ON_BUFFER': (int, 'Hipchat', 0), + 'HIPCHAT_ON_WATCHED': (int, 'Hipchat', 0), + 'HIPCHAT_ON_CREATED': (int, 'Hipchat', 0), + 'HIPCHAT_ON_EXTDOWN': (int, 'Hipchat', 0), + 'HIPCHAT_ON_INTDOWN': (int, 'Hipchat', 0), + 'HIPCHAT_ON_EXTUP': (int, 'Hipchat', 0), + 'HIPCHAT_ON_INTUP': (int, 'Hipchat', 0), + 'HIPCHAT_ON_PMSUPDATE': (int, 'Hipchat', 0), + 'HIPCHAT_ON_CONCURRENT': (int, 'Hipchat', 0), + 'HIPCHAT_ON_NEWDEVICE': (int, 'Hipchat', 0), 'INTERFACE': (str, 'General', 'default'), 'IP_LOGGING_ENABLE': (int, 'General', 0), 'IFTTT_KEY': (str, 'IFTTT', ''), @@ -250,23 +269,6 @@ _CONFIG_DEFINITIONS = { 'JOIN_ON_PMSUPDATE': (int, 'Join', 0), 'JOIN_ON_CONCURRENT': (int, 'Join', 0), 'JOIN_ON_NEWDEVICE': (int, 'Join', 0), - 'HIPCHAT_URL': (str, 'Hipchat', ''), - 'HIPCHAT_COLOR': (str, 'Hipchat', 'green'), - 'HIPCHAT_ENABLED': (int, 'Hipchat', 0), - 'HIPCHAT_ON_PLAY': (int, 'Hipchat', 0), - 'HIPCHAT_ON_STOP': (int, 'Hipchat', 0), - 'HIPCHAT_ON_PAUSE': (int, 'Hipchat', 0), - 'HIPCHAT_ON_RESUME': (int, 'Hipchat', 0), - 'HIPCHAT_ON_BUFFER': (int, 'Hipchat', 0), - 'HIPCHAT_ON_WATCHED': (int, 'Hipchat', 0), - 'HIPCHAT_ON_CREATED': (int, 'Hipchat', 0), - 'HIPCHAT_ON_EXTDOWN': (int, 'Hipchat', 0), - 'HIPCHAT_ON_INTDOWN': (int, 'Hipchat', 0), - 'HIPCHAT_ON_EXTUP': (int, 'Hipchat', 0), - 'HIPCHAT_ON_INTUP': (int, 'Hipchat', 0), - 'HIPCHAT_ON_PMSUPDATE': (int, 'Hipchat', 0), - 'HIPCHAT_ON_CONCURRENT': (int, 'Hipchat', 0), - 'HIPCHAT_ON_NEWDEVICE': (int, 'Hipchat', 0), 'JOURNAL_MODE': (str, 'Advanced', 'wal'), 'LAUNCH_BROWSER': (int, 'General', 1), 'LOG_BLACKLIST': (int, 'General', 1), diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 8c513ae7..d8064f42 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -2754,12 +2754,20 @@ class HIPCHAT(object): def __init__(self): self.apiurl = plexpy.CONFIG.HIPCHAT_URL self.color = plexpy.CONFIG.HIPCHAT_COLOR + self.incl_subject = plexpy.CONFIG.HIPCHAT_INCL_SUBJECT + self.incl_emoticon = plexpy.CONFIG.HIPCHAT_INCL_EMOTICON def notify(self, message, subject): if not message or not subject: return - text = '(plex) ' + subject.encode('utf-8') + ': ' + message.encode('utf-8') + if self.incl_subject: + text = subject.encode('utf-8') + ': ' + message.encode('utf-8') + else: + text = message.encode('utf-8') + + if self.incl_emoticon: + text = '(plex) ' + text data = {'color': self.color, 'message': text, @@ -2811,8 +2819,20 @@ class HIPCHAT(object): 'description': 'Color for the message to show up in your room. You' ' may use any valid Hipchat message color value.', 'input_type': 'text' + }, + {'label': 'Include Subject Line', + 'value': self.incl_subject, + 'name': 'hipchat_incl_subject', + 'description': 'Include the subject line with the notifications.', + 'input_type': 'checkbox' + }, + {'label': 'Include (plex) emoticon', + 'value': self.incl_emoticon, + 'name': 'hipchat_incl_emoticon', + 'description': 'Include (plex) emoticon tag at the beginning of all notifications.' + ' Create a custom emoticon here.', + 'input_type': 'checkbox' } - ] return config_option \ No newline at end of file