https://github.com/leberkleber/go-mpris
go mpris implementation
https://github.com/leberkleber/go-mpris
go golang golang-library mpris mpris2
Last synced: 5 months ago
JSON representation
go mpris implementation
- Host: GitHub
- URL: https://github.com/leberkleber/go-mpris
- Owner: leberKleber
- License: mit
- Created: 2021-02-06T20:21:04.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-02T16:31:44.000Z (about 1 year ago)
- Last Synced: 2025-03-27T06:03:34.660Z (10 months ago)
- Topics: go, golang, golang-library, mpris, mpris2
- Language: Go
- Homepage:
- Size: 83 KB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# go-mpris
[](https://github.com/leberKleber/go-mpris/actions?query=workflow%3Ago)
[](https://godoc.org/github.com/leberKleber/go-mpris)
[](https://goreportcard.com/report/github.com/leberKleber/go-mpris)
[](https://codecov.io/gh/leberKleber/go-mpris)
go-mpris is an implementation of the mpris dbus interface written in go (golang).
Implemented and tested against version 2.2. See: https://specifications.freedesktop.org/mpris-spec/2.2.
* [Example](#example)
* [Features](#features)
* [Player](#player)
* [Methods](#methods)
* [Properties](#properties)
* [Signals](#signals)
* [TrackList](#tracklist)
* [Methods](#methods-1)
* [Properties](#properties-1)
* [Signals](#signals-1)
* [Development](#development)
* [Versioning](#versioning)
* [Commits](#commits)
* [Mocks](#mocks)
* [Go Docs](#go-docs)
## Example
Example cli has been implemented.
```shell
git clone git@github.com:leberKleber/go-mpris.git
go build examples/cli.go
./cli-client
```
## Features
### Player
https://specifications.freedesktop.org/mpris-spec/2.2/Player_Interface.html
#### Methods
| method | library path | implemented |
|-------------|-------------------------------------------------------------------------|--------------------|
| Next | `mpris.Player.Next()` | :heavy_check_mark: |
| Previous | `mpris.Player.Previous()` | :heavy_check_mark: |
| Pause | `mpris.Player.Pause()` | :heavy_check_mark: |
| PlayPause | `mpris.Player.PlayPause()` | :heavy_check_mark: |
| Stop | `mpris.Player.Stop()` | :heavy_check_mark: |
| Seek | `mpris.Player.SeekTo( int64)`¹ | :heavy_check_mark: |
| SetPosition | `mpris.Player.SetPosition( dbus.ObjectPath, int64)` | :heavy_check_mark: |
| OpenUri | `mpris.Player.OpenUri( string)` | :heavy_check_mark: |
¹ Could not be named Seek, it's a reserved function name.
#### Properties
| property | library path | implemented |
|----------------|-------------------------------------------------------------------------|--------------------|
| PlaybackStatus | `mpris.Player.PlaybackStatus() (mpris.PlaybackStatus, error)` | :heavy_check_mark: |
| LoopStatus | `mpris.Player.LoopStatus() (mpris.LoopStatus, error)` | :heavy_check_mark: |
| LoopStatus | `mpris.Player.SetLoopStatus( mpris.LoopStatus) error` | :heavy_check_mark: |
| Rate | `mpris.Player.Rate() (float64, error)` | :heavy_check_mark: |
| Rate | `mpris.Player.SetRate( float64) error` | :heavy_check_mark: |
| Shuffle | `mpris.Player.Shuffle() (bool, error)` | :heavy_check_mark: |
| Shuffle | `mpris.Player.SetShuffle( bool) error` | :heavy_check_mark: |
| Metadata | `mpris.Player.Metadata() (mpris.Metadata, error)` | :heavy_check_mark: |
| Volume | `mpris.Player.Volume() (float64, error)` | :heavy_check_mark: |
| Volume | `mpris.Player.SetVolume( float64) (error)` | :heavy_check_mark: |
| Position | `mpris.Player.Position() (int64, error)` | :heavy_check_mark: |
| Position | `mpris.Player.SetPosition( dbus.ObjectPath, int64)` | :heavy_check_mark: |
| MinimumRate | `mpris.Player.MinimumRate() (float64, error)` | :heavy_check_mark: |
| MaximumRate | `mpris.Player.MaximumRate() (float64, error)` | :heavy_check_mark: |
| CanGoNext | `mpris.Player.CanGoNext() (bool, error)` | :heavy_check_mark: |
| CanGoPrevious | `mpris.Player.CanGoPrevious() (bool, error)` | :heavy_check_mark: |
| CanPlay | `mpris.Player.CanPlay() (bool, error)` | :heavy_check_mark: |
| CanPause | `mpris.Player.CanPause() (bool, error)` | :heavy_check_mark: |
| CanSeek | `mpris.Player.CanSeek() (bool, error)` | :heavy_check_mark: |
| CanControl | `mpris.Player.CanControl() (bool, error)` | :heavy_check_mark: |
#### Signals
| signal | library path | implemented |
|--------|-------------------------------------------------------------------|--------------------|
| Seeked | `mpris.Player.Seeked( context.Context) (<-chan int, error) ` | :heavy_check_mark: |
### TrackList
https://specifications.freedesktop.org/mpris-spec/2.2/Track_List_Interface.html
#### Methods
| method | library path | implemented |
|-------------------|---------------------|--------------------------|
| GetTracksMetadata | Not implemented yet | :heavy_multiplication_x: |
| AddTrack | Not implemented yet | :heavy_multiplication_x: |
| RemoveTrack | Not implemented yet | :heavy_multiplication_x: |
| GoTo | Not implemented yet | :heavy_multiplication_x: |
#### Properties
| property | library path | implemented |
|----------------|---------------------|--------------------------|
| Tracks | Not implemented yet | :heavy_multiplication_x: |
| CanEditTracks | Not implemented yet | :heavy_multiplication_x: |
#### Signals
| signal | library path | implemented |
|----------------------|---------------------|--------------------------|
| TrackListReplaced | Not implemented yet | :heavy_multiplication_x: |
| TrackAdded | Not implemented yet | :heavy_multiplication_x: |
| TrackRemoved | Not implemented yet | :heavy_multiplication_x: |
| TrackMetadataChanged | Not implemented yet | :heavy_multiplication_x: |
## Development
### Versioning
This library follows the semantic versioning concept.
### Commits
Commits should follow the conventional commit rules.
See: https://conventionalcommits.org.
### Mocks
Mocks will be generated with `github.com/matryer/moq`. It can be installed with
`go install github.com/matryer/moq@latest`. Generation can be triggered with `go generate ./...`.
### Go Docs
Read the docs at https://pkg.go.dev/github.com/leberKleber/go-mpris