Skip to content

Commit

Permalink
refactor: simplify code in examples
Browse files Browse the repository at this point in the history
Also fix a typo in README
  • Loading branch information
SeaDve committed Nov 9, 2023
1 parent ce25c45 commit 66473e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To implement these interfaces, this crate offers two flavors: you can either cre

For more detailed examples, see also the [examples directory](https://github.com/SeaDve/mpris-server/tree/main/examples).

There is also a real-word example of this library being used in [Mousai](https://github.com/SeaDve/Mousai), a music recognizer application for Linux.
There is also a real-world example of this library being used in [Mousai](https://github.com/SeaDve/Mousai), a music recognizer application for Linux.

### Manual Implementation (via `Server` or `LocalServer`)

Expand Down Expand Up @@ -119,8 +119,7 @@ async fn main() -> Result<()> {
});
// Run event handler task
let task = player.run();
async_std::task::spawn_local(task);
async_std::task::spawn_local(player.run());
// Update `CanPlay` property and emit `PropertiesChanged` signal for it
player.set_can_play(false).await?;
Expand Down
3 changes: 1 addition & 2 deletions examples/local_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ async fn main() -> Result<()> {

// Unlike in `Server`, we have to call `run` here to handle incoming
// requests in the local thread.
let task = server.run();
async_std::task::spawn_local(task);
async_std::task::spawn_local(server.run());

// Emit `PropertiesChanged` signal for `CanSeek` and `Metadata` properties
server
Expand Down
3 changes: 1 addition & 2 deletions examples/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ async fn main() -> Result<()> {
});

// Run event handler task
let task = player.run();
async_std::task::spawn_local(task);
async_std::task::spawn_local(player.run());

// Update `CanPlay` property and emit `PropertiesChanged` signal for it
player.set_can_play(false).await?;
Expand Down

0 comments on commit 66473e0

Please sign in to comment.