Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evert Mouw
gajim-plugins
Commits
ace6532d
Commit
ace6532d
authored
13 years ago
by
Dicson
Browse files
Options
Downloads
Patches
Plain Diff
add new plugin. mpris2 support
parent
6af5b915
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mpris2_support/__init__.py
+1
-0
1 addition, 0 deletions
mpris2_support/__init__.py
mpris2_support/manifest.ini
+7
-0
7 additions, 0 deletions
mpris2_support/manifest.ini
mpris2_support/mpris2_support.py
+52
-0
52 additions, 0 deletions
mpris2_support/mpris2_support.py
with
60 additions
and
0 deletions
mpris2_support/__init__.py
0 → 100644
+
1
−
0
View file @
ace6532d
from
mpris2_support
import
Mpris2Plugin
This diff is collapsed.
Click to expand it.
mpris2_support/manifest.ini
0 → 100644
+
7
−
0
View file @
ace6532d
[info]
name:
MPRIS2
support
short_name:
mpris2_support
version:
0.1
description:
MPRIS2
support
authors
=
Denis Fomin <fominde@gmail.com>
homepage
=
http://trac-plugins.gajim.org/wiki
This diff is collapsed.
Click to expand it.
mpris2_support/mpris2_support.py
0 → 100644
+
52
−
0
View file @
ace6532d
# -*- coding: utf-8 -*-
import
gtk
import
gobject
from
common
import
gajim
from
plugins
import
GajimPlugin
from
plugins.helpers
import
log_calls
from
plugins.plugin
import
GajimPluginException
from
common
import
dbus_support
if
dbus_support
.
supported
:
from
music_track_listener
import
MusicTrackInfo
,
MusicTrackListener
class
Mpris2Plugin
(
GajimPlugin
):
@log_calls
(
'
Mpris2Plugin
'
)
def
init
(
self
):
self
.
description
=
_
(
'
MPRIS2 support
'
)
self
.
config_dialog
=
None
self
.
artist
=
self
.
title
=
self
.
source
=
''
self
.
listener
=
MusicTrackListener
().
get
()
@log_calls
(
'
NowListenPlugin
'
)
def
activate
(
self
):
self
.
bus
=
dbus_support
.
session_bus
.
SessionBus
()
self
.
bus
.
add_signal_receiver
(
self
.
properties_changed
,
"
PropertiesChanged
"
,
"
org.freedesktop.DBus.Properties
"
)
@log_calls
(
'
Mpris2Plugin
'
)
def
deactivate
(
self
):
self
.
bus
.
remove_signal_receiver
(
self
.
properties_changed
,
"
PropertiesChanged
"
,
"
org.freedesktop.DBus.Properties
"
)
def
properties_changed
(
self
,
*
args
,
**
kw
):
if
args
[
0
]
!=
'
org.mpris.MediaPlayer2.Player
'
:
return
if
'
PlaybackStatus
'
in
args
[
1
]:
if
args
[
1
][
'
PlaybackStatus
'
]
in
[
'
Paused
'
,
'
Stopped
'
]:
self
.
title
=
self
.
artist
=
self
.
source
=
''
self
.
listener
.
emit
(
'
music-track-changed
'
,
None
)
return
if
'
Metadata
'
not
in
args
[
1
]:
return
data
=
args
[
1
][
'
Metadata
'
]
info
=
MusicTrackInfo
()
info
.
title
=
data
.
get
(
"
xesam:title
"
,
''
)
info
.
album
=
data
.
get
(
"
xesam:album
"
,
''
)
info
.
artist
=
data
.
get
(
"
xesam:artist
"
,
[
''
])[
0
]
info
.
duration
=
int
(
data
.
get
(
'
mpris:length
'
,
0
))
info
.
track_number
=
int
(
data
.
get
(
'
xesam:trackNumber
'
,
0
))
self
.
listener
.
emit
(
'
music-track-changed
'
,
info
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment