Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gajim-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim-plugins
Commits
a6dce198
Commit
a6dce198
authored
Sep 23, 2020
by
Daniel Brötzmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[preview] Fix import warning, improve error handling
parent
a82cdd78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
url_image_preview/url_image_preview.py
url_image_preview/url_image_preview.py
+10
-2
No files found.
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
()
info
=
discoverer
.
discover_uri
(
f'file://
{
str
(
file_path
)
}
'
)
has_audio
=
bool
(
info
.
get_audio_streams
())
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