Kaynağa Gözat

upmpdcli: Add UPnP icon. Use procd for start/stop. Add uci config support for multiple instances

Signed-off-by: Ted Hess <thess@kitschensync.net>
Ted Hess 10 yıl önce
ebeveyn
işleme
4eb1e3aea4

+ 7
- 4
multimedia/upmpdcli/Makefile Dosyayı Görüntüle

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=upmpdcli
11 11
 PKG_VERSION:=0.9.0
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 15
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -39,10 +39,13 @@ endef
39 39
 define Package/upmpdcli/install
40 40
 	$(INSTALL_DIR) $(1)/etc
41 41
 	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/upmpdcli.conf $(1)/etc/
42
+	$(INSTALL_DIR) $(1)/etc/config
43
+	$(INSTALL_CONF) ./files/upmpdcli.config $(1)/etc/config/upmpdcli
42 44
 	$(INSTALL_DIR) $(1)/usr/bin
43
-	$(CP) $(PKG_INSTALL_DIR)/usr/bin/upmpdcli $(1)/usr/bin/
44
-	$(INSTALL_DIR) $(1)/usr/share
45
-	$(CP) $(PKG_INSTALL_DIR)/usr/share/upmpdcli $(1)/usr/share/
45
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upmpdcli $(1)/usr/bin/
46
+	$(INSTALL_DIR) $(1)/usr/share/upmpdcli
47
+	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/upmpdcli/* $(1)/usr/share/upmpdcli/
48
+	$(INSTALL_DATA) ./files/upmpdcli.png $(1)/usr/share/upmpdcli/
46 49
 	$(INSTALL_DIR) $(1)/etc/init.d
47 50
 	$(INSTALL_BIN) ./files/upmpdcli.init $(1)/etc/init.d/upmpdcli
48 51
 endef

+ 15
- 0
multimedia/upmpdcli/files/upmpdcli.config Dosyayı Görüntüle

@@ -0,0 +1,15 @@
1
+config upmpdcli lan
2
+	option interface 'br-lan'
3
+#	option friendly_name 'upmpdcli'
4
+#	option mpd_host '127.0.0.1'
5
+#	option mpd_port '6600'
6
+#	option upmpd_port '0'
7
+#	option config '/etc/upmpdcli.conf'
8
+
9
+# Add additional interfaces
10
+#
11
+#config upmpdcli wifi
12
+#	option interface 'wlan0'
13
+
14
+#config upmpdcli wan
15
+#	option interface 'eth0'

+ 41
- 8
multimedia/upmpdcli/files/upmpdcli.init Dosyayı Görüntüle

@@ -1,18 +1,51 @@
1 1
 #!/bin/sh /etc/rc.common
2 2
 # Copyright (C) 2014 OpenWrt.org
3 3
 
4
+NAME=upmpdcli
4 5
 START=95
5 6
 
6
-create_user() {
7
-       group_exists upmpdcli || group_add upmpdcli 89
8
-       user_exists upmpdcli || user_add upmpdcli 89
7
+UPMPD_BIN=/usr/bin/${NAME}
8
+
9
+USE_PROCD=1
10
+
11
+append_arg() {
12
+        local cfg="$1"
13
+        local var="$2"
14
+        local opt="$3"
15
+        local def="$4"
16
+        local val
17
+
18
+        config_get val "$cfg" "$var"
19
+        [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
20
+}
21
+
22
+start_instance() {
23
+       local cfg="$1"
24
+       local interface
25
+
26
+       procd_open_instance
27
+
28
+       procd_set_param command "${UPMPD_BIN}"
29
+
30
+#      config_get interface "$cfg" interface
31
+#      procd_add_reload_interface_trigger $interface
32
+
33
+       append_arg "$cfg" interface "-i"
34
+       append_arg "$cfg" mpd_host "-h"
35
+       append_arg "$cfg" mpd_port "-p"
36
+       append_arg "$cfg" upmpd_port "-P"
37
+
38
+       append_arg "$cfg" config "-c"
39
+       append_arg "$cfg" friendly_name "-f"
40
+
41
+       procd_close_instance
9 42
 }
10 43
 
11
-start() {
12
-       create_user
13
-       service_start /usr/bin/upmpdcli -D
44
+service_triggers() {
45
+       procd_add_reload_trigger "${NAME}"
14 46
 }
15 47
 
16
-stop() {
17
-       service_stop /usr/bin/upmpdcli
48
+start_service() {
49
+       config_load ${NAME}
50
+       config_foreach start_instance ${NAME}
18 51
 }

BIN
multimedia/upmpdcli/files/upmpdcli.png Dosyayı Görüntüle


+ 9
- 0
multimedia/upmpdcli/patches/010-Add_icon_config.patch Dosyayı Görüntüle

@@ -0,0 +1,9 @@
1
+--- a/src/upmpdcli.conf
2
++++ b/src/upmpdcli.conf
3
+@@ -53,3 +53,6 @@ ohmetapersist = 1
4
+ #  Path to the sc2mpd if it is not in /usr/bin and the location is not in
5
+ #  the PATH for the init scripts.
6
+ #sc2mpd = /usr/bin/sc2mpd
7
++
8
++# Icon for MPD UPnP interface
9
++iconpath = /usr/share/upmpdcli/upmpdcli.png