Small suggested changes

This commit is contained in:
Tomas Groth 2014-06-17 09:27:12 +02:00
parent 44eccb8360
commit 956af8706b
5 changed files with 11 additions and 13 deletions

View File

@ -645,4 +645,4 @@ class ServiceItem(RegistryProperties):
file_suffix = frame['title'].split('.')[-1]
if file_suffix.lower() not in suffix_list:
self.is_valid = False
break
break

View File

@ -118,6 +118,7 @@ def parse_optical_path(input):
:param input: The string to parse
:return: The elements extracted from the string: filename, title, audio_track, subtitle_track, start, end
"""
log.debug('parse_optical_path, about to parse: "%s"' % input)
clip_info = input.split(sep=':')
title = int(clip_info[1])
audio_track = int(clip_info[2])

View File

@ -31,6 +31,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.common import translate
class Ui_MediaClipSelector(object):
def setupUi(self, MediaClipSelector):
MediaClipSelector.setObjectName("MediaClipSelector")
@ -165,7 +166,6 @@ class Ui_MediaClipSelector(object):
self.position_horizontalslider.setInvertedAppearance(False)
self.position_horizontalslider.setObjectName("position_horizontalslider")
self.gridLayout.addWidget(self.position_horizontalslider, 6, 1, 1, 3)
#MediaClipSelector.setCentralWidget(self.centralwidget)
self.retranslateUi(MediaClipSelector)
QtCore.QMetaObject.connectSlotsByName(MediaClipSelector)
@ -189,11 +189,13 @@ class Ui_MediaClipSelector(object):
MediaClipSelector.setWindowTitle(translate("MediaPlugin.MediaClipSelector", "Select media clip", None))
self.start_timeedit.setDisplayFormat(translate("MediaPlugin.MediaClipSelector", "HH:mm:ss.z", None))
self.end_timeedit.setDisplayFormat(translate("MediaPlugin.MediaClipSelector", "HH:mm:ss.z", None))
self.set_start_pushbutton.setText(translate("MediaPlugin.MediaClipSelector", "Set current position as start point", None))
self.set_start_pushbutton.setText(translate("MediaPlugin.MediaClipSelector",
"Set current position as start point", None))
self.load_disc_pushbutton.setText(translate("MediaPlugin.MediaClipSelector", "Load disc", None))
self.end_point_label.setText(translate("MediaPlugin.MediaClipSelector", "End point", None))
self.title_label.setText(translate("MediaPlugin.MediaClipSelector", "Title", None))
self.set_end_pushbutton.setText(translate("MediaPlugin.MediaClipSelector", "Set current position as end point", None))
self.set_end_pushbutton.setText(translate("MediaPlugin.MediaClipSelector",
"Set current position as end point", None))
self.save_pushbutton.setText(translate("MediaPlugin.MediaClipSelector", "Save current clip", None))
self.close_pushbutton.setText(translate("MediaPlugin.MediaClipSelector", "Close", None))
self.start_point_label.setText(translate("MediaPlugin.MediaClipSelector", "Start point", None))
@ -203,4 +205,3 @@ class Ui_MediaClipSelector(object):
self.subtitle_track_label.setText(translate("MediaPlugin.MediaClipSelector", "Subtitle track", None))
self.jump_end_pushbutton.setText(translate("MediaPlugin.MediaClipSelector", "Jump to end point", None))
self.media_path_label.setText(translate("MediaPlugin.MediaClipSelector", "Media path", None))

View File

@ -196,7 +196,7 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
self.disable_all()
path = self.media_path_combobox.currentText()
# Check if given path is non-empty and exists before starting VLC
if path == '':
if not path:
log.debug('no given path')
critical_error_message_box(message=translate('MediaPlugin.MediaClipSelectorForm', 'No path was given'))
self.toggle_disable_load_media(False)
@ -522,12 +522,11 @@ class MediaClipSelectorForm(QtGui.QDialog, Ui_MediaClipSelector):
path = self.media_path_combobox.currentText()
optical = ''
if self.audio_cd:
optical = 'optical:' + str(title) + ':-1:-1:' + str(start_time_ms) + ':' + str(end_time_ms) + ':'
optical = 'optical:%d:-1:-1:%d:%d:' % (title, start_time_ms, end_time_ms)
else:
audio_track = self.audio_tracks_combobox.itemData(self.audio_tracks_combobox.currentIndex())
subtitle_track = self.subtitle_tracks_combobox.itemData(self.subtitle_tracks_combobox.currentIndex())
optical = 'optical:' + str(title) + ':' + str(audio_track) + ':' + str(subtitle_track) + ':' + str(
start_time_ms) + ':' + str(end_time_ms) + ':'
optical = 'optical:%d:%d:%d:%d:%d:' % (title, audio_track, subtitle_track, start_time_ms, end_time_ms)
# Ask for an alternative name for the mediaclip
while True:
new_optical_name, ok = QtGui.QInputDialog.getText(self, translate('MediaPlugin.MediaClipSelectorForm',

View File

@ -125,7 +125,6 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
"""
Adds buttons to the start of the header bar.
"""
print(get_media_players()[0])
if 'vlc' in get_media_players()[0]:
diable_optical_button_text = False
optical_button_text = translate('MediaPlugin.MediaItem', 'Load CD/DVD')
@ -246,8 +245,6 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
service_item.processor = self.display_type_combo_box.currentText()
service_item.add_from_command(filename, name, CLAPPERBOARD)
service_item.title = clip_name
# Only set start and end times if going to a service
#if context == ServiceItemContext.Service:
# Set the length
self.media_controller.media_setup_optical(name, title, audio_track, subtitle_track, start, end, None, None)
service_item.set_media_length((end - start) / 1000)
@ -360,7 +357,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
item_name = QtGui.QListWidgetItem(clip_name)
item_name.setIcon(OPTICAL_ICON)
item_name.setData(QtCore.Qt.UserRole, track)
item_name.setToolTip(file_name + '@' + format_milliseconds(start) + '-' + format_milliseconds(end))
item_name.setToolTip('%s@%s-%s' % (file_name, format_milliseconds(start), format_milliseconds(end)))
elif not os.path.exists(track):
# File doesn't exist, mark as error.
file_name = os.path.split(str(track))[1]