Skip to content

Commit

Permalink
add some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
leberKleber committed Nov 20, 2022
1 parent 86a25ad commit a60e415
Show file tree
Hide file tree
Showing 15 changed files with 374 additions and 315 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.15
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Changelog
## unreleased
## v1.0.0
- add mpris MediaPlayer2.Player methods (all)
- add mpris MediaPlayer2.Player properties (PlaybackStatus)
- add mpris MediaPlayer2.Player properties (all)
86 changes: 58 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# go-mpris

[![Go](https://github.com/leberKleber/go-mpris/workflows/go/badge.svg)](https://github.com/leberKleber/go-mpris/actions?query=workflow%3Ago)
[![GoDoc](https://godoc.org/github.com/leberKleber/go-mpris?status.png)](https://godoc.org/github.com/leberKleber/go-mpris)
[![Go Report Card](https://goreportcard.com/badge/github.com/leberKleber/go-mpris)](https://goreportcard.com/report/github.com/leberKleber/go-mpris)
[![codecov](https://codecov.io/gh/leberKleber/go-mpris/branch/main/graph/badge.svg)](https://codecov.io/gh/leberKleber/go-mpris)

go mpris version 2.2 implementation
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 cli has been implemented.

```shell
Expand All @@ -16,39 +19,66 @@ go build examples/cli.go
./cli-client
```

## Functions:
## Features:

### Player

https://specifications.freedesktop.org/mpris-spec/2.2/Player_Interface.html

#### Methods:
- [X] Next
- [X] Previous
- [X] Pause
- [X] PlayPause
- [X] Stop
- [X] Play
- [X] Seek > SeekTo (Seek is a reserved function name and can not be used in this case)
- [X] SetPosition
- [X] OpenUri
#### 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(<offset> int64)`¹ | :heavy_check_mark: |
| SetPosition | `mpris.Player.SetPosition(<trackID> dbus.ObjectPath, <position> int64)` | :heavy_check_mark: |
| OpenUri | `mpris.Player.OpenUri(<uri> string)` | :heavy_check_mark: |

¹ Could not be named Seek, it's a reserved function name.

#### Properties
- [X] PlaybackStatus
- [X] LoopStatus
- [X] Rate
- [X] Shuffle
- [X] Metadata
- [X] Volume
- [X] Position
- [X] MinimumRate
- [X] MaximumRate
- [X] CanGoNext
- [X] CanGoPrevious
- [X] CanPlay
- [X] CanPause
- [X] CanSeek
- [X] CanControl

| 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(<loopStatus> mpris.LoopStatus) error` | :heavy_check_mark: |
| Rate | `mpris.Player.Rate() (float64, error)` | :heavy_check_mark: |
| Rate | `mpris.Player.SetRate(<rate> float64) error` | :heavy_check_mark: |
| Shuffle | `mpris.Player.Shuffle() (bool, error)` | :heavy_check_mark: |
| Shuffle | `mpris.Player.SetShuffle(<shuffle> 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(<volume> float64) (error)` | :heavy_check_mark: |
| Position | `mpris.Player.Position() (int64, error)` | :heavy_check_mark: |
| Position | `mpris.Player.SetPosition(<trackID> dbus.ObjectPath, <position> 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
- [ ] Seeked

| signal | library path | implemented |
|--------|---------------------|-------------------------------|
| Seeked | not implemented yet | :negative_squared_cross_mark: |


## Development

### 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
41 changes: 22 additions & 19 deletions dbus-bus-object_moq_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions dbus-call_moq_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 22 additions & 19 deletions dbus-conn_moq_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package main
import (
"bufio"
"fmt"
"github.com/leberKleber/go-mpris"
"os"
"strconv"
"strings"

"github.com/leberKleber/go-mpris"
)

func main() {
Expand Down
16 changes: 12 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
module github.com/leberKleber/go-mpris

go 1.15
go 1.19

require (
github.com/godbus/dbus/v5 v5.0.3
github.com/golang/mock v1.4.4 // indirect
github.com/stretchr/testify v1.7.0
github.com/godbus/dbus/v5 v5.0.6
github.com/stretchr/testify v1.8.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit a60e415

Please # to comment.