Updated {progress_time} to use time format from settings

This commit is contained in:
Shahab Lashkari 2016-01-24 12:40:46 -08:00
commit 5e2b02c13d
3 changed files with 2 additions and 10 deletions

View file

@ -1146,7 +1146,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</tr> </tr>
<tr> <tr>
<td><strong>{progress_time}</strong></td> <td><strong>{progress_time}</strong></td>
<td>The last reported offset (in HH:MM:SS) for the item.</td> <td>The last reported offset (in time format) for the item.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{progress_percent}</strong></td> <td><strong>{progress_percent}</strong></td>

View file

@ -146,14 +146,6 @@ def now():
now = datetime.datetime.now() now = datetime.datetime.now()
return now.strftime("%Y-%m-%d %H:%M:%S") return now.strftime("%Y-%m-%d %H:%M:%S")
def human_progress(ms):
hp = ''
if str(ms).isdigit():
seconds = float(ms)/1000
gmtime = time.gmtime(seconds)
hp = time.strftime("%H:%M:%S", gmtime)
return hp
def human_duration(s, sig='dhms'): def human_duration(s, sig='dhms'):
hd = '' hd = ''

View file

@ -484,7 +484,6 @@ def build_notify_text(session=None, timeline=None, state=None):
stream_duration = int((time.time() - helpers.cast_to_float(session['started'])) / 60) stream_duration = int((time.time() - helpers.cast_to_float(session['started'])) / 60)
view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset']) view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset'])
progress_time = helpers.human_progress(session['view_offset'])
user = session['friendly_name'] user = session['friendly_name']
platform = session['platform'] platform = session['platform']
player = session['player'] player = session['player']
@ -507,6 +506,7 @@ def build_notify_text(session=None, timeline=None, state=None):
transcode_audio_channels = session['transcode_audio_channels'] transcode_audio_channels = session['transcode_audio_channels']
progress_percent = helpers.get_percent(view_offset, duration) progress_percent = helpers.get_percent(view_offset, duration)
progress_time = arrow.get(helpers.cast_to_int(session['view_offset'])/1000).format(plexpy.CONFIG.TIME_FORMAT.replace('zz','').replace('a','').replace('A','').replace('h',''))
# Fix metadata params for notify recently added grandparent # Fix metadata params for notify recently added grandparent
if state == 'created' and plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_GRANDPARENT: if state == 'created' and plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_GRANDPARENT: