Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ git clone --recurse-submodules https://github.com/Stremio/stremio-linux-shell

#### Fedora
```bash
dnf install mpv-devel flatpak-builder gtk3-devel libappindicator-gtk3-devel
dnf install mpv-devel flatpak-builder gtk3-devel libappindicator-gtk3-devel mpv-mpris
```

```bash
Expand All @@ -35,7 +35,7 @@ cargo build --release

#### Ubuntu
```bash
apt install build-essential libssl-dev libnss3 libmpv-dev flatpak-builder libgtk-3-dev libappindicator3-dev
apt install build-essential libssl-dev libnss3 libmpv-dev flatpak-builder libgtk-3-dev libappindicator3-dev mpv-mpris
```

```bash
Expand All @@ -54,5 +54,8 @@ python3 -m pip install toml aiohttp
```

```bash
./flatpak/build.sh
# build debug flatpak (com.stremio.Stremio.Devel)
./flatpak/build-debug.sh
# build release flatpak (com.stremio.Stremio)
./flatpak/build-release.sh
```
13 changes: 10 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::{
fs::{self, File},
io::BufReader,
path::{Path, PathBuf},
fmt::Debug, fs::{self, File}, io::BufReader, path::{Path, PathBuf}
};

use anyhow::{Error, Ok, Result};
Expand Down Expand Up @@ -64,6 +62,15 @@ fn main() -> Result<()> {
fs::remove_file(&archive_path)?;
}

/* BzzzThe18th:
scripts_path uses $HOME variable to get user home, then creates both mpv folder and scripts folder if they don't exist
canonicalize makes the path absolute */
let scripts_path = PathBuf::from(std::env::var("HOME")? + "/.config/mpv/scripts").canonicalize()?;

if !scripts_path.exists() {
fs::create_dir_all(scripts_path)?;
}

println!(
"cargo:rustc-env=LD_LIBRARY_PATH={}",
cef_path.to_str().unwrap()
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions flatpak/build-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

package_id="com.stremio.Stremio"
cwd="flatpak"

python3 $cwd/flatpak-builder-tools/cargo/flatpak-cargo-generator.py Cargo.lock -o $cwd/cargo-sources.json

flatpak-builder --repo=$cwd/repo --force-clean $cwd/build $cwd/$package_id.json
flatpak build-bundle $cwd/repo $cwd/$package_id.flatpak $package_id
6 changes: 5 additions & 1 deletion flatpak/com.stremio.Stremio.Devel.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
},
"command": "stremio",
"finish-args": [
"--socket=session-bus",
"--socket=wayland",
"--socket=x11",
"--socket=pulseaudio",
"--share=ipc",
"--share=network",
"--device=dri",
"--persist=.stremio-server",
"--filesystem=~/.config/mpv",
"--filesystem=xdg-download",
"--filesystem=xdg-run/stremio:create",
"--env=LD_LIBRARY_PATH=/app/lib/:/app/lib64/:/app/share/stremio",
Expand Down Expand Up @@ -68,7 +70,9 @@
"install -Dm644 data/com.stremio.Stremio.metainfo.xml /app/share/metainfo/com.stremio.Stremio.Devel.metainfo.xml",
"sed -i -e 's/com.stremio.Stremio/com.stremio.Stremio.Devel/g' /app/share/metainfo/com.stremio.Stremio.Devel.metainfo.xml",
"mkdir -p /app/lib/ffmpeg",
"mkdir -p /app/lib/intel-vaapi-driver"
"mkdir -p /app/lib/intel-vaapi-driver",
"mkdir -p ~/.config/mpv && mkdir -p ~/.config/mpv/scripts",
"cp /usr/lib64/mpv/mpris.so ~/.config/mpv/scripts"
],
"sources": [
{
Expand Down
180 changes: 180 additions & 0 deletions flatpak/com.stremio.Stremio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"app-id": "com.stremio.Stremio",
"runtime": "org.freedesktop.Platform",
"runtime-version": "24.08",
"sdk": "org.freedesktop.Sdk",
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable"
],
"add-extensions": {
"org.freedesktop.Platform.ffmpeg-full": {
"version": "24.08",
"directory": "lib/ffmpeg",
"add-ld-path": "."
},
"org.freedesktop.Platform.VAAPI.Intel": {
"version": "24.08",
"directory": "lib/intel-vaapi-driver",
"add-ld-path": ".",
"download-if": "have-intel-gpu",
"enable-if": "have-intel-gpu"
}
},
"command": "stremio",
"finish-args": [
"--socket=session-bus",
"--socket=wayland",
"--socket=x11",
"--socket=pulseaudio",
"--share=ipc",
"--share=network",
"--device=dri",
"--persist=.stremio-server",
"--filesystem=~/.config/mpv",
"--filesystem=xdg-download",
"--filesystem=xdg-run/stremio:create",
"--env=LD_LIBRARY_PATH=/app/lib/:/app/lib64/:/app/share/stremio",
"--system-talk-name=org.freedesktop.systemd1",
"--system-talk-name=org.freedesktop.UPower",
"--talk-name=org.kde.StatusNotifierWatcher",
"--talk-name=org.kde.kwalletd6"
],
"build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin",
"append-pkg-config-path": "/app/lib/pkgconfig:/app/lib64/pkgconfig",
"env": {
"CEF_PATH": "/app/share/stremio"
}
},
"modules": [
{
"name": "stremio",
"buildsystem": "simple",
"build-options": {
"env": {
"CARGO_HOME": "/run/build/stremio/cargo",
"RUSTFLAGS": "-L /app/lib -L /app/lib64 -C link-arg=-Wl,-rpath-link=/app/lib -C link-arg=-Wl,-rpath-link=/app/lib64"
}
},
"build-commands": [
"cargo --offline fetch --manifest-path Cargo.toml --verbose",
"cargo --offline build --release --verbose -F offline-build"
],
"post-install": [
"install -Dm755 data/stremio -t /app/bin/",
"install -Dm755 target/release/stremio-linux-shell /app/share/stremio/stremio",
"install -Dm644 data/server.js -t /app/share/stremio/",
"install -Dm644 data/icons/com.stremio.Stremio.svg -t /app/share/icons/hicolor/scalable/apps/",
"install -Dm644 data/com.stremio.Stremio.desktop /app/share/applications/com.stremio.Stremio.desktop",
"sed -i -e 's/com.stremio.Stremio/com.stremio.Stremio/g' /app/share/applications/com.stremio.Stremio.desktop",
"install -Dm644 data/com.stremio.Stremio.metainfo.xml /app/share/metainfo/com.stremio.Stremio.metainfo.xml",
"sed -i -e 's/com.stremio.Stremio/com.stremio.Stremio/g' /app/share/metainfo/com.stremio.Stremio.metainfo.xml",
"mkdir -p /app/lib/ffmpeg",
"mkdir -p /app/lib/intel-vaapi-driver",
"mkdir -p ~/.config/mpv && mkdir -p ~/.config/mpv/scripts",
"cp /usr/lib64/mpv/mpris.so ~/.config/mpv/scripts"
],
"sources": [
{
"type": "dir",
"path": "../"
},
"cargo-sources.json"
],
"modules": [
{
"name": "libmpv",
"buildsystem": "meson",
"config-opts": [
"-Dbuild-date=false",
"-Dcplayer=false",
"-Dlibmpv=true",
"-Dmanpage-build=disabled"
],
"cleanup": [
"/include",
"/lib/pkgconfig"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/mpv-player/mpv/archive/v0.40.0.tar.gz",
"sha256": "10a0f4654f62140a6dd4d380dcf0bbdbdcf6e697556863dc499c296182f081a3"
}
],
"modules": [
{
"name": "libplacebo",
"buildsystem": "meson",
"config-opts": [
"-Ddemos=false"
],
"cleanup": [
"/include",
"/lib/pkgconfig"
],
"sources": [
{
"type": "git",
"url": "https://github.com/haasn/libplacebo.git",
"tag": "v7.349.0"
}
]
},
{
"name": "libass",
"buildsystem": "meson",
"cleanup": [
"/include",
"/lib/pkgconfig"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/libass/libass/archive/0.17.3.tar.gz",
"sha256": "26fbfb7a7bd3e6d5c713f8a65a12b36084d1dde6efaed8a9996489054c4aeca0"
}
]
}
]
},
{
"name": "cef",
"buildsystem": "simple",
"build-commands": [
"install -D Release/libcef.so -t /app/share/stremio/",
"install -D Release/libEGL.so -t /app/share/stremio/",
"install -D Release/libGLESv2.so -t /app/share/stremio/",
"install -D Release/libvk_swiftshader.so -t /app/share/stremio/",
"install -D Release/v8_context_snapshot.bin -t /app/share/stremio/",
"install -D Resources/*.pak -t /app/share/stremio/",
"install -D Resources/icudtl.dat -t /app/share/stremio/",
"install -D Resources/locales/*.pak -t /app/share/stremio/locales/"
],
"sources": [
{
"type": "archive",
"url": "https://cef-builds.spotifycdn.com/cef_binary_138.0.21+g54811fe+chromium-138.0.7204.101_linux64_minimal.tar.bz2",
"sha256": "2a86ffe653dd65cf4920fc73aa225735231ac4bb80bcd40a75dfc0643897bcd2"
}
]
}
]
},
{
"name": "nodejs",
"buildsystem": "simple",
"build-commands": [
"install -D bin/node -t /app/bin/"
],
"sources": [
{
"type": "archive",
"url": "https://nodejs.org/dist/v22.15.0/node-v22.15.0-linux-x64.tar.xz",
"sha256": "dafe2e8f82cb97de1bd10db9e2ec4c07bbf53389b0799b1e095a918951e78fd4"
}
]
},
"shared-modules/libappindicator/libappindicator-gtk3-12.10.json"
]
}
5 changes: 5 additions & 0 deletions src/player/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,16 @@ impl Player {
_ => "all=no",
};

/* BzzzThe18th:
set config and config-dir so mpv-mpris can function
mpv automatically converts '~' symbols into $HOME */
let mpv = Mpv::with_initializer(|init| {
init.set_property("vo", "libmpv")?;
init.set_property("video-timing-offset", "0")?;
init.set_property("terminal", "yes")?;
init.set_property("msg-level", msg_level)?;
init.set_property("config", "yes")?;
init.set_property("config-dir", "~/.config/mpv")?;
Ok(())
})
.expect("Failed to create mpv");
Expand Down