mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Merge pull request #218 from JonnyWong16/miscellaneous-fixes
Change to notify stopped only if less than watched percent
This commit is contained in:
commit
34167495ed
10 changed files with 50 additions and 15 deletions
|
@ -106,7 +106,12 @@ DOCUMENTATION :: END
|
|||
</div>
|
||||
<div id="stream-${a['session_key']}" class="dashboard-activity-info-details-overlay">
|
||||
<div class="dashboard-activity-info-details-content">
|
||||
<div class="dashboard-activity-info-platform" id="platform-${a['session_key']}">
|
||||
<div id="platform-${a['session_key']}" title="${a['platform']}">
|
||||
<script>
|
||||
$("#platform-${a['session_key']}").html("<div class='dashboard-activity-info-platform-box' style='background-image: url(" + getPlatformImagePath('${a['platform']}') + ");'>");
|
||||
</script>
|
||||
</div>
|
||||
<div class="dashboard-activity-info-platform">
|
||||
<strong>${a['player']}</strong><br />
|
||||
% if a['state'] == 'playing':
|
||||
State <strong>Playing</strong>
|
||||
|
@ -249,9 +254,6 @@ DOCUMENTATION :: END
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("#platform-${a['session_key']}").prepend("<div class='dashboard-activity-info-platform-box' style='background-image: url(" + getPlatformImagePath('${a['platform']}') + ");'>");
|
||||
</script>
|
||||
|
||||
% endfor
|
||||
<script>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
type: "post",
|
||||
data: function ( d ) {
|
||||
return { 'json_data': JSON.stringify( d ),
|
||||
'grouping': false,
|
||||
'start_date': '${data}'
|
||||
};
|
||||
}
|
||||
|
|
|
@ -213,11 +213,11 @@ function getPlatformImagePath(platformName) {
|
|||
return 'interfaces/default/images/platforms/opera.png';
|
||||
} else if (platformName.indexOf("KODI") > -1) {
|
||||
return 'interfaces/default/images/platforms/kodi.png';
|
||||
} else if (platformName.indexOf("Mystery 3") > -1) {
|
||||
} else if (platformName.indexOf("Playstation 3") > -1) {
|
||||
return 'interfaces/default/images/platforms/playstation.png';
|
||||
} else if (platformName.indexOf("Mystery 4") > -1) {
|
||||
} else if (platformName.indexOf("Playstation 4") > -1) {
|
||||
return 'interfaces/default/images/platforms/playstation.png';
|
||||
} else if (platformName.indexOf("Mystery 5") > -1) {
|
||||
} else if (platformName.indexOf("Xbox 360") > -1) {
|
||||
return 'interfaces/default/images/platforms/xbox.png';
|
||||
} else if (platformName.indexOf("Windows") > -1) {
|
||||
return 'interfaces/default/images/platforms/win8.png';
|
||||
|
|
|
@ -312,7 +312,7 @@ available_notification_agents = notifiers.available_notification_agents()
|
|||
<input type="text" class="form-control" id="pms_logs_folder" name="pms_logs_folder" value="${config['pms_logs_folder']}" size="30" data-parsley-trigger="change">
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">Set the folder where your Plex Server logs are. This is required if you enable IP logging.<br /><a href="https://support.plex.tv/hc/en-us/articles/200250417-Plex-Media-Server-Log-Files" target="_blank">Click here</a> for help.</p>
|
||||
<p class="help-block">Set the complete folder path where your Plex Server logs are, shortcuts are not recognized.<br /><a href="https://support.plex.tv/hc/en-us/articles/200250417-Plex-Media-Server-Log-Files" target="_blank">Click here</a> for help. This is required if you enable IP logging. </p>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
||||
|
@ -496,6 +496,12 @@ available_notification_agents = notifiers.available_notification_agents()
|
|||
</div>
|
||||
<p class="help-block">Set the progress percentage of when a watched notification should be triggered. Minimum 50, Maximum 95.</p>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="notify_consecutive" id="notify_consecutive" value="1" ${config['notify_consecutive']}> Allow Consecutive Notifications
|
||||
</label>
|
||||
<p class="help-block">Disable to prevent consecutive notifications (i.e. both watched & stopped notifications).</p>
|
||||
</div>
|
||||
|
||||
<div class="padded-header">
|
||||
<h3>Custom Notification Messages</h3>
|
||||
|
|
|
@ -122,6 +122,7 @@ _CONFIG_DEFINITIONS = {
|
|||
'NMA_ON_RESUME': (int, 'NMA', 0),
|
||||
'NMA_ON_BUFFER': (int, 'NMA', 0),
|
||||
'NMA_ON_WATCHED': (int, 'NMA', 0),
|
||||
'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1),
|
||||
'NOTIFY_WATCHED_PERCENT': (int, 'Monitoring', 85),
|
||||
'NOTIFY_ON_START_SUBJECT_TEXT': (str, 'Monitoring', 'PlexPy ({server_name})'),
|
||||
'NOTIFY_ON_START_BODY_TEXT': (str, 'Monitoring', '{user} ({player}) started playing {title}.'),
|
||||
|
|
|
@ -502,11 +502,17 @@ class DataFactory(object):
|
|||
return None
|
||||
|
||||
for item in result:
|
||||
# Rename Mystery platform names
|
||||
platform_names = {'Mystery 3': 'Playstation 3',
|
||||
'Mystery 4': 'Playstation 4',
|
||||
'Mystery 5': 'Xbox 360'}
|
||||
platform_type = platform_names.get(item[0], item[0])
|
||||
|
||||
row = {'platform': item[0],
|
||||
'total_plays': item[1],
|
||||
'total_duration': item[2],
|
||||
'last_play': item[3],
|
||||
'platform_type': item[0],
|
||||
'platform_type': platform_type,
|
||||
'title': '',
|
||||
'thumb': '',
|
||||
'grandparent_thumb': '',
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from plexpy import logger, config, notifiers, database
|
||||
from plexpy import logger, config, notifiers, database, helpers
|
||||
|
||||
import plexpy
|
||||
import time
|
||||
|
@ -33,6 +33,8 @@ def notify(stream_data=None, notify_action=None):
|
|||
if stream_data['media_type'] == 'movie' or stream_data['media_type'] == 'episode':
|
||||
if plexpy.CONFIG.MOVIE_NOTIFY_ENABLE or plexpy.CONFIG.TV_NOTIFY_ENABLE:
|
||||
|
||||
progress_percent = helpers.get_percent(stream_data['view_offset'], stream_data['duration'])
|
||||
|
||||
for agent in notifiers.available_notification_agents():
|
||||
if agent['on_play'] and notify_action == 'play':
|
||||
# Build and send notification
|
||||
|
@ -43,7 +45,8 @@ def notify(stream_data=None, notify_action=None):
|
|||
# Set the notification state in the db
|
||||
set_notify_state(session=stream_data, state='play', agent_info=agent)
|
||||
|
||||
elif agent['on_stop'] and notify_action == 'stop':
|
||||
elif agent['on_stop'] and notify_action == 'stop' \
|
||||
and (plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < plexpy.CONFIG.NOTIFY_WATCHED_PERCENT):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
|
@ -52,7 +55,8 @@ def notify(stream_data=None, notify_action=None):
|
|||
|
||||
set_notify_state(session=stream_data, state='stop', agent_info=agent)
|
||||
|
||||
elif agent['on_pause'] and notify_action == 'pause':
|
||||
elif agent['on_pause'] and notify_action == 'pause' \
|
||||
and (plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < 99):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
|
@ -61,7 +65,8 @@ def notify(stream_data=None, notify_action=None):
|
|||
|
||||
set_notify_state(session=stream_data, state='pause', agent_info=agent)
|
||||
|
||||
elif agent['on_resume'] and notify_action == 'resume':
|
||||
elif agent['on_resume'] and notify_action == 'resume' \
|
||||
and (plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < 99):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
|
|
|
@ -1070,6 +1070,13 @@ class PmsConnect(object):
|
|||
else:
|
||||
logger.warn(u"No known stream types found in session list.")
|
||||
|
||||
# Rename Mystery platform names
|
||||
platform_names = {'Mystery 3': 'Playstation 3',
|
||||
'Mystery 4': 'Playstation 4',
|
||||
'Mystery 5': 'Xbox 360'}
|
||||
session_output['platform'] = platform_names.get(session_output['platform'],
|
||||
session_output['platform'])
|
||||
|
||||
return session_output
|
||||
|
||||
"""
|
||||
|
|
|
@ -516,8 +516,14 @@ class Users(object):
|
|||
return None
|
||||
|
||||
for item in result:
|
||||
# Rename Mystery platform names
|
||||
platform_names = {'Mystery 3': 'Playstation 3',
|
||||
'Mystery 4': 'Playstation 4',
|
||||
'Mystery 5': 'Xbox 360'}
|
||||
platform_type = platform_names.get(item[2], item[2])
|
||||
|
||||
row = {'platform_name': item[0],
|
||||
'platform_type': item[2],
|
||||
'platform_type': platform_type,
|
||||
'total_plays': item[1],
|
||||
'result_id': result_id
|
||||
}
|
||||
|
|
|
@ -439,6 +439,7 @@ class WebInterface(object):
|
|||
"music_logging_enable": checked(plexpy.CONFIG.MUSIC_LOGGING_ENABLE),
|
||||
"logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL,
|
||||
"pms_is_remote": checked(plexpy.CONFIG.PMS_IS_REMOTE),
|
||||
"notify_consecutive": checked(plexpy.CONFIG.NOTIFY_CONSECUTIVE),
|
||||
"notify_watched_percent": plexpy.CONFIG.NOTIFY_WATCHED_PERCENT,
|
||||
"notify_on_start_subject_text": plexpy.CONFIG.NOTIFY_ON_START_SUBJECT_TEXT,
|
||||
"notify_on_start_body_text": plexpy.CONFIG.NOTIFY_ON_START_BODY_TEXT,
|
||||
|
@ -476,7 +477,7 @@ class WebInterface(object):
|
|||
"tv_notify_on_stop", "movie_notify_on_stop", "music_notify_on_stop",
|
||||
"tv_notify_on_pause", "movie_notify_on_pause", "music_notify_on_pause", "refresh_users_on_startup",
|
||||
"ip_logging_enable", "video_logging_enable", "music_logging_enable", "pms_is_remote", "home_stats_type",
|
||||
"group_history_tables"
|
||||
"group_history_tables", "notify_consecutive"
|
||||
]
|
||||
for checked_config in checked_configs:
|
||||
if checked_config not in kwargs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue