Skip to content

Commit

Permalink
Add local libmpv-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
sudipghimire533 committed Aug 12, 2023
1 parent 62410fd commit 63989ee
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 51 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

- name: Install dependencies
run: |
git submodule init
sudo apt update &&
sudo apt install libmpv-dev
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "mpv-build"]
path = mpv-build
url = https://github.com/mpv-player/mpv-build
branch = master
133 changes: 106 additions & 27 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"front-end",
"fetcher",
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Listen to music from youtube inside terminal with sleek tui
---

# Installation
NOTE: since the dependency `libmpv` seems not to be maintained anymore,

you will probably need to build from source in any platform. See section *Build From Source* below.

1) Download latest binary from [release page](https://github.com/sudipghimire533/ytui-music/releases/latest).
If binary is not available for your platform, head on to [build from source](#building-from-source)

Expand Down Expand Up @@ -70,7 +74,8 @@ git clone git@github.com:sudipghimire533/ytui-music

3) `cd` into source root and do:
```
cargo build --all --release
git submodule init
MPV_BUILD=mpv-build/ cargo build --all --release --features libmpv_build
```

4) The compiled binary is located in `target/release/` directory. Copy the `ytui_music` binary and place it somewhere where it is easy to run. Preferrably under `$PATH`.
Expand Down
7 changes: 5 additions & 2 deletions front-end/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ authors = ["Sudip Ghimire <sudipghimire533@gmail.com>"]
[dependencies]
tokio = { version = "1", features = ["full"] }
crossterm = { version = "0.20", features = ["event-stream"] }
tui = { version = "0.16", features = ["crossterm"], default-features = false }
tui = { package = "ratatui", version = "0.22.0", features = ["crossterm", "all-widgets"], default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
libmpv = { version = "2.0.1" }
libmpv = { git = "https://github.com/sudipghimire533/libmpv-rs", branch = "master" }
fetcher = { path = "../fetcher" }
lazy_static = "1.4.0"
config = { path = "../config" }
reqwest = { version = "0.11", features = ["json", "gzip"] }

[features]
build_libmpv = ["libmpv/build_libmpv"]
2 changes: 1 addition & 1 deletion front-end/src/ui/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ pub async fn event_sender(
let increase_by = match direction {
HeadTo::Next => CONFIG.constants.volume_step,
HeadTo::Prev => CONFIG.constants.volume_step * -1,
HeadTo::Initial => 0
HeadTo::Initial => 0,
};

let res = state.player.change_volume(increase_by);
Expand Down
Loading

0 comments on commit 63989ee

Please sign in to comment.