Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pitchum
gajim-plugins
Commits
a6dce198
Commit
a6dce198
authored
Sep 23, 2020
by
Daniel Brötzmann
Browse files
[preview] Fix import warning, improve error handling
parent
a82cdd78
Changes
1
Show whitespace changes
Inline
Side-by-side
url_image_preview/url_image_preview.py
View file @
a6dce198
...
...
@@ -23,6 +23,7 @@ from functools import partial
from
urllib.parse
import
urlparse
from
urllib.parse
import
unquote
import
gi
from
gi.repository
import
Gtk
from
gi.repository
import
Gdk
from
gi.repository
import
GdkPixbuf
...
...
@@ -30,6 +31,8 @@ from gi.repository import Gio
from
gi.repository
import
GLib
from
gi.repository
import
Soup
try
:
gi
.
require_version
(
'Gst'
,
'1.0'
)
gi
.
require_version
(
'GstPbutils'
,
'1.0'
)
from
gi.repository
import
Gst
from
gi.repository
import
GstPbutils
except
Exception
:
...
...
@@ -738,9 +741,14 @@ class UrlImagePreviewPlugin(GajimPlugin):
@
staticmethod
def
_contains_audio_streams
(
file_path
):
# Check if it is really an audio file
has_audio
=
False
discoverer
=
GstPbutils
.
Discoverer
()
try
:
info
=
discoverer
.
discover_uri
(
f
'file://
{
str
(
file_path
)
}
'
)
has_audio
=
bool
(
info
.
get_audio_streams
())
except
GLib
.
Error
as
err
:
log
.
error
(
'Error while reading %s: %s'
,
str
(
file_path
),
err
)
return
False
if
not
has_audio
:
log
.
warning
(
'File does not contain audio stream: %s'
,
str
(
file_path
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment