bugfixing

This commit is contained in:
rimach 2011-11-24 22:10:37 +01:00
parent 870a70ab3a
commit d7f38caccd
7 changed files with 79 additions and 47 deletions

View File

@ -387,7 +387,7 @@ class MainDisplay(Display):
if serviceItem.foot_text: if serviceItem.foot_text:
self.footer(serviceItem.foot_text) self.footer(serviceItem.foot_text)
# if was hidden keep it hidden # if was hidden keep it hidden
if self.hideMode and self.isLive: if self.hideMode and self.isLive and not serviceItem.is_media():
if QtCore.QSettings().value(u'general/auto unblank', if QtCore.QSettings().value(u'general/auto unblank',
QtCore.QVariant(False)).toBool(): QtCore.QVariant(False)).toBool():
Receiver.send_message(u'slidecontroller_live_unblank') Receiver.send_message(u'slidecontroller_live_unblank')

View File

@ -81,19 +81,28 @@ class MediaController(object):
QtCore.SIGNAL(u'songs_hide'), self.video_hide) QtCore.SIGNAL(u'songs_hide'), self.video_hide)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_unblank'), self.video_unblank) QtCore.SIGNAL(u'songs_unblank'), self.video_unblank)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'mediaitem_media_rebuild'), self.set_active_players)
def set_active_players(self):
playerSettings = str(QtCore.QSettings().value(u'media/players',
QtCore.QVariant(u'webkit')).toString())
savedPlayers = playerSettings.split(u',')
for player in savedPlayers:
self.mediaPlayers[player].isActive = True
def register_controllers(self, controller): def register_controllers(self, controller):
""" """
Register each media Player controller (Webkit, Phonon, etc) and store for Register each media Player controller (Webkit, Phonon, etc) and store
later use for later use
""" """
if controller.check_available(): if controller.check_available():
self.mediaPlayers[controller.name] = controller self.mediaPlayers[controller.name] = controller
def check_available_media_players(self): def check_available_media_players(self):
""" """
Check to see if we have any media Player's available. If Not do not install Check to see if we have any media Player's available. If Not do not
the plugin. install the plugin.
""" """
log.debug(u'check_available_media_players') log.debug(u'check_available_media_players')
controller_dir = os.path.join( controller_dir = os.path.join(
@ -127,6 +136,7 @@ class MediaController(object):
newPlayerSetting = u','.join(savedPlayers) newPlayerSetting = u','.join(savedPlayers)
QtCore.QSettings().setValue(u'media/players', QtCore.QSettings().setValue(u'media/players',
QtCore.QVariant(newPlayerSetting)) QtCore.QVariant(newPlayerSetting))
self.set_active_players()
return True return True
else: else:
return False return False
@ -153,6 +163,7 @@ class MediaController(object):
""" """
css = u'' css = u''
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive:
css += player.get_media_display_css() css += player.get_media_display_css()
return css return css
@ -162,6 +173,7 @@ class MediaController(object):
""" """
js = u'' js = u''
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive:
js += player.get_media_display_javascript() js += player.get_media_display_javascript()
return js return js
@ -171,6 +183,7 @@ class MediaController(object):
""" """
html = u'' html = u''
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive:
html += player.get_media_display_html() html += player.get_media_display_html()
return html return html
@ -250,6 +263,7 @@ class MediaController(object):
display == self.parent.liveController.previewDisplay: display == self.parent.liveController.previewDisplay:
display.hasAudio = False display.hasAudio = False
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive:
player.setup(display) player.setup(display)
def set_controls_visible(self, controller, value): def set_controls_visible(self, controller, value):
@ -302,6 +316,11 @@ class MediaController(object):
unicode(translate('MediaPlugin.MediaItem', unicode(translate('MediaPlugin.MediaItem',
'Unsupported File'))) 'Unsupported File')))
return False return False
# dont care about actual theme, set a black background
if controller.isLive and ( \
controller.media_info.is_background == False):
display.frame.evaluateJavaScript(u'show_video( \
"setBackBoard", null, null, null,"visible");')
# now start playing # now start playing
if self.video_play([controller], False): if self.video_play([controller], False):
self.video_pause([controller]) self.video_pause([controller])
@ -312,10 +331,6 @@ class MediaController(object):
controller.media_info.is_background == True) or \ controller.media_info.is_background == True) or \
controller.isLive == False: controller.isLive == False:
self.video_play([controller]) self.video_play([controller])
if controller.isLive and ( \
controller.media_info.is_background == False):
display.frame.evaluateJavaScript(u'show_video( \
"setBackBoard", null, null, null,"visible");')
self.set_controls_visible(controller, True) self.set_controls_visible(controller, True)
log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display]) log.debug(u'use %s controller' % self.curDisplayMediaPlayer[display])
return True return True
@ -369,19 +384,22 @@ class MediaController(object):
def video_play(self, msg, status=True): def video_play(self, msg, status=True):
""" """
Responds to the request to play a loaded video Responds to the request to play a loaded video
``msg``
First element is the controller which should be used
""" """
log.debug(u'video_play') log.debug(u'video_play')
controller = msg[0] controller = msg[0]
for display in self.curDisplayMediaPlayer.keys(): for display in self.curDisplayMediaPlayer.keys():
if display.controller == controller: if display.controller == controller:
if controller.isLive:
if controller.hideMenu.defaultAction().isChecked():
controller.hideMenu.defaultAction().trigger()
if not self.curDisplayMediaPlayer[display].play(display): if not self.curDisplayMediaPlayer[display].play(display):
return False return False
if status: if status:
display.frame.evaluateJavaScript(u'show_blank("desktop");') if controller.isLive:
if controller.hideMenu.defaultAction().isChecked():
controller.hideMenu.defaultAction().trigger()
self.curDisplayMediaPlayer[display].set_visible(display, True) self.curDisplayMediaPlayer[display].set_visible(display, True)
display.frame.evaluateJavaScript(u'show_blank("desktop");')
# Start Timer for ui updates # Start Timer for ui updates
if not self.timer.isActive(): if not self.timer.isActive():
self.timer.start() self.timer.start()
@ -390,6 +408,9 @@ class MediaController(object):
def video_pause(self, msg): def video_pause(self, msg):
""" """
Responds to the request to pause a loaded video Responds to the request to pause a loaded video
``msg``
First element is the controller which should be used
""" """
log.debug(u'video_pause') log.debug(u'video_pause')
controller = msg[0] controller = msg[0]
@ -400,6 +421,9 @@ class MediaController(object):
def video_stop(self, msg): def video_stop(self, msg):
""" """
Responds to the request to stop a loaded video Responds to the request to stop a loaded video
``msg``
First element is the controller which should be used
""" """
log.debug(u'video_stop') log.debug(u'video_stop')
controller = msg[0] controller = msg[0]
@ -412,6 +436,9 @@ class MediaController(object):
def video_volume(self, msg): def video_volume(self, msg):
""" """
Changes the volume of a running video Changes the volume of a running video
``msg``
First element is the controller which should be used
""" """
controller = msg[0] controller = msg[0]
vol = msg[1][0] vol = msg[1][0]
@ -423,6 +450,10 @@ class MediaController(object):
def video_seek(self, msg): def video_seek(self, msg):
""" """
Responds to the request to change the seek Slider of a loaded video Responds to the request to change the seek Slider of a loaded video
``msg``
First element is the controller which should be used
Second element is a list with the seek Value as first element
""" """
log.debug(u'video_seek') log.debug(u'video_seek')
controller = msg[0] controller = msg[0]
@ -449,6 +480,9 @@ class MediaController(object):
def video_hide(self, msg): def video_hide(self, msg):
""" """
Hide the related video Widget Hide the related video Widget
``msg``
First element is the boolean for Live indication
""" """
isLive = msg[1] isLive = msg[1]
if isLive: if isLive:
@ -464,6 +498,10 @@ class MediaController(object):
def video_blank(self, msg): def video_blank(self, msg):
""" """
Blank the related video Widget Blank the related video Widget
``msg``
First element is the boolean for Live indication
Second element is the hide mode
""" """
isLive = msg[1] isLive = msg[1]
hide_mode = msg[2] hide_mode = msg[2]
@ -481,6 +519,10 @@ class MediaController(object):
def video_unblank(self, msg): def video_unblank(self, msg):
""" """
Unblank the related video Widget Unblank the related video Widget
``msg``
First element is not relevant in this context
Second element is the boolean for Live indication
""" """
Receiver.send_message(u'live_display_show') Receiver.send_message(u'live_display_show')
isLive = msg[1] isLive = msg[1]
@ -501,6 +543,7 @@ class MediaController(object):
def get_audio_extensions_list(self): def get_audio_extensions_list(self):
audio_list = [] audio_list = []
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive:
for item in player.audio_extensions_list: for item in player.audio_extensions_list:
if not item in audio_list: if not item in audio_list:
audio_list.append(item) audio_list.append(item)
@ -509,6 +552,7 @@ class MediaController(object):
def get_video_extensions_list(self): def get_video_extensions_list(self):
video_list = [] video_list = []
for player in self.mediaPlayers.values(): for player in self.mediaPlayers.values():
if player.isActive:
for item in player.video_extensions_list: for item in player.video_extensions_list:
if not item in video_list: if not item in video_list:
video_list.append(item) video_list.append(item)

