[OpenWrt-Devel] [PATCH 4/4] luci2-shairplay: add new package

Álvaro Fernández Rojas noltari at gmail.com
Thu Nov 20 19:10:33 EST 2014


Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
diff --git a/luci2-shairplay/Makefile b/luci2-shairplay/Makefile
new file mode 100644
index 0000000..53105a8
--- /dev/null
+++ b/luci2-shairplay/Makefile
@@ -0,0 +1,36 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=luci2-shairplay
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luci2-shairplay
+  SECTION:=luci2
+  CATEGORY:=LuCI2
+  TITLE:=LuCI2 shairplay module
+  DEPENDS:=luci2 +shairplay
+endef
+
+define Package/luci2-shairplay/description
+  LuCI2 module for shairplay
+endef
+
+define Build/Compile
+endef
+
+define Package/luci2-shairplay/install
+	$(INSTALL_DIR) $(1)/usr/share/rpcd/menu.d
+	$(INSTALL_DATA) ./files/usr/share/rpcd/menu.d/services.shairplay.json $(1)/usr/share/rpcd/menu.d/
+
+	$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
+	$(INSTALL_DATA) ./files/usr/share/rpcd/acl.d/services.shairplay.json $(1)/usr/share/rpcd/acl.d/
+
+	$(INSTALL_DIR) $(1)/www/luci2/template
+	$(INSTALL_DATA) ./files/www/luci2/template/services.shairplay.htm $(1)/www/luci2/template
+
+	$(INSTALL_DIR) $(1)/www/luci2/view
+	$(INSTALL_DATA) ./files/www/luci2/view/services.shairplay.js $(1)/www/luci2/view
+endef
+
+$(eval $(call BuildPackage,luci2-shairplay))
diff --git a/luci2-shairplay/files/usr/share/rpcd/acl.d/services.shairplay.json b/luci2-shairplay/files/usr/share/rpcd/acl.d/services.shairplay.json
new file mode 100644
index 0000000..6242e12
--- /dev/null
+++ b/luci2-shairplay/files/usr/share/rpcd/acl.d/services.shairplay.json
@@ -0,0 +1,15 @@
+{
+	"shairplay": {
+		"description": "Shairplay management",
+		"read": {
+			"uci": [
+				"shairplay"
+			]
+		},
+		"write": {
+			"uci": [
+				"shairplay"
+			]
+		}
+	}
+}
diff --git a/luci2-shairplay/files/usr/share/rpcd/menu.d/services.shairplay.json b/luci2-shairplay/files/usr/share/rpcd/menu.d/services.shairplay.json
new file mode 100644
index 0000000..74fc794
--- /dev/null
+++ b/luci2-shairplay/files/usr/share/rpcd/menu.d/services.shairplay.json
@@ -0,0 +1,11 @@
+{
+	"services": {
+		"title": "Services",
+		"index": 40
+	},
+	"services/shairplay": {
+		"title": "shairplay",
+		"acls": [ "shairplay" ],
+		"view": "services/shairplay"
+	}
+}
diff --git a/luci2-shairplay/files/www/luci2/template/services.shairplay.htm b/luci2-shairplay/files/www/luci2/template/services.shairplay.htm
new file mode 100644
index 0000000..ad19e7d
--- /dev/null
+++ b/luci2-shairplay/files/www/luci2/template/services.shairplay.htm
@@ -0,0 +1 @@
+<div id="map"></div>
diff --git a/luci2-shairplay/files/www/luci2/view/services.shairplay.js b/luci2-shairplay/files/www/luci2/view/services.shairplay.js
new file mode 100644
index 0000000..038b49c
--- /dev/null
+++ b/luci2-shairplay/files/www/luci2/view/services.shairplay.js
@@ -0,0 +1,85 @@
+L.ui.view.extend({
+	execute: function() {
+		var self = this;
+
+		var m = new L.cbi.Map('shairplay', {
+			caption:     L.tr('Shairplay (AirPlay server)')
+		});
+
+		var s = m.section(L.cbi.TypedSection, 'shairplay', {
+			caption:      L.tr('Shairplay'),
+			addremove:    true,
+			add_caption:  L.tr('Add shairplay service …'),
+		});
+
+		s.option(L.cbi.CheckboxValue, 'disabled', {
+			caption:     L.tr('Enabled'),
+			initial:     1,
+			enabled:     '0',
+			disabled:    '1'
+		});
+
+		s.option(L.cbi.CheckboxValue, 'respawn', {
+			caption:     L.tr('Respawn'),
+			description: 'Specifies if the server should restart on crash',
+			initial:     1,
+			enabled:     '1',
+			disabled:    '0'
+		});
+
+		s.option(L.cbi.InputValue, 'apname', {
+			caption:     L.tr('Airport Name'),
+			description: L.tr('Specifies the AirServer name'),
+		});
+
+		s.option(L.cbi.InputValue, 'port', {
+			caption:     L.tr('Port'),
+			description: L.tr('Specifies the listening port'),
+			datatype:    'port'
+		});
+
+		s.option(L.cbi.PasswordValue, 'password', {
+			caption:     L.tr('Password'),
+			description: L.tr('Specifies the server password'),
+			optional:    true
+		});
+
+		s.option(L.cbi.InputValue, 'hwaddr', {
+			caption:     L.tr('HW Address'),
+			description: L.tr('Specifies the hardware address announced by the server'),
+			datatype:    'macaddr',
+			optional:    true
+		});
+
+		var ao_driver = s.option(L.cbi.ListValue, 'ao_driver', {
+			caption:     L.tr('AO Driver'),
+			description: L.tr('Specifies AO Driver'),
+			initial:     '',
+			optional:    true
+		});
+		ao_driver.value('', L.tr('Default'));
+		ao_driver.value('alsa');
+		ao_driver.value('alsa05');
+		// ao_driver.value('arts');
+		// ao_driver.value('esd');
+		// ao_driver.value('irix');
+		// ao_driver.value('nas');
+		ao_driver.value('oss');
+		// ao_driver.value('sun');
+
+		s.option(L.cbi.InputValue, 'ao_devicename', {
+			caption:     L.tr('Ao Device Name'),
+			description: L.tr('Specifies AO Device Name'),
+			optional:    true
+		});
+
+		s.option(L.cbi.InputValue, 'ao_deviceid', {
+			caption:     L.tr('Device'),
+			description: L.tr('Specifies AO Device ID'),
+			datatype:    'uinteger',
+			optional:    true
+		});
+
+		return m.insertInto('#map');
+	}
+});
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list