Merge lp:~meths/openlp/trivialfixes into lp:openlp

Proposed by Jon Tibble
Status: Merged
Merged at revision: not available
Proposed branch: lp:~meths/openlp/trivialfixes
Merge into: lp:openlp
Diff against target: None lines
To merge this branch: bzr merge lp:~meths/openlp/trivialfixes
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tim Bentley Approve
Review via email: mp+11830@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote :

Approved

review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
lp:~meths/openlp/trivialfixes updated
544. By Jon Tibble

Merged in lp:~meths/openlp/trivialfixes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/media/lib/mediaitem.py'
2--- openlp/plugins/media/lib/mediaitem.py 2009-09-14 22:10:08 +0000
3+++ openlp/plugins/media/lib/mediaitem.py 2009-09-15 21:59:20 +0000
4@@ -25,12 +25,6 @@
5 import logging
6 import os
7 import tempfile
8-try:
9- import gst
10-except:
11- NOGST = True
12- log = logging.getLogger(u'MediaMediaItemSetup')
13- log.warning(u'Can\'t generate Videos previews - import gst failed');
14
15 from PyQt4 import QtCore, QtGui
16
17@@ -70,54 +64,17 @@
18 MediaManagerItem.__init__(self, parent, icon, title)
19
20 def video_get_preview(self, filename):
21- if NOGST:
22- #
23- # For now cross platform is an icon. Phonon does not support
24- # individual frame access (yet?) and GStreamer is not available
25- # on Windows
26- #
27- image = QtGui.QPixmap(u':/media/media_video.png').toImage()
28- return image
29- else:
30- """
31- Gets a preview of the first frame of a video file using GSTREAMER
32- (non-portable) - returns a QImage
33- """
34- try:
35- # Define your pipeline, just as you would at the command
36- # prompt. This is much easier than trying to create and link
37- # each gstreamer element in Python. This is great for
38- # pipelines that end with a filesink (i.e. there is no audible
39- # or visual output)
40- log.info ("Video preview %s"%( filename))
41- outfile = tempfile.NamedTemporaryFile(suffix='.png')
42- cmd = u'filesrc location="%s" ! decodebin ! ffmpegcolorspace ! pngenc ! filesink location="%s"'% (filename, outfile.name)
43- pipe = gst.parse_launch(cmd)
44- # Get a reference to the pipeline's bus
45- bus = pipe.get_bus()
46-
47- # Set the pipeline's state to PLAYING
48- pipe.set_state(gst.STATE_PLAYING)
49-
50- # Listen to the pipeline's bus indefinitely until we receive a
51- # EOS (end of stream) message. This is a super important step,
52- # or the pipeline might not work as expected. For example, in
53- # my example pipeline above, the pngenc will not export an
54- # actual image unless you have this line of code. It just
55- # exports a 0 byte png file. So... don't forget this step.
56- bus.poll(gst.MESSAGE_EOS, -1)
57- img = QtGui.QImage(outfile.name)
58- outfile.close()
59-# os.unlink(outfile.name)
60- pipe.set_state(gst.STATE_NULL)
61- return img
62- except:
63- log.info("Can't generate video preview for some reason");
64- return None
65+ #
66+ # For now cross platform is an icon. Phonon does not support
67+ # individual frame access (yet?) and GStreamer is not available
68+ # on Windows
69+ #
70+ image = QtGui.QPixmap(u':/media/media_video.png').toImage()
71+ return image
72
73 def generateSlideData(self, service_item):
74 indexes = self.ListView.selectedIndexes()
75- if len(items) > 1:
76+ if len(indexes) > 1:
77 return False
78 service_item.title = u'Media'
79 for index in indexes:
80@@ -151,7 +108,7 @@
81 row = self.ListView.row(item)
82 self.ListView.takeItem(row)
83 self.parent.config.set_list(
84- self.ConfigSection, self.ListData.getFileList())
85+ self.ConfigSection, self.getFileList())
86
87 def loadList(self, list):
88 for file in list: