Skip to content

Commit

Permalink
Merge pull request #9 from patryk-ku/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
patryk-ku authored Jul 22, 2024
2 parents 8119dd1 + 7703d5b commit afbf836
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 108 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ jobs:
uses: softprops/action-gh-release@v0.1.15
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: release-notes.txt
files: target/release/mpris-discord-rpc

23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## v0.1.4

- Allowlist of music players (`-a` or `--allowlist-add`).

## v0.1.3

- Dependencies update.

## v0.1.2

- Dependencies update.

## v0.1.1

- List active MPRIS2 players with `-l` or `--list-players` arguments.
- Select only one specific player for music status with `-n` or `--player-name` arguments.
- Fix: skip setting status when unknown metadata.
- Better log messages.
- Switched to different cache library.

## v0.1.0

- Initial release.
30 changes: 15 additions & 15 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "mpris-discord-rpc"
version = "0.1.1"
version = "0.1.4"
edition = "2021"

[dependencies]
discord-rich-presence = "0.2.3"
discord-rich-presence = "0.2.4"
mpris = "2.0.1"
reqwest = { version = "0.11", features = ["blocking", "json"] }
url-escape = "0.1.1"
Expand Down
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ You can change the default settings using arguments. Launch executable with `-h`
Usage: mpris-discord-rpc [OPTIONS]
Options:
-i, --interval <seconds> Activity refresh rate (min 5) [default: 10]
-p, --profile-button <nickname> Display "Open user's last.fm profile" button
-y, --yt-button Display "Search this song on YouTube" button
-d, --disable-cache Disable cache (not recommended)
-l, --list-players Displays all available player names and exits. Use to get your players name for -n parameter
-n, --player-name <Player Name> Get status only from given player name. Use -l to get player exact name to use with this parameter
-h, --help Print help
-V, --version Print version
-i, --interval <seconds> Activity refresh rate (min 5) [default: 10]
-p, --profile-button <nickname> Display "Open user's last.fm profile" button
-y, --yt-button Display "Search this song on YouTube" button
-d, --disable-cache Disable cache (not recommended)
-l, --list-players Displays all available music player names and exits. Use to get your player name for -a or -n argument
-n, --player-name <Player Name> Get status only from one given player. Check --allowlist-add if you want to use multiple players. Use -l to get player exact name to use with this argument
-a, --allowlist-add <Player Name> Add player name to allowlist. Use multiple times to add several players. Cannot be used with --player-name
-h, --help Print help
-V, --version Print version
```

**For the best experience, I recommend using app this way:**
Expand All @@ -57,25 +58,34 @@ Options:
### Player selection

To select only one specific player, use the `--list-players` or `-l` parameter to get your player name:
To select only one specific player, use the `--list-players` or `-l` argument to get your player name:

```
./mpris-discord-rpc --list-players
```

Then use `--player-name` or `-n` to get metadata for status only from this player:

```
```sh
./mpris-discord-rpc --player-name "Insert name here"
```

### Allowlist

To select more than one music player, use the `-a` or `--allowlist-add` argument. This argument can be used multiple times to add more players. The order matters and the first is the most important.

```sh
./mpris-discord-rpc -a "VLC Media Player" -a "Chrome" -a "Any other player"
```

## Flatpak Discord fix

As flatpak applications are sandboxed this makes it difficult for any other programs to communicate with them. But this can be easily fixed using the following command:

```sh
ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0
```

**Unfortunately but it will need to be used every reboot**. So I would also recommend adding this command to the autostart.

## System usage
Expand All @@ -87,6 +97,7 @@ Normaly it uses around **11.8 MiB** of RAM but even less than **6.5 MiB** when f
If not disabled, the program stores the cache in `$XDG_CACHE_HOME/mpris-discord-rpc/` or `$HOME/.cache/mpris-discord-rpc/`. Don't worry, the app does not cache image files, but only the url to the image file on the last.fm server, so the cache will not take up much space.

## Compile from source

1. Install Rust and Cargo using instructions from [Rust site](https://www.rust-lang.org/).
2. Clone the repository
```sh
Expand All @@ -98,8 +109,12 @@ If not disabled, the program stores the cache in `$XDG_CACHE_HOME/mpris-discord-
mv .env.example .env
echo LASTFM_API_KEY=insert-key-here > .env
```
5. Compile executable using Cargo
4. Compile executable using Cargo
```sh
cargo build --release
```
6. The compiled executable file location is `target/release/mpris-discord-rpc`.
5. The compiled executable file location is `target/release/mpris-discord-rpc`.

## Changelog

[CHANGELOG.md](CHANGELOG.md)
1 change: 1 addition & 0 deletions release-notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Allowlist of music players (`-a` or `--allowlist-add`).
Loading

0 comments on commit afbf836

Please sign in to comment.