🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=spotifyd
PKG_VERSION:=0.4.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/Spotifyd/spotifyd/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=GPL-3.0-only
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=rust/host
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/rust/rust-package.mk
define Package/spotifyd
SECTION:=sound
CATEGORY:=Sound
TITLE:=A spotify daemon
DEPENDS:=$(RUST_ARCH_DEPENDS) @(!arm||TARGET_bcm53xx||HAS_FPU) @!(i386||mips||mipsel) +alsa-lib
URL:=https://spotifyd.rs/
USERID:=spotifyd:spotifyd
endef
define Package/spotifyd/description
An open source Spotify client running as a UNIX daemon.
Spotifyd streams music just like the official client, but is more
lightweight and supports more platforms. Spotifyd also supports the
Spotify Connect protocol, which makes it show up as a device that
can be controlled from the official clients.
endef
define Package/spotifyd/conffiles
/etc/config/spotifyd
endef
define Package/spotifyd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/spotifyd $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(CURDIR)/files/spotifyd.config $(1)/etc/config/spotifyd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(CURDIR)/files/spotifyd.init $(1)/etc/init.d/spotifyd
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(CURDIR)/files/spotifyd.uci $(1)/etc/uci-defaults/99-spotifyd-migration
endef
$(eval $(call RustBinPackage,spotifyd))
$(eval $(call BuildPackage,spotifyd))
+38
View File
@@ -0,0 +1,38 @@
config spotifyd 'config'
option enabled '0'
# credential info
option username ''
option token ''
# device info
option device_name ''
option device_type ''
# device control
option backend 'alsa'
option control ''
option device ''
option mixer ''
# song control
option autoplay '0'
option audio_format 's32'
option bitrate '320'
# volume control
option initial_volume ''
option volume_normalisation ''
option normalisation_pregain ''
option volume_controller ''
# cache
option no_audio_cache '1'
option cache_path ''
option max_cache_size ''
# advanced
option on_song_change_hook ''
option proxy ''
option zeroconf_port ''
+103
View File
@@ -0,0 +1,103 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
CONF="spotifyd"
PROG="/usr/bin/spotifyd"
is_enabled() {
local enabled
config_get enabled "$1" "$2" "${3:-0}"
if [ "$enabled" -eq "1" ]; then
return 0
else
return 1
fi
}
append_param_arg() {
local value
config_get value "$1" "$2" $3
[ -n "$value" ] && procd_append_param command "--${2//_/-}" "$value"
}
append_param_bool() {
is_enabled "$1" "$2" $3 && procd_append_param command "--${2//_/-}"
}
load_config_arg() {
# device info
append_param_arg "$1" "device_name"
append_param_arg "$1" "device_type"
# device control
append_param_arg "$1" "backend"
append_param_arg "$1" "control"
append_param_arg "$1" "device"
append_param_arg "$1" "mixer"
# song control
append_param_bool "$1" "autoplay"
append_param_arg "$1" "audio_format"
append_param_arg "$1" "bitrate"
# volume control
append_param_arg "$1" "initial_volume"
append_param_bool "$1" "volume_normalisation"
append_param_arg "$1" "normalisation_pregain"
append_param_arg "$1" "volume_controller"
# cache
append_param_bool "$1" "no_audio_cache" "1"
is_enabled "$1" "no_audio_cache" || append_param_arg "$1" "max_cache_size"
# advanced
append_param_arg "$1" "on_song_change_hook"
append_param_arg "$1" "proxy"
append_param_arg "$1" "zeroconf_port"
}
start_service() {
config_load "$CONF"
is_enabled "config" "enabled" || return 1
procd_open_instance "$CONF"
procd_set_param command "$PROG"
procd_append_param command "--no-daemon"
load_config_arg "config"
# cache path
local cache_path
config_get cache_path "config" "cache_path" "/var/run/spotifyd"
procd_append_param command "--cache-path" "$cache_path"
mkdir -p "$cache_path"
# credentials
local username token
config_get username "config" "username"
config_get token "config" "token"
if [ -n "$username" ] && [ -n "$token" ]; then
mkdir -p "$cache_path/oauth"
echo -n "{\"username\":\"$username\",\"auth_type\":1,\"auth_data\":\"$token\"}" > "$cache_path/oauth/credentials.json"
chmod 0600 "$cache_path/oauth/credentials.json"
mkdir -p "$cache_path/zeroconf"
cp -fp "$cache_path/oauth/credentials.json" "$cache_path/zeroconf/"
fi
chown -R "spotifyd":"spotifyd" "$cache_path"
procd_set_param user spotifyd
procd_set_param group spotifyd
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "$CONF"
}
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
audio_format="$(uci -q get "spotifyd.config.audio_format")"
[ -n "$audio_format" ] || exit 0
case "$audio_format" in
"F32"|"S16"|"S24"|"S32")
audio_format="$(echo "$audio_format" | tr "[A-Z]" "[a-z]")"
;;
"S24_3")
audio_format="s24-3"
;;
esac
if [ -n "$audio_format" ]; then
uci -q set "spotifyd.config.audio_format"="$audio_format"
uci -q commit "spotifyd"
fi
exit 0