forked from openlp/openlp
Add time to media loop as a guard
bzr-revno: 1402
This commit is contained in:
commit
adaddf8eab
@ -24,6 +24,7 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -139,11 +140,16 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
file_size = os.path.getsize(filename)
|
file_size = os.path.getsize(filename)
|
||||||
# File too big for processing
|
# File too big for processing
|
||||||
if file_size <= 52428800: # 50MiB
|
if file_size <= 52428800: # 50MiB
|
||||||
|
start = datetime.now()
|
||||||
while not self.mediaState:
|
while not self.mediaState:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
service_item.media_length = self.mediaLength
|
tme = datetime.now() - start
|
||||||
service_item.add_capability(
|
if tme.seconds > 5:
|
||||||
ItemCapabilities.AllowsVariableStartTime)
|
break
|
||||||
|
if self.mediaState:
|
||||||
|
service_item.media_length = self.mediaLength
|
||||||
|
service_item.add_capability(
|
||||||
|
ItemCapabilities.AllowsVariableStartTime)
|
||||||
service_item.add_from_command(path, name, frame)
|
service_item.add_from_command(path, name, frame)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@ -189,4 +195,4 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
if newState == Phonon.PlayingState:
|
if newState == Phonon.PlayingState:
|
||||||
self.mediaState = newState
|
self.mediaState = newState
|
||||||
self.mediaLength = self.mediaObject.totalTime()/1000
|
self.mediaLength = self.mediaObject.totalTime()/1000
|
||||||
self.mediaObject.stop()
|
self.mediaObject.stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user