View File

@ -109,23 +109,6 @@ class PhononPlayer(MediaPlayer):
def check_available(self): def check_available(self):
return True return True
def get_supported_file_types(self):
self.supported_file_types = ['avi']
self.additional_extensions = {
u'audio/ac3': [u'.ac3'],
u'audio/flac': [u'.flac'],
u'audio/x-m4a': [u'.m4a'],
u'audio/midi': [u'.mid', u'.midi'],
u'audio/x-mp3': [u'.mp3'],
u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
u'audio/qcelp': [u'.qcp'],
u'audio/x-wma': [u'.wma'],
u'audio/x-ms-wma': [u'.wma'],
u'video/x-flv': [u'.flv'],
u'video/x-matroska': [u'.mpv', u'.mkv'],
u'video/x-wmv': [u'.wmv'],
u'video/x-ms-wmv': [u'.wmv']}
def load(self, display): def load(self, display):
log.debug(u'load vid in Phonon Controller') log.debug(u'load vid in Phonon Controller')
controller = display.controller controller = display.controller
@ -171,6 +154,7 @@ class PhononPlayer(MediaPlayer):
int(display.mediaObject.totalTime()/1000) int(display.mediaObject.totalTime()/1000)
controller.seekSlider.setMaximum(controller.media_info.length*1000) controller.seekSlider.setMaximum(controller.media_info.length*1000)
self.state = MediaState.Playing self.state = MediaState.Playing
display.phononWidget.raise_()
return True return True
else: else:
return False return False

