[pitivi] proxy: Remove unneeded return statement
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] proxy: Remove unneeded return statement
- Date: Wed, 4 Jan 2017 15:45:10 +0000 (UTC)
commit 9dbf1fa699c6d0003bf659657a6a29a9aa570cd5
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Dec 21 13:31:25 2016 +0100
proxy: Remove unneeded return statement
Reviewed-by: Thibault Saunier <tsaunier gnome org>
Differential Revision: https://phabricator.freedesktop.org/D1568
pitivi/project.py | 4 ++--
pitivi/utils/proxy.py | 31 +++++++++++++++++--------------
2 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 38f9db3..9c3a354 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -1079,7 +1079,7 @@ class Project(Loggable, GES.Project):
self.loading_assets.append(asset)
def do_asset_removed(self, asset):
- self.app.proxy_manager.cancelJob(asset)
+ self.app.proxy_manager.cancel_job(asset)
def do_asset_added(self, asset):
"""Handles `GES.Project::asset-added` emitted by self."""
@@ -1207,7 +1207,7 @@ class Project(Loggable, GES.Project):
asset.props.id)
os.remove(Gst.uri_get_location(asset.props.id))
else:
- self.app.proxy_manager.cancelJob(asset)
+ self.app.proxy_manager.cancel_job(asset)
if assets:
self.setModificationState(True)
diff --git a/pitivi/utils/proxy.py b/pitivi/utils/proxy.py
index d5079f1..b29aabe 100644
--- a/pitivi/utils/proxy.py
+++ b/pitivi/utils/proxy.py
@@ -396,53 +396,53 @@ class ProxyManager(GObject.Object, Loggable):
else:
self.__pending_transcoders.append(transcoder)
- def cancelJob(self, asset):
+ def cancel_job(self, asset):
+ """Cancels the transcoding job for the specified asset, if any.
+
+ Args:
+ asset (GES.Asset): The original asset.
+ """
if not self.is_asset_queued(asset):
return
for transcoder in self.__running_transcoders:
if asset.props.id == transcoder.props.src_uri:
- self.__running_transcoders.remove(transcoder)
self.info("Cancelling running transcoder %s %s",
transcoder.props.src_uri,
transcoder.__grefcount__)
+ self.__running_transcoders.remove(transcoder)
self.emit("asset-preparing-cancelled", asset)
return
for transcoder in self.__pending_transcoders:
if asset.props.id == transcoder.props.src_uri:
+ self.info("Cancelling pending transcoder %s",
+ transcoder.props.src_uri)
# Removing the transcoder from the list
# will lead to its destruction (only reference)
# here, which means it will be stopped.
self.__pending_transcoders.remove(transcoder)
self.emit("asset-preparing-cancelled", asset)
- self.info("Cancelling pending transcoder %s",
- transcoder.props.src_uri)
return
- return
-
def add_job(self, asset):
"""Adds a transcoding job for the specified asset if needed.
Args:
asset (GES.Asset): The asset to be transcoded.
"""
- force_proxying = asset.force_proxying
- self.debug("Maybe create a proxy for %s (strategy: %s, force: %s)",
- asset.get_id(), self.app.settings.proxyingStrategy,
- force_proxying)
+ if self.is_asset_queued(asset):
+ self.log("Asset already queued for proxying: %s", asset)
+ return
+ force_proxying = asset.force_proxying
if not force_proxying and not self.__assetNeedsTranscoding(asset):
- self.debug("Not proxying asset (disabled: %s)",
+ self.debug("Not proxying asset (proxying disabled: %s)",
self.proxyingUnsupported)
# Make sure to notify we do not need a proxy for that asset.
self.emit("proxy-ready", asset, None)
return
- if self.is_asset_queued(asset):
- return
-
proxy_uri = self.getProxyUri(asset)
if Gio.File.new_for_uri(proxy_uri).query_exists(None):
self.debug("Using proxy already generated: %s", proxy_uri)
@@ -452,5 +452,8 @@ class ProxyManager(GObject.Object, Loggable):
None)
return
+ self.debug("Creating a proxy for %s (strategy: %s, force: %s)",
+ asset.get_id(), self.app.settings.proxyingStrategy,
+ force_proxying)
self.__createTranscoder(asset)
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]