[pitivi] medialibrary: Fix asset shown as transcoding in progress
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] medialibrary: Fix asset shown as transcoding in progress
- Date: Tue, 2 Aug 2016 01:12:18 +0000 (UTC)
commit 6ec0d72783e958a0d907fcaa515a8e16e19289ee
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Aug 2 01:46:20 2016 +0200
medialibrary: Fix asset shown as transcoding in progress
Check directly the proxy manager for the status.
Fixes https://phabricator.freedesktop.org/T7530
Differential Revision: https://phabricator.freedesktop.org/D1235
pitivi/medialibrary.py | 19 +++++++++----------
pitivi/utils/proxy.py | 14 +++++++++++---
2 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 197bd88..c26f66b 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -185,22 +185,22 @@ class ThumbnailsDecorator(Loggable):
EMBLEMS[status].append(GdkPixbuf.Pixbuf.new_from_file_at_size(
os.path.join(get_pixmap_dir(), "%s.svg" % status), size, size))
- def __init__(self, thumbs, asset):
+ def __init__(self, thumbs, asset, proxy_manager):
Loggable.__init__(self)
- self.src_64 = thumbs[0]
- self.src_128 = thumbs[1]
-
+ self.src_64, self.src_128 = thumbs
self.__asset = asset
+ self.proxy_manager = proxy_manager
self.decorate()
def __setState(self):
asset = self.__asset
target = asset.get_proxy_target()
if target and not target.get_error():
+ # The asset is a proxy.
self.state = self.PROXIED
elif asset.proxying_error:
self.state = self.ASSET_PROXYING_ERROR
- elif not asset.creation_progress == 100:
+ elif self.proxy_manager.is_asset_queued(asset):
self.state = self.IN_PROGRESS
else:
self.state = self.NO_PROXY
@@ -214,10 +214,8 @@ class ThumbnailsDecorator(Loggable):
self.thumb_64 = self.src_64.copy()
self.thumb_128 = self.src_128.copy()
- for i, thumb in enumerate([self.thumb_64, self.thumb_128]):
- emblems = self.EMBLEMS[self.state]
- src = emblems[i]
-
+ for thumb, src in zip([self.thumb_64, self.thumb_128],
+ self.EMBLEMS[self.state]):
# We need to set dest_y == offset_y for the source image
# not to be cropped, that API is weird.
if thumb.get_height() < src.get_height():
@@ -808,7 +806,8 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
thumb_64 = self._getIcon("audio-x-generic")
thumb_128 = self._getIcon("audio-x-generic", None, LARGE_SIZE)
- thumbs_decorator = ThumbnailsDecorator([thumb_64, thumb_128], asset)
+ thumbs_decorator = ThumbnailsDecorator([thumb_64, thumb_128], asset,
+ self.app.proxy_manager)
if info.get_duration() == Gst.CLOCK_TIME_NONE:
duration = ''
else:
diff --git a/pitivi/utils/proxy.py b/pitivi/utils/proxy.py
index e0b6d85..16ed8b8 100644
--- a/pitivi/utils/proxy.py
+++ b/pitivi/utils/proxy.py
@@ -350,7 +350,15 @@ class ProxyManager(GObject.Object, Loggable):
self.__emitProgress(asset, asset.creation_progress)
- def __assetQueued(self, asset):
+ def is_asset_queued(self, asset):
+ """Returns whether the specified asset is queued for transcoding.
+
+ Args:
+ asset (GES.Asset): The asset to check.
+
+ Returns:
+ bool: True iff the asset is being transcoded or pending.
+ """
all_transcoders = self.__running_transcoders + self.__pending_transcoders
for transcoder in all_transcoders:
if asset.props.id == transcoder.props.src_uri:
@@ -393,7 +401,7 @@ class ProxyManager(GObject.Object, Loggable):
self.__pending_transcoders.append(transcoder)
def cancelJob(self, asset):
- if not self.__assetQueued(asset):
+ if not self.is_asset_queued(asset):
return
for transcoder in self.__running_transcoders:
@@ -433,7 +441,7 @@ class ProxyManager(GObject.Object, Loggable):
self.emit("proxy-ready", asset, None)
return True
- if self.__assetQueued(asset):
+ if self.is_asset_queued(asset):
return True
proxy_uri = self.getProxyUri(asset)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]