Skip to content

Commit

Permalink
Add badges, readme improvements, add alsa buffer frame size, pin play…
Browse files Browse the repository at this point in the history
…back thread to last cpu core, postinstall improve, thread priority, audio buffer size, use env file for variables
  • Loading branch information
ljufa committed Mar 20, 2024
1 parent ee5c95b commit a40fcf1
Show file tree
Hide file tree
Showing 18 changed files with 514 additions and 268 deletions.
114 changes: 61 additions & 53 deletions Cargo.lock

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

20 changes: 18 additions & 2 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RPI_HOST = "192.168.5.4"
TARGET = "aarch64-unknown-linux-gnu"


RELEASE_VERSION = "0.9.6"
RELEASE_VERSION = "0.9.8"
RELEASE_BRANCH = "main"

[config]
Expand All @@ -27,6 +27,17 @@ args = [
"--bin",
"rsplayer",
]
[tasks.build_debug]
command = "cross"
args = [
"build",
"--target",
"${TARGET}",
"--package",
"rsplayer",
"--bin",
"rsplayer",
]
[tasks.build_ui_release]
cwd = "rsplayer_web_ui"
command = "cargo"
Expand Down Expand Up @@ -132,7 +143,7 @@ script = "sudo pkill -9 rsplayer || true"

[tasks.run_local]
dependencies = ["kill_local"]
env = { "RUST_LOG" = "rsplayer=info,rsplayer_playback=info,warp=info", "RUST_BACKTRACE" = "full", "RSPLAYER_HTTP_PORT" = "8000", "RSPLAYER_HTTPS_PORT" = "8443" }
env = { "RUST_LOG" = "rsplayer=info,rsplayer_playback=info,warp=info", "RUST_BACKTRACE" = "full", "PORT" = "8000", "TLS_PORT" = "8443", "TLS_CERT_PATH" = "self.crt", "TLS_CERT_KEY_PATH" = "self.key" }
cwd = ".run"
command = "cargo"
args = ["run"]
Expand All @@ -142,6 +153,11 @@ dependencies = ["build_release"]
script = [
"rsync -avvP --rsync-path=\"sudo rsync\" target/${TARGET}/release/rsplayer pi@${RPI_HOST}:/usr/bin",
]
[tasks.copy_remote_debug]
dependencies = ["build_debug"]
script = [
"rsync -avvP --rsync-path=\"sudo rsync\" target/${TARGET}/debug/rsplayer pi@${RPI_HOST}:/usr/bin",
]

[tasks.package_deb_local]
dependencies = ["build_ui_release", "build_release", "package_deb_release"]
Expand Down
12 changes: 6 additions & 6 deletions PKGS/debian/etc/systemd/system/rsplayer.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ Wants=network.target sound.target
After=remote-fs.target

[Service]
Environment=RUST_BACKTRACE=full
Environment=RSPLAYER_HTTP_PORT=80
Environment=RSPLAYER_HTTPS_PORT=443
Environment=RUST_LOG=rsplayer=info,warp=info
EnvironmentFile=/opt/rsplayer/env
ExecStart=/usr/bin/rsplayer
WorkingDirectory=/opt/rsplayer
Restart=always
Expand All @@ -18,8 +15,11 @@ TimeoutStopSec=5
User=rsplayer
LimitRTPRIO=40
LimitRTTIME=infinity
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SYS_BOOT
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SYS_BOOT
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SYS_BOOT CAP_SYS_NICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SYS_BOOT CAP_SYS_NICE

CPUSchedulingPolicy=rr


[Install]
WantedBy=multi-user.target
7 changes: 7 additions & 0 deletions PKGS/debian/opt/rsplayer/env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PORT=80
TLS_PORT=443
TLS_CERT_PATH=/opt/rsplayer/self.crt
TLS_CERT_KEY_PATH=/opt/rsplayer/self.key

RUST_LOG=rsplayer=info,warp=info

32 changes: 14 additions & 18 deletions PKGS/maintainer-scripts/postinst
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
#!/usr/bin/env bash
if [ "$1" = "configure" ]; then
if [ -z $2 ]
# this is clean install
then
echo "No previous version found this is clean install"
# this is clean install
previous_version="0.0.0"
else
# this is upgrade
previous_version=$2
fi
if dpkg --compare-versions "$previous_version" lt "0.9.1"; then
echo "Upgrading from version $previous_version to 0.9.1"
adduser --system --no-create-home --disabled-login rsplayer
usermod -a -G audio rsplayer
# optional for hardware access
usermod -a -G i2c,gpio,spi,input rsplayer || true
mkdir -p /opt/rsplayer
usermod -a -G i2c,gpio,spi,audio,input rsplayer || true
chown -R rsplayer /opt/rsplayer
#this is upgrade
else
echo "Previous version found: $2"
VERSION_TO_COMPARE="0.9.1"
if [ "$(printf '%s\n' "$VERSION_TO_COMPARE" "$2" | sort -V | head -n1)" = "$VERSION_TO_COMPARE" ]; then
echo "$2 is greater than $VERSION_TO_COMPARE migration not needed."
else
echo "$2 is not greater than $VERSION_TO_COMPARE"
adduser --system --no-create-home --disabled-login rsplayer
usermod -a -G audio rsplayer
# optional for hardware access
usermod -a -G i2c,gpio,spi,audio,input rsplayer || true
chown -R rsplayer /opt/rsplayer
fi
fi
if dpkg --compare-versions "$previous_version" lt "0.9.7"; then
echo "Upgrading from version $previous_version to 0.9.7"
chown rsplayer /opt/rsplayer/env
chown rsplayer /opt/rsplayer/self.*
fi
systemctl daemon-reload
systemctl enable rsplayer
Expand Down
Loading

0 comments on commit a40fcf1

Please sign in to comment.