mps_youtube.mpris module

mps-youtube.

https://github.com/np1/mps-youtube

Copyright (C) 2014 nagev

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

class mps_youtube.mpris.Mpris2Controller

Bases: object

Controller for various MPRIS objects.

acquire()

Connects to D-Bus and registers all components

listenstatus(conn)

Notifies interfaces that player connection changed

release()

Releases all objects from D-Bus and unregisters the bus

run(connection)

Runs main loop, processing all calls binds on connection (Pipe) and listens player changes

class mps_youtube.mpris.Mpris2MediaPlayer(bus)

Bases: dbus.service.Object

main dbus object for MPRIS2 implementing interfaces:

org.mpris.MediaPlayer2 org.mpris.MediaPlayer2.Player
Get(interface_name, property_name)

getter for org.freedesktop.DBus.Properties on this object

GetAll(interface_name)

getter for org.freedesktop.DBus.Properties on this object

Next()

Skips to the next track in the tracklist.

OpenUri(uri)
Uri - s (uri)
Uri of the track to load.

Opens the Uri given as an argument.

Pause()

Pauses playback. If playback is already paused, this has no effect.

Play()

Starts or resumes playback.

PlayPause()

Pauses playback. If playback is already paused, resumes playback.

Previous()

Skips to the previous track in the tracklist.

PropertiesChanged(*args, **keywords)

signal for org.freedesktop.DBus.Properties on this object

this informs of changed properties

Quit()

Causes the media player to stop running.

Raise()

Brings the media player’s user interface to the front using any appropriate mechanism available.

Seek(offset)
Offset - x (offset)
The number of microseconds to seek forward.

Seeks forward in the current track by the specified number of microseconds.

Seeked(*args, **keywords)
Position - x (position)
The new position, in microseconds.

Indicates that the track position has changed in a way that is inconsistant with the current playing state.

Set(interface_name, property_name, new_value)

setter for org.freedesktop.DBus.Properties on this object

SetPosition(track_id, position)
TrackId - o (track_id)
The currently playing track’s identifier. If this does not match the id of the currently-playing track, the call is ignored as “stale”.
Position - x (position)
Track position in microseconds.

Sets the current track position in microseconds.

Stop()

Stops playback.

bindfifo(fifopath, mpv=False)

init command fifo for mplayer and old versions of mpv

bindmpv(sockpath)

init JSON IPC for new versions of mpv >= 0.7

setproperty(name, val)

Properly sets properties on player interface

don’t use this method from dbus interface, all values should be set from player (to keep them correct)

mps_youtube.mpris.main(connection)

runs mpris interface and listens for changes connection - pipe to communicate with this module