Compare commits
9 Commits
v2.1.11-be
...
v2.1.12
Author | SHA1 | Date | |
---|---|---|---|
![]() |
331be52327 | ||
![]() |
6ece690e23 | ||
![]() |
6b63a1399e | ||
![]() |
5c77cf652b | ||
![]() |
d6f9a82edb | ||
![]() |
a887489666 | ||
![]() |
8c0bcd0059 | ||
![]() |
c18ee81130 | ||
![]() |
44428cc6e5 |
8
API.md
8
API.md
@@ -2624,15 +2624,15 @@ Returns:
|
|||||||
|
|
||||||
|
|
||||||
### terminate_session
|
### terminate_session
|
||||||
Add a new notification agent.
|
Stop a streaming session.
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
session_id (str): The id of the session to terminate
|
session_key (int): The session key of the session to terminate, OR
|
||||||
message (str): A custom message to send to the client
|
session_id (str): The session id of the session to terminate
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
None
|
message (str): A custom message to send to the client
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
None
|
None
|
||||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,5 +1,15 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v2.1.12 (2018-06-08)
|
||||||
|
|
||||||
|
* Notifications:
|
||||||
|
* Change: Blank notification link source means disabled instead of default.
|
||||||
|
* Newsletters:
|
||||||
|
* New: Make collection tags available in the raw newsletter data for custom templates.
|
||||||
|
* API:
|
||||||
|
* New: Ability to terminate a stream using the session key.
|
||||||
|
|
||||||
|
|
||||||
## v2.1.11-beta (2018-06-02)
|
## v2.1.11-beta (2018-06-02)
|
||||||
|
|
||||||
* Monitoring:
|
* Monitoring:
|
||||||
|
@@ -675,6 +675,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'terminate_session',
|
url: 'terminate_session',
|
||||||
data: {
|
data: {
|
||||||
|
session_key: key,
|
||||||
session_id: session_id,
|
session_id: session_id,
|
||||||
message: message
|
message: message
|
||||||
},
|
},
|
||||||
|
@@ -42,6 +42,7 @@ import datafactory
|
|||||||
import libraries
|
import libraries
|
||||||
import logger
|
import logger
|
||||||
import mobile_app
|
import mobile_app
|
||||||
|
import newsletters
|
||||||
import newsletter_handler
|
import newsletter_handler
|
||||||
import notification_handler
|
import notification_handler
|
||||||
import notifiers
|
import notifiers
|
||||||
@@ -202,6 +203,7 @@ def initialize(config_file):
|
|||||||
logger.error(u"Could not perform upgrades: %s" % e)
|
logger.error(u"Could not perform upgrades: %s" % e)
|
||||||
|
|
||||||
# Add notifier configs to logger blacklist
|
# Add notifier configs to logger blacklist
|
||||||
|
newsletters.blacklist_logger()
|
||||||
notifiers.blacklist_logger()
|
notifiers.blacklist_logger()
|
||||||
mobile_app.blacklist_logger()
|
mobile_app.blacklist_logger()
|
||||||
|
|
||||||
@@ -516,7 +518,7 @@ def dbcheck():
|
|||||||
|
|
||||||
# sessions table :: This is a temp table that logs currently active sessions
|
# sessions table :: This is a temp table that logs currently active sessions
|
||||||
c_db.execute(
|
c_db.execute(
|
||||||
'CREATE TABLE IF NOT EXISTS sessions (id INTEGER PRIMARY KEY AUTOINCREMENT, session_key INTEGER, '
|
'CREATE TABLE IF NOT EXISTS sessions (id INTEGER PRIMARY KEY AUTOINCREMENT, session_key INTEGER, session_id TEXT, '
|
||||||
'transcode_key TEXT, rating_key INTEGER, section_id INTEGER, media_type TEXT, started INTEGER, stopped INTEGER, '
|
'transcode_key TEXT, rating_key INTEGER, section_id INTEGER, media_type TEXT, started INTEGER, stopped INTEGER, '
|
||||||
'paused_counter INTEGER DEFAULT 0, state TEXT, user_id INTEGER, user TEXT, friendly_name TEXT, '
|
'paused_counter INTEGER DEFAULT 0, state TEXT, user_id INTEGER, user TEXT, friendly_name TEXT, '
|
||||||
'ip_address TEXT, machine_id TEXT, player TEXT, product TEXT, platform TEXT, title TEXT, parent_title TEXT, '
|
'ip_address TEXT, machine_id TEXT, player TEXT, product TEXT, platform TEXT, title TEXT, parent_title TEXT, '
|
||||||
@@ -1079,6 +1081,15 @@ def dbcheck():
|
|||||||
'ALTER TABLE sessions ADD COLUMN live_uuid TEXT'
|
'ALTER TABLE sessions ADD COLUMN live_uuid TEXT'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Upgrade sessions table from earlier versions
|
||||||
|
try:
|
||||||
|
c_db.execute('SELECT session_id FROM sessions')
|
||||||
|
except sqlite3.OperationalError:
|
||||||
|
logger.debug(u"Altering database. Updating database table sessions.")
|
||||||
|
c_db.execute(
|
||||||
|
'ALTER TABLE sessions ADD COLUMN session_id TEXT'
|
||||||
|
)
|
||||||
|
|
||||||
# Upgrade sessions table from earlier versions
|
# Upgrade sessions table from earlier versions
|
||||||
try:
|
try:
|
||||||
c_db.execute('SELECT original_title FROM sessions')
|
c_db.execute('SELECT original_title FROM sessions')
|
||||||
|
@@ -34,6 +34,7 @@ class ActivityProcessor(object):
|
|||||||
def write_session(self, session=None, notify=True):
|
def write_session(self, session=None, notify=True):
|
||||||
if session:
|
if session:
|
||||||
values = {'session_key': session.get('session_key', ''),
|
values = {'session_key': session.get('session_key', ''),
|
||||||
|
'session_id': session.get('session_id', ''),
|
||||||
'transcode_key': session.get('transcode_key', ''),
|
'transcode_key': session.get('transcode_key', ''),
|
||||||
'section_id': session.get('section_id', ''),
|
'section_id': session.get('section_id', ''),
|
||||||
'rating_key': session.get('rating_key', ''),
|
'rating_key': session.get('rating_key', ''),
|
||||||
@@ -466,6 +467,16 @@ class ActivityProcessor(object):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_session_by_id(self, session_id=None):
|
||||||
|
if session_id:
|
||||||
|
session = self.db.select_single('SELECT * FROM sessions '
|
||||||
|
'WHERE session_id = ? ',
|
||||||
|
args=[session_id])
|
||||||
|
if session:
|
||||||
|
return session
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def set_session_state(self, session_key=None, state=None, **kwargs):
|
def set_session_state(self, session_key=None, state=None, **kwargs):
|
||||||
if str(session_key).isdigit():
|
if str(session_key).isdigit():
|
||||||
values = {}
|
values = {}
|
||||||
|
@@ -50,7 +50,9 @@ class Graphs(object):
|
|||||||
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
||||||
'FROM (SELECT * FROM session_history GROUP BY %s) AS session_history ' \
|
'FROM (SELECT * FROM session_history ' \
|
||||||
|
'GROUP BY date(started, "unixepoch", "localtime"), %s) ' \
|
||||||
|
'AS session_history ' \
|
||||||
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
|
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
|
||||||
'GROUP BY date_played ' \
|
'GROUP BY date_played ' \
|
||||||
'ORDER BY started ASC' % (group_by, time_range, user_cond)
|
'ORDER BY started ASC' % (group_by, time_range, user_cond)
|
||||||
@@ -147,7 +149,9 @@ class Graphs(object):
|
|||||||
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
||||||
'FROM (SELECT * FROM session_history GROUP BY %s) AS session_history ' \
|
'FROM (SELECT * FROM session_history ' \
|
||||||
|
'GROUP BY strftime("%%w", datetime(started, "unixepoch", "localtime")), %s) ' \
|
||||||
|
'AS session_history ' \
|
||||||
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
|
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
|
||||||
'GROUP BY dayofweek ' \
|
'GROUP BY dayofweek ' \
|
||||||
'ORDER BY daynumber' % (group_by, time_range, user_cond)
|
'ORDER BY daynumber' % (group_by, time_range, user_cond)
|
||||||
@@ -245,7 +249,9 @@ class Graphs(object):
|
|||||||
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
||||||
'FROM (SELECT * FROM session_history GROUP BY %s) AS session_history ' \
|
'FROM (SELECT * FROM session_history ' \
|
||||||
|
'GROUP BY strftime("%%H", datetime(started, "unixepoch", "localtime")) , %s) ' \
|
||||||
|
'AS session_history ' \
|
||||||
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
|
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
|
||||||
'GROUP BY hourofday ' \
|
'GROUP BY hourofday ' \
|
||||||
'ORDER BY hourofday' % (group_by, time_range, user_cond)
|
'ORDER BY hourofday' % (group_by, time_range, user_cond)
|
||||||
@@ -335,7 +341,9 @@ class Graphs(object):
|
|||||||
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
|
||||||
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
|
||||||
'FROM (SELECT * FROM session_history GROUP BY %s) AS session_history ' \
|
'FROM (SELECT * FROM session_history ' \
|
||||||
|
'GROUP BY strftime("%%Y-%%m", datetime(started, "unixepoch", "localtime")), %s) ' \
|
||||||
|
'AS session_history ' \
|
||||||
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s months", "localtime") %s' \
|
'WHERE datetime(started, "unixepoch", "localtime") >= datetime("now", "-%s months", "localtime") %s' \
|
||||||
'GROUP BY strftime("%%Y-%%m", datetime(started, "unixepoch", "localtime")) ' \
|
'GROUP BY strftime("%%Y-%%m", datetime(started, "unixepoch", "localtime")) ' \
|
||||||
'ORDER BY datestring DESC LIMIT %s' % (group_by, time_range, user_cond, time_range)
|
'ORDER BY datestring DESC LIMIT %s' % (group_by, time_range, user_cond, time_range)
|
||||||
@@ -591,7 +599,9 @@ class Graphs(object):
|
|||||||
'THEN 1 ELSE 0 END) AS ds_count, ' \
|
'THEN 1 ELSE 0 END) AS ds_count, ' \
|
||||||
'SUM(CASE WHEN session_history_media_info.transcode_decision = "transcode" ' \
|
'SUM(CASE WHEN session_history_media_info.transcode_decision = "transcode" ' \
|
||||||
'THEN 1 ELSE 0 END) AS tc_count ' \
|
'THEN 1 ELSE 0 END) AS tc_count ' \
|
||||||
'FROM (SELECT * FROM session_history GROUP BY %s) AS session_history ' \
|
'FROM (SELECT * FROM session_history ' \
|
||||||
|
'GROUP BY date(session_history.started, "unixepoch", "localtime"), %s) ' \
|
||||||
|
'AS session_history ' \
|
||||||
'JOIN session_history_media_info ON session_history.id = session_history_media_info.id ' \
|
'JOIN session_history_media_info ON session_history.id = session_history_media_info.id ' \
|
||||||
'WHERE (datetime(started, "unixepoch", "localtime") >= ' \
|
'WHERE (datetime(started, "unixepoch", "localtime") >= ' \
|
||||||
'datetime("now", "-%s days", "localtime")) AND ' \
|
'datetime("now", "-%s days", "localtime")) AND ' \
|
||||||
|
@@ -179,5 +179,5 @@ class HTTPHandler(object):
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"Failed format response from uri %s to %s error %s" % (self.uri, self.response_type, e))
|
logger.warn(u"Failed format response from uri %s to %s error %s" % (self.uri, self.output_format, e))
|
||||||
return None
|
return None
|
||||||
|
@@ -28,6 +28,7 @@ import traceback
|
|||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
import helpers
|
import helpers
|
||||||
|
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
||||||
|
|
||||||
# These settings are for file logging only
|
# These settings are for file logging only
|
||||||
FILENAME = "tautulli.log"
|
FILENAME = "tautulli.log"
|
||||||
@@ -48,6 +49,20 @@ logger_plex_websocket = logging.getLogger("plex_websocket")
|
|||||||
# Global queue for multiprocessing logging
|
# Global queue for multiprocessing logging
|
||||||
queue = None
|
queue = None
|
||||||
|
|
||||||
|
|
||||||
|
def blacklist_config(config):
|
||||||
|
blacklist = set()
|
||||||
|
blacklist_keys = ['HOOK', 'APIKEY', 'KEY', 'PASSWORD', 'TOKEN']
|
||||||
|
|
||||||
|
for key, value in config.iteritems():
|
||||||
|
if isinstance(value, basestring) and len(value.strip()) > 5 and \
|
||||||
|
key.upper() not in _WHITELIST_KEYS and (key.upper() in blacklist_keys or
|
||||||
|
any(bk in key.upper() for bk in _BLACKLIST_KEYS)):
|
||||||
|
blacklist.add(value.strip())
|
||||||
|
|
||||||
|
_BLACKLIST_WORDS.update(blacklist)
|
||||||
|
|
||||||
|
|
||||||
class NoThreadFilter(logging.Filter):
|
class NoThreadFilter(logging.Filter):
|
||||||
"""
|
"""
|
||||||
Log filter for the current thread
|
Log filter for the current thread
|
||||||
|
@@ -138,7 +138,5 @@ def set_last_seen(device_token=None):
|
|||||||
|
|
||||||
def blacklist_logger():
|
def blacklist_logger():
|
||||||
devices = get_mobile_devices()
|
devices = get_mobile_devices()
|
||||||
|
for d in devices:
|
||||||
blacklist = set(d['device_token'] for d in devices)
|
logger.blacklist_config(d)
|
||||||
|
|
||||||
logger._BLACKLIST_WORDS.update(blacklist)
|
|
||||||
|
@@ -196,6 +196,7 @@ def add_newsletter_config(agent_id=None, **kwargs):
|
|||||||
newsletter_id = db.last_insert_id()
|
newsletter_id = db.last_insert_id()
|
||||||
logger.info(u"Tautulli Newsletters :: Added new newsletter agent: %s (newsletter_id %s)."
|
logger.info(u"Tautulli Newsletters :: Added new newsletter agent: %s (newsletter_id %s)."
|
||||||
% (agent['label'], newsletter_id))
|
% (agent['label'], newsletter_id))
|
||||||
|
blacklist_logger()
|
||||||
return newsletter_id
|
return newsletter_id
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"Tautulli Newsletters :: Unable to add newsletter agent: %s." % e)
|
logger.warn(u"Tautulli Newsletters :: Unable to add newsletter agent: %s." % e)
|
||||||
@@ -254,6 +255,7 @@ def set_newsletter_config(newsletter_id=None, agent_id=None, **kwargs):
|
|||||||
logger.info(u"Tautulli Newsletters :: Updated newsletter agent: %s (newsletter_id %s)."
|
logger.info(u"Tautulli Newsletters :: Updated newsletter agent: %s (newsletter_id %s)."
|
||||||
% (agent['label'], newsletter_id))
|
% (agent['label'], newsletter_id))
|
||||||
newsletter_handler.schedule_newsletters(newsletter_id=newsletter_id)
|
newsletter_handler.schedule_newsletters(newsletter_id=newsletter_id)
|
||||||
|
blacklist_logger()
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warn(u"Tautulli Newsletters :: Unable to update newsletter agent: %s." % e)
|
logger.warn(u"Tautulli Newsletters :: Unable to update newsletter agent: %s." % e)
|
||||||
@@ -274,6 +276,17 @@ def send_newsletter(newsletter_id=None, subject=None, body=None, message=None, n
|
|||||||
logger.debug(u"Tautulli Newsletters :: Notification requested but no newsletter_id received.")
|
logger.debug(u"Tautulli Newsletters :: Notification requested but no newsletter_id received.")
|
||||||
|
|
||||||
|
|
||||||
|
def blacklist_logger():
|
||||||
|
db = database.MonitorDatabase()
|
||||||
|
notifiers = db.select('SELECT newsletter_config, email_config FROM newsletters')
|
||||||
|
|
||||||
|
for n in notifiers:
|
||||||
|
config = json.loads(n['newsletter_config'] or '{}')
|
||||||
|
logger.blacklist_config(config)
|
||||||
|
email_config = json.loads(n['email_config'] or '{}')
|
||||||
|
logger.blacklist_config(email_config)
|
||||||
|
|
||||||
|
|
||||||
def serve_template(templatename, **kwargs):
|
def serve_template(templatename, **kwargs):
|
||||||
if plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR:
|
if plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR:
|
||||||
template_dir = plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR
|
template_dir = plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR
|
||||||
|
@@ -62,7 +62,6 @@ import mobile_app
|
|||||||
import pmsconnect
|
import pmsconnect
|
||||||
import request
|
import request
|
||||||
import users
|
import users
|
||||||
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
|
||||||
|
|
||||||
|
|
||||||
BROWSER_NOTIFIERS = {}
|
BROWSER_NOTIFIERS = {}
|
||||||
@@ -612,17 +611,9 @@ def blacklist_logger():
|
|||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
notifiers = db.select('SELECT notifier_config FROM notifiers')
|
notifiers = db.select('SELECT notifier_config FROM notifiers')
|
||||||
|
|
||||||
blacklist = set()
|
|
||||||
blacklist_keys = ['hook', 'key', 'password', 'token']
|
|
||||||
|
|
||||||
for n in notifiers:
|
for n in notifiers:
|
||||||
config = json.loads(n['notifier_config'] or '{}')
|
config = json.loads(n['notifier_config'] or '{}')
|
||||||
for key, value in config.iteritems():
|
logger.blacklist_config(config)
|
||||||
if isinstance(value, basestring) and len(value.strip()) > 5 and \
|
|
||||||
key.upper() not in _WHITELIST_KEYS and (key.upper() in blacklist_keys or any(bk in key.upper() for bk in _BLACKLIST_KEYS)):
|
|
||||||
blacklist.add(value.strip())
|
|
||||||
|
|
||||||
logger._BLACKLIST_WORDS.update(blacklist)
|
|
||||||
|
|
||||||
|
|
||||||
class PrettyMetadata(object):
|
class PrettyMetadata(object):
|
||||||
@@ -682,13 +673,13 @@ class PrettyMetadata(object):
|
|||||||
provider_name = 'Trakt.tv'
|
provider_name = 'Trakt.tv'
|
||||||
elif provider == 'lastfm':
|
elif provider == 'lastfm':
|
||||||
provider_name = 'Last.fm'
|
provider_name = 'Last.fm'
|
||||||
else:
|
# else:
|
||||||
if self.media_type == 'movie':
|
# if self.media_type == 'movie':
|
||||||
provider_name = 'IMDb'
|
# provider_name = 'IMDb'
|
||||||
elif self.media_type in ('show', 'season', 'episode'):
|
# elif self.media_type in ('show', 'season', 'episode'):
|
||||||
provider_name = 'TheTVDB'
|
# provider_name = 'TheTVDB'
|
||||||
elif self.media_type in ('artist', 'album', 'track'):
|
# elif self.media_type in ('artist', 'album', 'track'):
|
||||||
provider_name = 'Last.fm'
|
# provider_name = 'Last.fm'
|
||||||
return provider_name
|
return provider_name
|
||||||
|
|
||||||
def get_provider_link(self, provider=None):
|
def get_provider_link(self, provider=None):
|
||||||
@@ -697,13 +688,13 @@ class PrettyMetadata(object):
|
|||||||
provider_link = self.get_plex_url()
|
provider_link = self.get_plex_url()
|
||||||
elif provider:
|
elif provider:
|
||||||
provider_link = self.parameters.get(provider + '_url', '')
|
provider_link = self.parameters.get(provider + '_url', '')
|
||||||
else:
|
# else:
|
||||||
if self.media_type == 'movie':
|
# if self.media_type == 'movie':
|
||||||
provider_link = self.parameters.get('imdb_url', '')
|
# provider_link = self.parameters.get('imdb_url', '')
|
||||||
elif self.media_type in ('show', 'season', 'episode'):
|
# elif self.media_type in ('show', 'season', 'episode'):
|
||||||
provider_link = self.parameters.get('thetvdb_url', '')
|
# provider_link = self.parameters.get('thetvdb_url', '')
|
||||||
elif self.media_type in ('artist', 'album', 'track'):
|
# elif self.media_type in ('artist', 'album', 'track'):
|
||||||
provider_link = self.parameters.get('lastfm_url', '')
|
# provider_link = self.parameters.get('lastfm_url', '')
|
||||||
return provider_link
|
return provider_link
|
||||||
|
|
||||||
def get_caption(self, provider):
|
def get_caption(self, provider):
|
||||||
@@ -711,6 +702,7 @@ class PrettyMetadata(object):
|
|||||||
return 'View on ' + provider_name
|
return 'View on ' + provider_name
|
||||||
|
|
||||||
def get_title(self, divider='-'):
|
def get_title(self, divider='-'):
|
||||||
|
title = ''
|
||||||
if self.media_type == 'movie':
|
if self.media_type == 'movie':
|
||||||
title = '%s (%s)' % (self.parameters['title'], self.parameters['year'])
|
title = '%s (%s)' % (self.parameters['title'], self.parameters['year'])
|
||||||
elif self.media_type == 'show':
|
elif self.media_type == 'show':
|
||||||
@@ -1251,7 +1243,7 @@ class DISCORD(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'discord_movie_provider',
|
'name': 'discord_movie_provider',
|
||||||
'description': 'Select the source for movie links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for movie links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -1259,7 +1251,7 @@ class DISCORD(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'discord_tv_provider',
|
'name': 'discord_tv_provider',
|
||||||
'description': 'Select the source for tv show links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -1267,7 +1259,7 @@ class DISCORD(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'discord_music_provider',
|
'name': 'discord_music_provider',
|
||||||
'description': 'Select the source for music links on the info cards. Leave blank for default.',
|
'description': 'Select the source for music links on the info cards. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
@@ -1600,7 +1592,7 @@ class FACEBOOK(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'facebook_movie_provider',
|
'name': 'facebook_movie_provider',
|
||||||
'description': 'Select the source for movie links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for movie links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -1608,7 +1600,7 @@ class FACEBOOK(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'facebook_tv_provider',
|
'name': 'facebook_tv_provider',
|
||||||
'description': 'Select the source for tv show links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -1616,7 +1608,7 @@ class FACEBOOK(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'facebook_music_provider',
|
'name': 'facebook_music_provider',
|
||||||
'description': 'Select the source for music links on the info cards. Leave blank for default.',
|
'description': 'Select the source for music links on the info cards. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
@@ -1936,7 +1928,7 @@ class HIPCHAT(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'hipchat_movie_provider',
|
'name': 'hipchat_movie_provider',
|
||||||
'description': 'Select the source for movie links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for movie links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -1944,7 +1936,7 @@ class HIPCHAT(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'hipchat_tv_provider',
|
'name': 'hipchat_tv_provider',
|
||||||
'description': 'Select the source for tv show links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -1952,7 +1944,7 @@ class HIPCHAT(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'hipchat_music_provider',
|
'name': 'hipchat_music_provider',
|
||||||
'description': 'Select the source for music links on the info cards. Leave blank for default.',
|
'description': 'Select the source for music links on the info cards. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
@@ -2144,7 +2136,7 @@ class JOIN(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'join_movie_provider',
|
'name': 'join_movie_provider',
|
||||||
'description': 'Select the source for movie links in the notificaation. Leave blank for default.<br>'
|
'description': 'Select the source for movie links in the notification. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -2152,7 +2144,7 @@ class JOIN(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'join_tv_provider',
|
'name': 'join_tv_provider',
|
||||||
'description': 'Select the source for tv show links in the notificaation. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links in the notification. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -2160,7 +2152,7 @@ class JOIN(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'join_music_provider',
|
'name': 'join_music_provider',
|
||||||
'description': 'Select the source for music links in the notificaation. Leave blank for default.',
|
'description': 'Select the source for music links in the notification. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
@@ -2450,7 +2442,8 @@ class PLEX(Notifier):
|
|||||||
else:
|
else:
|
||||||
return request.request_content(url)
|
return request.request_content(url)
|
||||||
|
|
||||||
def _sendjson(self, host, method, params={}):
|
def _sendjson(self, host, method, params=None):
|
||||||
|
params = params or {}
|
||||||
data = [{'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': params}]
|
data = [{'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': params}]
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
url = host + '/jsonrpc'
|
url = host + '/jsonrpc'
|
||||||
@@ -2928,7 +2921,7 @@ class PUSHOVER(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'pushover_movie_provider',
|
'name': 'pushover_movie_provider',
|
||||||
'description': 'Select the source for movie links in the notification. Leave blank for default.<br>'
|
'description': 'Select the source for movie links in the notification. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -2936,7 +2929,7 @@ class PUSHOVER(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'pushover_tv_provider',
|
'name': 'pushover_tv_provider',
|
||||||
'description': 'Select the source for tv show links in the notification. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links in the notification. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -2944,7 +2937,7 @@ class PUSHOVER(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'pushover_music_provider',
|
'name': 'pushover_music_provider',
|
||||||
'description': 'Select the source for music links in the notification. Leave blank for default.',
|
'description': 'Select the source for music links in the notification. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
@@ -3303,7 +3296,7 @@ class SLACK(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'slack_movie_provider',
|
'name': 'slack_movie_provider',
|
||||||
'description': 'Select the source for movie links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for movie links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -3311,7 +3304,7 @@ class SLACK(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'slack_tv_provider',
|
'name': 'slack_tv_provider',
|
||||||
'description': 'Select the source for tv show links on the info cards. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links on the info cards. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -3319,7 +3312,7 @@ class SLACK(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'slack_music_provider',
|
'name': 'slack_music_provider',
|
||||||
'description': 'Select the source for music links on the info cards. Leave blank for default.',
|
'description': 'Select the source for music links on the info cards. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
@@ -3553,7 +3546,8 @@ class XBMC(Notifier):
|
|||||||
else:
|
else:
|
||||||
return request.request_content(url)
|
return request.request_content(url)
|
||||||
|
|
||||||
def _sendjson(self, host, method, params={}):
|
def _sendjson(self, host, method, params=None):
|
||||||
|
params = params or {}
|
||||||
data = [{'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': params}]
|
data = [{'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': params}]
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
url = host + '/jsonrpc'
|
url = host + '/jsonrpc'
|
||||||
@@ -3714,7 +3708,7 @@ class ZAPIER(Notifier):
|
|||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'zapier_movie_provider',
|
'name': 'zapier_movie_provider',
|
||||||
'description': 'Select the source for movie links in the notification. Leave blank for default.<br>'
|
'description': 'Select the source for movie links in the notification. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_movie_providers()
|
'select_options': PrettyMetadata().get_movie_providers()
|
||||||
@@ -3722,7 +3716,7 @@ class ZAPIER(Notifier):
|
|||||||
{'label': 'TV Show Link Source',
|
{'label': 'TV Show Link Source',
|
||||||
'value': self.config['tv_provider'],
|
'value': self.config['tv_provider'],
|
||||||
'name': 'zapier_tv_provider',
|
'name': 'zapier_tv_provider',
|
||||||
'description': 'Select the source for tv show links in the notification. Leave blank for default.<br>'
|
'description': 'Select the source for tv show links in the notification. Leave blank to disable.<br>'
|
||||||
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
'Note: 3rd party API lookup may need to be enabled under the notifications settings tab.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_tv_providers()
|
'select_options': PrettyMetadata().get_tv_providers()
|
||||||
@@ -3730,7 +3724,7 @@ class ZAPIER(Notifier):
|
|||||||
{'label': 'Music Link Source',
|
{'label': 'Music Link Source',
|
||||||
'value': self.config['music_provider'],
|
'value': self.config['music_provider'],
|
||||||
'name': 'zapier_music_provider',
|
'name': 'zapier_music_provider',
|
||||||
'description': 'Select the source for music links in the notification. Leave blank for default.',
|
'description': 'Select the source for music links in the notification. Leave blank to disable.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': PrettyMetadata().get_music_providers()
|
'select_options': PrettyMetadata().get_music_providers()
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ import time
|
|||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
|
import activity_processor
|
||||||
import common
|
import common
|
||||||
import helpers
|
import helpers
|
||||||
import http_handler
|
import http_handler
|
||||||
@@ -482,6 +483,7 @@ class PmsConnect(object):
|
|||||||
actors = []
|
actors = []
|
||||||
genres = []
|
genres = []
|
||||||
labels = []
|
labels = []
|
||||||
|
collections = []
|
||||||
|
|
||||||
if m.getElementsByTagName('Director'):
|
if m.getElementsByTagName('Director'):
|
||||||
for director in m.getElementsByTagName('Director'):
|
for director in m.getElementsByTagName('Director'):
|
||||||
@@ -503,6 +505,10 @@ class PmsConnect(object):
|
|||||||
for label in m.getElementsByTagName('Label'):
|
for label in m.getElementsByTagName('Label'):
|
||||||
labels.append(helpers.get_xml_attr(label, 'tag'))
|
labels.append(helpers.get_xml_attr(label, 'tag'))
|
||||||
|
|
||||||
|
if m.getElementsByTagName('Collection'):
|
||||||
|
for collection in m.getElementsByTagName('Collection'):
|
||||||
|
collections.append(helpers.get_xml_attr(collection, 'tag'))
|
||||||
|
|
||||||
recent_item = {'media_type': helpers.get_xml_attr(m, 'type'),
|
recent_item = {'media_type': helpers.get_xml_attr(m, 'type'),
|
||||||
'section_id': helpers.get_xml_attr(m, 'librarySectionID'),
|
'section_id': helpers.get_xml_attr(m, 'librarySectionID'),
|
||||||
'library_name': helpers.get_xml_attr(m, 'librarySectionTitle'),
|
'library_name': helpers.get_xml_attr(m, 'librarySectionTitle'),
|
||||||
@@ -540,6 +546,7 @@ class PmsConnect(object):
|
|||||||
'actors': actors,
|
'actors': actors,
|
||||||
'genres': genres,
|
'genres': genres,
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
|
'collections': collections,
|
||||||
'full_title': helpers.get_xml_attr(m, 'title'),
|
'full_title': helpers.get_xml_attr(m, 'title'),
|
||||||
'child_count': helpers.get_xml_attr(m, 'childCount')
|
'child_count': helpers.get_xml_attr(m, 'childCount')
|
||||||
}
|
}
|
||||||
@@ -1919,7 +1926,7 @@ class PmsConnect(object):
|
|||||||
|
|
||||||
return session_output
|
return session_output
|
||||||
|
|
||||||
def terminate_session(self, session_id='', message=''):
|
def terminate_session(self, session_key='', session_id='', message=''):
|
||||||
"""
|
"""
|
||||||
Terminates a streaming session.
|
Terminates a streaming session.
|
||||||
|
|
||||||
@@ -1927,10 +1934,22 @@ class PmsConnect(object):
|
|||||||
"""
|
"""
|
||||||
message = message or 'The server owner has ended the stream.'
|
message = message or 'The server owner has ended the stream.'
|
||||||
|
|
||||||
|
if session_key and not session_id:
|
||||||
|
ap = activity_processor.ActivityProcessor()
|
||||||
|
session = ap.get_session_by_key(session_key=session_key)
|
||||||
|
session_id = session['session_id']
|
||||||
|
|
||||||
|
elif session_id and not session_key:
|
||||||
|
ap = activity_processor.ActivityProcessor()
|
||||||
|
session = ap.get_session_by_id(session_id=session_id)
|
||||||
|
session_key = session['session_key']
|
||||||
|
|
||||||
if session_id:
|
if session_id:
|
||||||
|
logger.info(u"Tautulli Pmsconnect :: Terminating session %s (session_id %s)." % (session_key, session_id))
|
||||||
result = self.get_sessions_terminate(session_id=session_id, reason=urllib.quote_plus(message))
|
result = self.get_sessions_terminate(session_id=session_id, reason=urllib.quote_plus(message))
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
|
logger.warn(u"Tautulli Pmsconnect :: Failed to terminate session %s. Missing session_id." % session_key)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_item_children(self, rating_key='', get_grandchildren=False):
|
def get_item_children(self, rating_key='', get_grandchildren=False):
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
PLEXPY_BRANCH = "beta"
|
PLEXPY_BRANCH = "master"
|
||||||
PLEXPY_RELEASE_VERSION = "v2.1.11-beta"
|
PLEXPY_RELEASE_VERSION = "v2.1.12"
|
||||||
|
@@ -248,23 +248,23 @@ class WebInterface(object):
|
|||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def terminate_session(self, session_id=None, message=None, **kwargs):
|
def terminate_session(self, session_key=None, session_id=None, message=None, **kwargs):
|
||||||
""" Add a new notification agent.
|
""" Stop a streaming session.
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
session_id (str): The id of the session to terminate
|
session_key (int): The session key of the session to terminate, OR
|
||||||
message (str): A custom message to send to the client
|
session_id (str): The session id of the session to terminate
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
None
|
message (str): A custom message to send to the client
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
None
|
None
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
result = pms_connect.terminate_session(session_id=session_id, message=message)
|
result = pms_connect.terminate_session(session_key=session_key, session_id=session_id, message=message)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return {'result': 'success', 'message': 'Session terminated.'}
|
return {'result': 'success', 'message': 'Session terminated.'}
|
||||||
|
Reference in New Issue
Block a user