mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 00:06:07 -07:00
Fix stream_duration when notify state is play.
This commit is contained in:
parent
ac9a8b85ec
commit
ac3bafcd02
1 changed files with 11 additions and 5 deletions
|
@ -162,6 +162,7 @@ def notify(stream_data=None, notify_action=None):
|
||||||
else:
|
else:
|
||||||
logger.debug(u"PlexPy Notifier :: Notify called but incomplete data received.")
|
logger.debug(u"PlexPy Notifier :: Notify called but incomplete data received.")
|
||||||
|
|
||||||
|
|
||||||
def get_notify_state(session):
|
def get_notify_state(session):
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
result = monitor_db.select('SELECT on_play, on_stop, on_pause, on_resume, on_buffer, on_watched, agent_id '
|
result = monitor_db.select('SELECT on_play, on_stop, on_pause, on_resume, on_buffer, on_watched, agent_id '
|
||||||
|
@ -184,6 +185,7 @@ def get_notify_state(session):
|
||||||
|
|
||||||
return notify_states
|
return notify_states
|
||||||
|
|
||||||
|
|
||||||
def set_notify_state(session, state, agent_info):
|
def set_notify_state(session, state, agent_info):
|
||||||
|
|
||||||
if session and state and agent_info:
|
if session and state and agent_info:
|
||||||
|
@ -215,6 +217,7 @@ def set_notify_state(session, state, agent_info):
|
||||||
else:
|
else:
|
||||||
logger.error('PlexPy Notifier :: Unable to set notify state.')
|
logger.error('PlexPy Notifier :: Unable to set notify state.')
|
||||||
|
|
||||||
|
|
||||||
def build_notify_text(session, state):
|
def build_notify_text(session, state):
|
||||||
from plexpy import pmsconnect, helpers
|
from plexpy import pmsconnect, helpers
|
||||||
import re
|
import re
|
||||||
|
@ -300,6 +303,8 @@ def build_notify_text(session, state):
|
||||||
|
|
||||||
duration = helpers.convert_milliseconds_to_minutes(item_metadata['duration'])
|
duration = helpers.convert_milliseconds_to_minutes(item_metadata['duration'])
|
||||||
view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset'])
|
view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset'])
|
||||||
|
stream_duration = 0
|
||||||
|
if state != 'play':
|
||||||
if session['paused_counter']:
|
if session['paused_counter']:
|
||||||
stream_duration = int((time.time() - helpers.cast_to_float(session['started']) -
|
stream_duration = int((time.time() - helpers.cast_to_float(session['started']) -
|
||||||
helpers.cast_to_float(session['paused_counter'])) / 60)
|
helpers.cast_to_float(session['paused_counter'])) / 60)
|
||||||
|
@ -483,6 +488,7 @@ def build_notify_text(session, state):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def strip_tag(data):
|
def strip_tag(data):
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue