$ git clone http://tcclient.ion.nu/tc_client.git
commit bee73292f6377485359e2b1bcd20ba9f35cdc0d0
Author: Alicia <...>
Date: Wed May 27 16:55:07 2015 +0200
modbot: added a !nowplaying command to get the title of the current video.
diff --git a/ChangeLog b/ChangeLog
index 3f2aaaa..8b5aa65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ tc_client-gtk: when camming down, remove the glib event source for our cam strea
tc_client-gtk: send the cam stream to tc_client from the main process instead of from the cam child process to avoid potential overlap of writes.
modbot: for !badvid, only play the next video if the one we marked as bad was the currently playing video.
modbot: make sure we don't skip over an unapproved video in queue before the 2 minutes are up.
+modbot: added a !nowplaying command to get the title of the current video.
0.31:
Fixed the issue where messages would show up on kanji on some platforms (a proper fix instead of the earlier android & apple workaround)
When a message is sent with a privacy field, send it once with 'b' (broadcasting) and once with 'n' (not-broadcasting)
diff --git a/utilities/modbot/commands.html b/utilities/modbot/commands.html
index 3696d46..f71858c 100644
--- a/utilities/modbot/commands.html
+++ b/utilities/modbot/commands.html
@@ -17,6 +17,7 @@
<tr><td>!requestedby</td><td>see who requested the current video</td></tr>
<tr><td>!modstats</td><td>get a percentage of how often there are mods in the channel (aside from modbot)</td></tr>
<tr><td>!syncvid</td><td>synchronize video position (or see a video that was started while having youtube videos disabled in the flash client)</td></tr>
+ <tr><td>!nowplaying</td><td>get the title (and link) of the currently playing video</td></tr>
<tr><th colspan="2">Mod commands:</th></tr>
<tr><td>!playnext</td><td>play the next video in queue without approving it (to see if it's ok)</td></tr>
<tr><td>!approve</td><td>mark the currently playing video as good, or if none is playing the next in queue</td></tr>
diff --git a/utilities/modbot/modbot.c b/utilities/modbot/modbot.c
index 6986ce6..ca8ba83 100644
--- a/utilities/modbot/modbot.c
+++ b/utilities/modbot/modbot.c
@@ -35,6 +35,7 @@ struct list goodvids={0,0}; // pre-approved videos
struct list badvids={0,0}; // not allowed, essentially banned
char* playing=0;
char* requester=0;
+char* title=0;
time_t started=0;
int tc_client;
@@ -141,8 +142,8 @@ void playnextvid()
waitskip=0;
playing=queue.items[0].video;
requester=queue.items[0].requester;
+ title=queue.items[0].title;
say(0, "/mbs youTube %s 0 %s\n", playing, queue.items[0].title);
- free(queue.items[0].title);
--queue.itemcount;
memmove(queue.items, &queue.items[1], sizeof(struct queueitem)*queue.itemcount);
// Find out the video's length and schedule an alarm for then
@@ -154,8 +155,10 @@ void playnext(int x)
{
free(playing);
free(requester);
+ free(title);
playing=0;
requester=0;
+ title=0;
if(queue.itemcount<1){alarm(0); printf("Nothing more to play\n"); return;} // Nothing more to play
if(!list_contains(&goodvids, queue.items[0].video))
{
@@ -467,7 +470,7 @@ int main(int argc, char** argv)
else if(!strcmp(msg, "!requestedby"))
{
if(!playing){say(pm, "Nothing is playing\n");}
- else{say(pm, "%s requested %s\n", requester, playing);}
+ else{say(pm, "%s requested %s (%s)\n", requester, playing, title);}
}
else if(!strcmp(msg, "!time")) // Debugging
{
@@ -512,6 +515,11 @@ int main(int argc, char** argv)
say(pm, "Nothing is playing\n");
}
}
+ else if(!strcmp(msg, "!nowplaying"))
+ {
+ if(!playing){say(pm, "Nothing is playing\n");}
+ else{say(pm, "Currently playing: %s (http://youtube.com/watch?v=%s )\n", title, playing);}
+ }
else if(list_contains(&mods, nick)) // Mods-only commands
{
if(!strcmp(msg, "!playnext"))