View File

@ -162,7 +162,7 @@ class VlcPlayer(MediaPlayer):
int(display.vlcMediaPlayer.get_media().get_duration()/1000) int(display.vlcMediaPlayer.get_media().get_duration()/1000)
controller.seekSlider.setMaximum(controller.media_info.length*1000) controller.seekSlider.setMaximum(controller.media_info.length*1000)
self.state = MediaState.Playing self.state = MediaState.Playing
#self.set_visible(display, True) display.vlcWidget.raise_()
return True return True
else: else:
return False return False

View File

@ -135,7 +135,7 @@ VIDEO_JS = u"""
return vid.currentTime; return vid.currentTime;
case 'seek': case 'seek':
// doesnt work currently // doesnt work currently
//vid.currentTime = varVal; vid.currentTime = varVal;
break; break;
case 'setVisible': case 'setVisible':
vid.style.visibility = varVal; vid.style.visibility = varVal;
@ -313,7 +313,7 @@ class WebkitPlayer(MediaPlayer):
js = u'show_flash("load","%s");' % \ js = u'show_flash("load","%s");' % \
(path.replace(u'\\', u'\\\\')) (path.replace(u'\\', u'\\\\'))
else: else:
js = u'show_video("init", "%s", %s, %s);' % \ js = u'show_video("init", "file:///%s", %s, %s);' % \
(path.replace(u'\\', u'\\\\'), str(vol), loop) (path.replace(u'\\', u'\\\\'), str(vol), loop)
display.frame.evaluateJavaScript(js) display.frame.evaluateJavaScript(js)
return True return True
@ -334,6 +334,7 @@ class WebkitPlayer(MediaPlayer):
# TODO add playing check and get the correct media length # TODO add playing check and get the correct media length
controller.media_info.length = length controller.media_info.length = length
self.state = MediaState.Playing self.state = MediaState.Playing
display.webView.raise_()
return True return True
def pause(self, display): def pause(self, display):

View File

@ -289,10 +289,6 @@ class SlideController(Controller):
self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300)) self.previewDisplay.setGeometry(QtCore.QRect(0, 0, 300, 300))
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()} self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
self.previewDisplay.setup() self.previewDisplay.setup()
serviceItem = ServiceItem()
self.previewDisplay.webView.setHtml(build_html(serviceItem,
self.previewDisplay.screen, None, self.isLive, None, PluginManager.get_instance().plugins))
# self.previewDisplay.webView.hide()
self.slideLayout.insertWidget(0, self.previewDisplay) self.slideLayout.insertWidget(0, self.previewDisplay)
self.previewDisplay.hide() self.previewDisplay.hide()
# Actual preview screen # Actual preview screen
@ -619,6 +615,7 @@ class SlideController(Controller):
max_height)) max_height))
self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio, self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio,
max_height)) max_height))
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
else: else:
# We have to take the width as limit. # We have to take the width as limit.
max_width = self.previewFrame.width() - self.grid.margin() * 2 max_width = self.previewFrame.width() - self.grid.margin() * 2
@ -626,6 +623,7 @@ class SlideController(Controller):
max_width / self.ratio)) max_width / self.ratio))
self.previewDisplay.setFixedSize(QtCore.QSize(max_width, self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
max_width / self.ratio)) max_width / self.ratio))
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
# Make sure that the frames have the correct size. # Make sure that the frames have the correct size.
self.previewListWidget.setColumnWidth(0, self.previewListWidget.setColumnWidth(0,
self.previewListWidget.viewport().size().width()) self.previewListWidget.viewport().size().width())

View File

@ -228,6 +228,11 @@ class MediaMediaItem(MediaManagerItem):
the settings the settings
""" """
self.populateDisplayTypes() self.populateDisplayTypes()
self.onNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;%s (*)')) % (
u' '.join(self.plugin.video_extensions_list),
u' '.join(self.plugin.audio_extensions_list), UiStrings().AllFiles)
def populateDisplayTypes(self): def populateDisplayTypes(self):
""" """