From 4aebe441e7c2824fa55011709356a76dbbb40a7b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 23 Jan 2016 12:11:34 +0000 Subject: [PATCH] cleanups --- openlp/core/lib/serviceitem.py | 1 - openlp/core/ui/media/mediacontroller.py | 4 ++-- openlp/core/ui/media/systemplayer.py | 9 +-------- openlp/plugins/media/lib/mediaitem.py | 6 ++---- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1e7c4a64c..3dafd283b 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -543,7 +543,6 @@ class ServiceItem(RegistryProperties): :param length: The length of the media item """ print("set_media_length " + str(length) + " " + self.processor) - print("set_media_length " + str(self.start_time) + " " + str(self.end_time)) self.media_length = length if length > 0: self.add_capability(ItemCapabilities.HasVariableStartTime) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index a1b3924a8..b9e489117 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -452,8 +452,9 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties): translate('MediaPlugin.MediaItem', 'Unsupported File')) return False media_data = MediaInfoWrapper.parse(service_item.get_frame_path()) + print(media_data.to_data()) # duration returns in nano seconds - service_item.set_media_length(media_data.tracks[0].duration // 1000) + service_item.set_media_length(media_data.tracks[0].duration) log.debug('use %s controller' % self.current_media_players[controller.controller_type]) return True @@ -537,7 +538,6 @@ class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties): if not title: continue player = self.media_players[title] - print(player) # The system player may not return what files it can play so add it now # and check whether it can play the file later if title == 'system': diff --git a/openlp/core/ui/media/systemplayer.py b/openlp/core/ui/media/systemplayer.py index 79069f9c9..e64687dc3 100644 --- a/openlp/core/ui/media/systemplayer.py +++ b/openlp/core/ui/media/systemplayer.py @@ -4,14 +4,7 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2014 Raoul Snyman # -# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan # -# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # -# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # -# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # -# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # -# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # -# Frode Woldsund, Martin Zibricky, Patrick Zimmermann # +# Copyright (c) 2008-2016 OpenLP Developers # # --------------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the Free # diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 09b32b308..321813139 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -273,10 +273,8 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties): service_item.processor = self.display_type_combo_box.currentText() service_item.add_from_command(path, name, CLAPPERBOARD) # Only get start and end times if going to a service - if context == ServiceItemContext.Service: - # Start media and obtain the length - if not self.media_controller.media_length(service_item): - return False + if not self.media_controller.media_length(service_item): + return False service_item.add_capability(ItemCapabilities.CanAutoStartForLive) service_item.add_capability(ItemCapabilities.CanEditTitle) service_item.add_capability(ItemCapabilities.RequiresMedia)