From b8e1884583e86da5f352d7700da7b733c8b5047b Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 2 Dec 2011 17:28:57 -0500 Subject: [PATCH] CC-3155: Show doesn't resume playback on system crash / restarting pypo -fixed --- python_apps/pypo/pypofetch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index f9dbaffe9..c0dffd9eb 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -314,9 +314,9 @@ class PypoFetch(Thread): ls_playlist = [] - dtnow = datetime.today() + dtnow = datetime.utcnow() str_tnow_s = dtnow.strftime('%Y-%m-%d-%H-%M-%S') - + sortedKeys = sorted(playlist['medias'].iterkeys()) for key in sortedKeys: @@ -326,14 +326,14 @@ class PypoFetch(Thread): if bootstrapping: start = media['start'] end = media['end'] - + if end <= str_tnow_s: continue elif start <= str_tnow_s and str_tnow_s < end: #song is currently playing and we just started pypo. Maybe there #was a power outage? Let's restart playback of this song. start_split = map(int, start.split('-')) - media_start = datetime(start_split[0], start_split[1], start_split[2], start_split[3], start_split[4], start_split[5]) + media_start = datetime(start_split[0], start_split[1], start_split[2], start_split[3], start_split[4], start_split[5], 0, None) logger.debug("Found media item that started at %s.", media_start) delta = dtnow - media_start #we get a TimeDelta object from this operation