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