-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6973cf5
commit 303d771
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- {"order":1,"arguments":[]} | ||
|
||
local rc, result = mympd.api("MYMPD_API_CHANNEL_MESSAGES_READ", {}) | ||
|
||
if rc == 1 or result.totalEntities == 0 then | ||
return | ||
end | ||
|
||
local messages = "" | ||
for _, msg in pairs(result.data) do | ||
messages = messages .. msg.channel .. ": " .. msg.message | ||
end | ||
|
||
return messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- {"order":1,"arguments":["channel", "message"]} | ||
|
||
local channel = mympd_arguments.channel | ||
if not channel or channel == "" then | ||
channel = "myMPD" | ||
end | ||
|
||
local rc, result = mympd.api("MYMPD_API_CHANNEL_MESSAGE_SEND", { | ||
channel = channel, | ||
message = mympd_arguments.message | ||
}) | ||
|
||
if rc == 1 then | ||
return "Failure sending message: " .. result.data.msg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- {"order":1,"arguments":["channel"]} | ||
|
||
local channel = mympd_arguments.channel | ||
if not channel or channel == "" then | ||
channel = "myMPD" | ||
end | ||
|
||
local rc, result = mympd.api("MYMPD_API_CHANNEL_SUBSCRIBE", { | ||
channel = channel | ||
}) | ||
|
||
if rc == 1 then | ||
return "Failure subscribing to the channel: " .. result.data.msg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Channel | ||
|
||
Scripts for MPD channels. | ||
|
||
| SCRIPT | DESCRIPTION | | ||
| ------ | ----------- | | ||
| `ChannelSubscribe.lua` | Subscribes to a channel. Connect it to the `mympd_connected` event to subscribe myMPD to a channel. | | ||
| `ChannelReadMessages.lua` | Reads all messages from a channel. Connect it to the `mpd_message` to receive messages. | | ||
| `ChannelSendMessage.lua` | Sends a message to a channel. | |