summaryrefslogtreecommitdiffstats
path: root/audio/herrie/patches
diff options
context:
space:
mode:
author Heinz Wiesinger <pprkut@slackbuilds.org>2010-05-11 20:30:47 +0200
committer Heinz Wiesinger <pprkut@slackbuilds.org>2010-05-11 20:30:47 +0200
commit0720ba2b2888995dd750f9f21ecb9d03084cc0b2 (patch)
tree23523eec3e8a5820e9c27ba17af6435fc3a87c77 /audio/herrie/patches
parentf644b1ad3f26640a1fd20dbf86ebcc6983fb5dff (diff)
downloadslackbuilds-0720ba2b2888995dd750f9f21ecb9d03084cc0b2.tar.gz
slackbuilds-0720ba2b2888995dd750f9f21ecb9d03084cc0b2.tar.xz
audio/herrie: Moved from multimedia
Diffstat (limited to 'audio/herrie/patches')
-rw-r--r--audio/herrie/patches/herrie-2.1-filters-orig.diff221
-rw-r--r--audio/herrie/patches/herrie-2.1-filters.diff263
-rw-r--r--audio/herrie/patches/herrie-2.1-signals.diff67
-rw-r--r--audio/herrie/patches/herrie-autoquit.diff187
4 files changed, 738 insertions, 0 deletions
diff --git a/audio/herrie/patches/herrie-2.1-filters-orig.diff b/audio/herrie/patches/herrie-2.1-filters-orig.diff
new file mode 100644
index 0000000000..c5aba0e086
--- /dev/null
+++ b/audio/herrie/patches/herrie-2.1-filters-orig.diff
@@ -0,0 +1,221 @@
+diff -ru herrie-2.1-orig/herrie-2.1/src/config.c herrie-2.1-filters-orig/herrie-2.1/src/config.c
+--- herrie-2.1-orig/herrie-2.1/src/config.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters-orig/herrie-2.1/src/config.c 2008-07-18 09:51:35.000000000 -0500
+@@ -171,6 +171,8 @@
+ { "scrobbler.username", "", NULL, NULL },
+ #endif /* BUILD_SCROBBLER */
+ { "vfs.dir.hide_dotfiles", "yes", valid_bool, NULL },
++ { "vfs.dir.hide_extfiles", "no", valid_bool, NULL },
++ { "vfs.ext.whitelist", "mp3 wav ogg", NULL, NULL },
+ #ifdef G_OS_UNIX
+ { "vfs.lockup.chroot", "", NULL, NULL },
+ { "vfs.lockup.user", "", NULL, NULL },
+diff -ru herrie-2.1-orig/herrie-2.1/src/playq.c herrie-2.1-filters-orig/herrie-2.1/src/playq.c
+--- herrie-2.1-orig/herrie-2.1/src/playq.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters-orig/herrie-2.1/src/playq.c 2008-07-18 10:16:04.000000000 -0500
+@@ -259,12 +259,20 @@
+ playq_repeat = 1;
+ }
+
++ /* Create and compile Whitelist regex */
++ vfs_create_whitelist(config_getopt("vfs.ext.whitelist"));
++
+ filename = config_getopt("playq.dumpfile");
+ if (load_dumpfile && filename[0] != '\0') {
+ /* Autoload playlist */
+ vr = vfs_lookup(filename, NULL, NULL, 0);
+ if (vr != NULL) {
+- vfs_unfold(&playq_list, vr);
++ if (config_getopt_bool("vfs.dir.hide_extfiles"))
++ vfs_unfold(&playq_list, vr, 1);
++ else {
++ /* Don't filter out files at this time */
++ vfs_unfold(&playq_list, vr, 0);
++ }
+ vfs_close(vr);
+ }
+ }
+@@ -313,7 +321,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, vr);
++ vfs_unfold(&newlist, vr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+@@ -336,7 +344,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, vr);
++ vfs_unfold(&newlist, vr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+@@ -446,7 +454,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, nvr);
++ vfs_unfold(&newlist, nvr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+@@ -468,7 +476,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, nvr);
++ vfs_unfold(&newlist, nvr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+diff -ru herrie-2.1-orig/herrie-2.1/src/vfs.c herrie-2.1-filters-orig/herrie-2.1/src/vfs.c
+--- herrie-2.1-orig/herrie-2.1/src/vfs.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters-orig/herrie-2.1/src/vfs.c 2008-07-18 10:10:18.000000000 -0500
+@@ -185,6 +185,11 @@
+ return g_string_free(npath, FALSE);
+ }
+
++struct vfsmatch * vfs_get_vm_whitelist()
++{
++ return vm_whitelist;
++}
++
+ const char *
+ vfs_lockup(void)
+ {
+@@ -245,6 +250,27 @@
+ g_slice_free(struct vfsent, ve);
+ }
+
++void
++vfs_create_whitelist(const char* whitelist)
++{
++ char res[128] = "";
++ char *expr = "|[.]";
++ strcat(res, "[.]");
++
++ int i,j;
++ for (i=0,j=strlen(res); i < strlen(whitelist); i++) {
++ if (whitelist[i] == ' ') {
++ strcat(res, expr);
++ j+=strlen(expr);
++ }
++ else
++ res[j++] = whitelist[i];
++ }
++ res[j] = '\0';
++
++ vm_whitelist = vfs_match_new(res);
++}
++
+ struct vfsref *
+ vfs_lookup(const char *filename, const char *name, const char *basepath,
+ int strict)
+@@ -363,7 +389,7 @@
+ }
+
+ void
+-vfs_unfold(struct vfslist *vl, const struct vfsref *vr)
++vfs_unfold(struct vfslist *vl, const struct vfsref *vr, int useWhiteList)
+ {
+ struct vfsref *cvr;
+
+@@ -374,8 +400,14 @@
+ /* See if we can recurse it */
+ vfs_populate(vr);
+ VFS_LIST_FOREACH(&vr->ent->population, cvr) {
+- if (cvr->ent->recurse)
+- vfs_unfold(vl, cvr);
++ if (cvr->ent->recurse) {
++ /* Ignore Whitelist if it is not valid
++ * Make sure directories aren't filtered
++ */
++ if (!useWhiteList || vm_whitelist == NULL || !vfs_playable(cvr) ||
++ vfs_match_compare(vm_whitelist, vfs_filename(cvr)))
++ vfs_unfold(vl, cvr, useWhiteList);
++ }
+ }
+ }
+ }
+diff -ru herrie-2.1-orig/herrie-2.1/src/vfs.h herrie-2.1-filters-orig/herrie-2.1/src/vfs.h
+--- herrie-2.1-orig/herrie-2.1/src/vfs.h 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters-orig/herrie-2.1/src/vfs.h 2008-07-18 09:59:21.000000000 -0500
+@@ -164,11 +164,21 @@
+ };
+
+ /**
++ * @brief The compiled regex for the whitelist
++ */
++static struct vfsmatch *vm_whitelist;
++
++/**
+ * @brief Contents of an empty VFS list structure.
+ */
+ #define VFSLIST_INITIALIZER { NULL, NULL, 0 }
+
+ /**
++ * @brief Returns the whitelist
++ */
++struct vfsmatch * vfs_get_vm_whitelist();
++
++/**
+ * @brief Run-time initialize a VFS list structure.
+ */
+ static inline void
+@@ -362,6 +372,14 @@
+ const char *vfs_lockup(void);
+
+ /**
++ * @brief Create the compiled regex for the whitelist.
++ * The input string should be formatted similar to
++ * "ext1 ext2 ext3" and this will be converted into a
++ * Regular Expr like "[.]ext1|[.]ext2|[.]ext3".
++ */
++void vfs_create_whitelist(const char* whitelist);
++
++/**
+ * @brief Create a VFS reference from a filename. The name argument is
+ * optional. It only allows you to display entities with a
+ * different name (inside playlists). When setting the basepath
+@@ -390,7 +408,7 @@
+ * @brief Recursively expand a VFS reference to all their usable
+ * children and append them to the specified list.
+ */
+-void vfs_unfold(struct vfslist *vl, const struct vfsref *vr);
++void vfs_unfold(struct vfslist *vl, const struct vfsref *vr, int useWhiteList);
+ /**
+ * @brief Recursively search through a VFS reference and add all
+ * matching objects to a list. The VFS reference itself will be
+diff -ru herrie-2.1-orig/herrie-2.1/src/vfs_regular.c herrie-2.1-filters-orig/herrie-2.1/src/vfs_regular.c
+--- herrie-2.1-orig/herrie-2.1/src/vfs_regular.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters-orig/herrie-2.1/src/vfs_regular.c 2008-07-18 10:03:06.000000000 -0500
+@@ -73,9 +73,13 @@
+ GDir *dir;
+ const char *sfn;
+ struct vfsref *nvr, *svr;
+- int hide_dotfiles;
++ struct vfsmatch *whitelist;
++ int hide_dotfiles, hide_extfiles;
+
+ hide_dotfiles = config_getopt_bool("vfs.dir.hide_dotfiles");
++ hide_extfiles = config_getopt_bool("vfs.dir.hide_extfiles");
++
++ whitelist = vfs_get_vm_whitelist();
+
+ if ((dir = g_dir_open(ve->filename, 0, NULL)) == NULL)
+ return (-1);
+@@ -88,6 +92,11 @@
+ if ((nvr = vfs_lookup(sfn, NULL, ve->filename, 1)) == NULL)
+ continue;
+
++ /* Hide files (not directories) that are not whitelisted */
++ if (hide_extfiles && whitelist != NULL && vfs_playable(nvr) &&
++ !vfs_match_compare(whitelist, vfs_filename(nvr)))
++ continue;
++
+ /*
+ * Add the items to the tailq in a sorted manner.
+ */
diff --git a/audio/herrie/patches/herrie-2.1-filters.diff b/audio/herrie/patches/herrie-2.1-filters.diff
new file mode 100644
index 0000000000..36ef1fcc80
--- /dev/null
+++ b/audio/herrie/patches/herrie-2.1-filters.diff
@@ -0,0 +1,263 @@
+diff -ru herrie-2.1-autoquit/herrie-2.1/src/config.c herrie-2.1-filters/herrie-2.1/src/config.c
+--- herrie-2.1-autoquit/herrie-2.1/src/config.c 2008-07-18 10:40:34.000000000 -0500
++++ herrie-2.1-filters/herrie-2.1/src/config.c 2008-07-18 10:27:31.000000000 -0500
+@@ -172,6 +172,8 @@
+ { "scrobbler.username", "", NULL, NULL },
+ #endif /* BUILD_SCROBBLER */
+ { "vfs.dir.hide_dotfiles", "yes", valid_bool, NULL },
++ { "vfs.dir.hide_extfiles", "no", valid_bool, NULL },
++ { "vfs.ext.whitelist", "mp3 wav ogg", NULL, NULL },
+ #ifdef G_OS_UNIX
+ { "vfs.lockup.chroot", "", NULL, NULL },
+ { "vfs.lockup.user", "", NULL, NULL },
+diff -ru herrie-2.1-autoquit/herrie-2.1/src/playq.c herrie-2.1-filters/herrie-2.1/src/playq.c
+--- herrie-2.1-autoquit/herrie-2.1/src/playq.c 2008-07-18 10:40:34.000000000 -0500
++++ herrie-2.1-filters/herrie-2.1/src/playq.c 2008-07-18 10:53:53.000000000 -0500
+@@ -153,7 +153,7 @@
+ /**
+ * @brief If true, quit when end of list reached
+ */
+-int playq_autoquit = 0;
++int playq_autoquit = 0;
+
+ /**
+ * @brief Infinitely play music in the playlist, honouring the
+@@ -182,19 +182,19 @@
+
+ /* Try to start a new song when we're not stopped */
+ if (!(playq_flags & PF_STOP)) {
+- if ((nvr = funcs->give()) != NULL) {
+- /* We've got work to do */
+- break;
+- }
+- else {
+- if (playq_autoquit_ready && playq_autoquit) {
+- /* Time to quit - Send ourself the SIGTERM */
+- int res = getpid();
+- if (res !=0){
+- kill(res,SIGTERM);
+- }
+- }
+- }
++ if ((nvr = funcs->give()) != NULL) {
++ /* We've got work to do */
++ break;
++ }
++ else {
++ if (playq_autoquit_ready && playq_autoquit) {
++ /* Time to quit - Send ourself the SIGTERM */
++ int res = getpid();
++ if (res !=0){
++ kill(res,SIGTERM);
++ }
++ }
++ }
+ }
+
+ /* Wait for new events to occur */
+@@ -282,12 +282,20 @@
+ if (autoquit || config_getopt_bool("playq.autoquit"))
+ playq_autoquit = 1;
+
++ /* Create and compile Whitelist regex */
++ vfs_create_whitelist(config_getopt("vfs.ext.whitelist"));
++
+ filename = config_getopt("playq.dumpfile");
+ if (load_dumpfile && filename[0] != '\0') {
+ /* Autoload playlist */
+ vr = vfs_lookup(filename, NULL, NULL, 0);
+ if (vr != NULL) {
+- vfs_unfold(&playq_list, vr);
++ if (config_getopt_bool("vfs.dir.hide_extfiles"))
++ vfs_unfold(&playq_list, vr, 1);
++ else {
++ /* Don't filter out files at this time */
++ vfs_unfold(&playq_list, vr, 0);
++ }
+ vfs_close(vr);
+ }
+ }
+@@ -336,7 +344,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, vr);
++ vfs_unfold(&newlist, vr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+@@ -359,7 +367,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, vr);
++ vfs_unfold(&newlist, vr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+@@ -469,7 +477,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, nvr);
++ vfs_unfold(&newlist, nvr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+@@ -491,7 +499,7 @@
+ struct vfslist newlist = VFSLIST_INITIALIZER;
+
+ /* Recursively expand the item */
+- vfs_unfold(&newlist, nvr);
++ vfs_unfold(&newlist, nvr, 1);
+ if (vfs_list_empty(&newlist))
+ return;
+
+diff -ru herrie-2.1-autoquit/herrie-2.1/src/vfs.c herrie-2.1-filters/herrie-2.1/src/vfs.c
+--- herrie-2.1-autoquit/herrie-2.1/src/vfs.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters/herrie-2.1/src/vfs.c 2008-07-18 10:27:31.000000000 -0500
+@@ -185,6 +185,11 @@
+ return g_string_free(npath, FALSE);
+ }
+
++struct vfsmatch * vfs_get_vm_whitelist()
++{
++ return vm_whitelist;
++}
++
+ const char *
+ vfs_lockup(void)
+ {
+@@ -245,6 +250,27 @@
+ g_slice_free(struct vfsent, ve);
+ }
+
++void
++vfs_create_whitelist(const char* whitelist)
++{
++ char res[128] = "";
++ char *expr = "|[.]";
++ strcat(res, "[.]");
++
++ int i,j;
++ for (i=0,j=strlen(res); i < strlen(whitelist); i++) {
++ if (whitelist[i] == ' ') {
++ strcat(res, expr);
++ j+=strlen(expr);
++ }
++ else
++ res[j++] = whitelist[i];
++ }
++ res[j] = '\0';
++
++ vm_whitelist = vfs_match_new(res);
++}
++
+ struct vfsref *
+ vfs_lookup(const char *filename, const char *name, const char *basepath,
+ int strict)
+@@ -363,7 +389,7 @@
+ }
+
+ void
+-vfs_unfold(struct vfslist *vl, const struct vfsref *vr)
++vfs_unfold(struct vfslist *vl, const struct vfsref *vr, int useWhiteList)
+ {
+ struct vfsref *cvr;
+
+@@ -374,8 +400,14 @@
+ /* See if we can recurse it */
+ vfs_populate(vr);
+ VFS_LIST_FOREACH(&vr->ent->population, cvr) {
+- if (cvr->ent->recurse)
+- vfs_unfold(vl, cvr);
++ if (cvr->ent->recurse) {
++ /* Ignore Whitelist if it is not valid
++ * Make sure directories aren't filtered
++ */
++ if (!useWhiteList || vm_whitelist == NULL || !vfs_playable(cvr) ||
++ vfs_match_compare(vm_whitelist, vfs_filename(cvr)))
++ vfs_unfold(vl, cvr, useWhiteList);
++ }
+ }
+ }
+ }
+diff -ru herrie-2.1-autoquit/herrie-2.1/src/vfs.h herrie-2.1-filters/herrie-2.1/src/vfs.h
+--- herrie-2.1-autoquit/herrie-2.1/src/vfs.h 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters/herrie-2.1/src/vfs.h 2008-07-18 10:27:31.000000000 -0500
+@@ -164,11 +164,21 @@
+ };
+
+ /**
++ * @brief The compiled regex for the whitelist
++ */
++static struct vfsmatch *vm_whitelist;
++
++/**
+ * @brief Contents of an empty VFS list structure.
+ */
+ #define VFSLIST_INITIALIZER { NULL, NULL, 0 }
+
+ /**
++ * @brief Returns the whitelist
++ */
++struct vfsmatch * vfs_get_vm_whitelist();
++
++/**
+ * @brief Run-time initialize a VFS list structure.
+ */
+ static inline void
+@@ -362,6 +372,14 @@
+ const char *vfs_lockup(void);
+
+ /**
++ * @brief Create the compiled regex for the whitelist.
++ * The input string should be formatted similar to
++ * "ext1 ext2 ext3" and this will be converted into a
++ * Regular Expr like "[.]ext1|[.]ext2|[.]ext3".
++ */
++void vfs_create_whitelist(const char* whitelist);
++
++/**
+ * @brief Create a VFS reference from a filename. The name argument is
+ * optional. It only allows you to display entities with a
+ * different name (inside playlists). When setting the basepath
+@@ -390,7 +408,7 @@
+ * @brief Recursively expand a VFS reference to all their usable
+ * children and append them to the specified list.
+ */
+-void vfs_unfold(struct vfslist *vl, const struct vfsref *vr);
++void vfs_unfold(struct vfslist *vl, const struct vfsref *vr, int useWhiteList);
+ /**
+ * @brief Recursively search through a VFS reference and add all
+ * matching objects to a list. The VFS reference itself will be
+diff -ru herrie-2.1-autoquit/herrie-2.1/src/vfs_regular.c herrie-2.1-filters/herrie-2.1/src/vfs_regular.c
+--- herrie-2.1-autoquit/herrie-2.1/src/vfs_regular.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-filters/herrie-2.1/src/vfs_regular.c 2008-07-18 10:27:31.000000000 -0500
+@@ -73,9 +73,13 @@
+ GDir *dir;
+ const char *sfn;
+ struct vfsref *nvr, *svr;
+- int hide_dotfiles;
++ struct vfsmatch *whitelist;
++ int hide_dotfiles, hide_extfiles;
+
+ hide_dotfiles = config_getopt_bool("vfs.dir.hide_dotfiles");
++ hide_extfiles = config_getopt_bool("vfs.dir.hide_extfiles");
++
++ whitelist = vfs_get_vm_whitelist();
+
+ if ((dir = g_dir_open(ve->filename, 0, NULL)) == NULL)
+ return (-1);
+@@ -88,6 +92,11 @@
+ if ((nvr = vfs_lookup(sfn, NULL, ve->filename, 1)) == NULL)
+ continue;
+
++ /* Hide files (not directories) that are not whitelisted */
++ if (hide_extfiles && whitelist != NULL && vfs_playable(nvr) &&
++ !vfs_match_compare(whitelist, vfs_filename(nvr)))
++ continue;
++
+ /*
+ * Add the items to the tailq in a sorted manner.
+ */
diff --git a/audio/herrie/patches/herrie-2.1-signals.diff b/audio/herrie/patches/herrie-2.1-signals.diff
new file mode 100644
index 0000000000..b1a39bea1d
--- /dev/null
+++ b/audio/herrie/patches/herrie-2.1-signals.diff
@@ -0,0 +1,67 @@
+diff -ru herrie-2.1-orig/herrie-2.1/src/gui_input.c herrie-2.1-signals/herrie-2.1/src/gui_input.c
+--- herrie-2.1-orig/herrie-2.1/src/gui_input.c 2008-07-15 10:59:07.000000000 -0500
++++ herrie-2.1-signals/herrie-2.1/src/gui_input.c 2008-07-18 09:44:41.000000000 -0500
+@@ -521,6 +521,9 @@
+ sigset_t sset;
+
+ sigemptyset(&sset);
++ sigaddset(&sset, SIGRTMIN+1);
++ sigaddset(&sset, SIGRTMIN+2);
++ sigaddset(&sset, SIGRTMIN+3);
+ sigaddset(&sset, SIGUSR1);
+ sigaddset(&sset, SIGUSR2);
+ sigaddset(&sset, SIGHUP);
+@@ -545,20 +548,29 @@
+ if (shutting_down)
+ return;
+
+- switch (signal) {
+- case SIGUSR1:
+- playq_cursong_pause();
+- break;
+- case SIGUSR2:
+- playq_cursong_next();
+- break;
+- case SIGHUP:
+- case SIGINT:
+- case SIGPIPE:
+- case SIGQUIT:
+- case SIGTERM:
+- gui_input_quit();
+- g_assert_not_reached();
++ if (signal == (SIGRTMIN+1)) { gui_playq_song_select(); }
++ else {
++ if (signal == (SIGRTMIN+2)) { playq_cursong_stop(); }
++ else {
++ if (signal == (SIGRTMIN+3)) { playq_cursong_prev(); }
++ else {
++ switch (signal) {
++ case SIGUSR1:
++ playq_cursong_pause();
++ break;
++ case SIGUSR2:
++ playq_cursong_next();
++ break;
++ case SIGHUP:
++ case SIGINT:
++ case SIGPIPE:
++ case SIGQUIT:
++ case SIGTERM:
++ gui_input_quit();
++ g_assert_not_reached();
++ }
++ }
++ }
+ }
+ }
+ #endif /* G_OS_UNIX */
+@@ -570,6 +582,9 @@
+ unsigned int i;
+
+ #ifdef G_OS_UNIX
++ signal(SIGRTMIN+1, gui_input_sighandler);
++ signal(SIGRTMIN+2, gui_input_sighandler);
++ signal(SIGRTMIN+3, gui_input_sighandler);
+ signal(SIGUSR1, gui_input_sighandler);
+ signal(SIGUSR2, gui_input_sighandler);
+ signal(SIGHUP, gui_input_sighandler);
diff --git a/audio/herrie/patches/herrie-autoquit.diff b/audio/herrie/patches/herrie-autoquit.diff
new file mode 100644
index 0000000000..d2f01b60db
--- /dev/null
+++ b/audio/herrie/patches/herrie-autoquit.diff
@@ -0,0 +1,187 @@
+diff -ru herrie-autoplay/herrie-2.0.2/src/config.c herrie-autoquit/herrie-2.0.2/src/config.c
+--- herrie-autoplay/herrie-2.0.2/src/config.c 2008-05-16 20:49:55.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/config.c 2008-05-16 02:31:56.000000000 -0500
+@@ -163,6 +163,7 @@
+ { "gui.input.may_quit", "yes", valid_bool, NULL },
+ { "gui.vfslist.scrollpages", "no", valid_bool, NULL },
+ { "playq.autoplay", "no", valid_bool, NULL },
++ { "playq.autoquit", "no", valid_bool, NULL },
+ { "playq.dumpfile", CONFHOMEDIR PLAYQ_DUMPFILE, NULL, NULL },
+ { "playq.xmms", "no", valid_bool, NULL },
+ #ifdef BUILD_SCROBBLER
+diff -ru herrie-autoplay/herrie-2.0.2/src/main.c herrie-autoquit/herrie-2.0.2/src/main.c
+--- herrie-autoplay/herrie-2.0.2/src/main.c 2008-05-16 20:49:55.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/main.c 2008-05-16 02:33:37.000000000 -0500
+@@ -99,7 +99,7 @@
+ static void
+ usage(void)
+ {
+- g_printerr("%s: " APP_NAME " [-pvx] [-c configfile] "
++ g_printerr("%s: " APP_NAME " [-pqvx] [-c configfile] "
+ "[file ...]\n", _("usage"));
+ exit(1);
+ }
+@@ -110,7 +110,7 @@
+ int
+ main(int argc, char *argv[])
+ {
+- int ch, i, show_version = 0, autoplay = 0, xmms = 0;
++ int ch, i, show_version = 0, autoplay = 0, autoquit = 0, xmms = 0;
+ char *cwd;
+ const char *errmsg;
+ struct vfsref *vr;
+@@ -128,7 +128,7 @@
+ config_load(CONFFILE, 1);
+ config_load(CONFHOMEDIR "config", 1);
+
+- while ((ch = getopt(argc, argv, "c:pvx")) != -1) {
++ while ((ch = getopt(argc, argv, "c:pqvx")) != -1) {
+ switch (ch) {
+ case 'c':
+ config_load(optarg, 0);
+@@ -136,6 +136,9 @@
+ case 'p':
+ autoplay = 1;
+ break;
++ case 'q':
++ autoquit = 1;
++ break;
+ case 'v':
+ show_version = 1;
+ break;
+@@ -173,7 +176,7 @@
+ #ifdef BUILD_SCROBBLER
+ scrobbler_init();
+ #endif /* BUILD_SCROBBLER */
+- playq_init(autoplay, xmms, (argc == 0));
++ playq_init(autoplay, autoquit, xmms, (argc == 0));
+
+ /* Draw all the windows */
+ gui_draw_init_post();
+diff -ru herrie-autoplay/herrie-2.0.2/src/playq.c herrie-autoquit/herrie-2.0.2/src/playq.c
+--- herrie-autoplay/herrie-2.0.2/src/playq.c 2008-05-16 20:49:55.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/playq.c 2008-05-25 00:25:02.000000000 -0500
+@@ -151,6 +151,11 @@
+ static volatile int playq_seek_time;
+
+ /**
++ * @brief If true, quit when end of list reached
++ */
++int playq_autoquit = 0;
++
++/**
+ * @brief Infinitely play music in the playlist, honouring the
+ * playq_flags.
+ */
+@@ -163,6 +168,8 @@
+
+ gui_input_sigmask();
+
++ /* Used to prevent autoquit occuring at startup when autoplay is enabled on an empty list */
++ int playq_autoquit_ready = 0;
+ do {
+ /* Wait until there's a song available */
+ playq_lock();
+@@ -174,10 +181,20 @@
+ }
+
+ /* Try to start a new song when we're not stopped */
+- if (!(playq_flags & PF_STOP) &&
+- (nvr = funcs->give()) != NULL) {
++ if (!(playq_flags & PF_STOP)) {
++ if ((nvr = funcs->give()) != NULL) {
+ /* We've got work to do */
+ break;
++ }
++ else {
++ if (playq_autoquit_ready && playq_autoquit) {
++ /* Time to quit - Send ourself the SIGTERM */
++ int res = getpid();
++ if (res !=0){
++ kill(res,SIGTERM);
++ }
++ }
++ }
+ }
+
+ /* Wait for new events to occur */
+@@ -188,6 +205,9 @@
+ }
+ playq_unlock();
+
++ /* Safe to autoquit now */
++ playq_autoquit_ready = 1;
++
+ cur = audio_file_open(nvr);
+ if (cur == NULL) {
+ /* Skip broken songs */
+@@ -242,7 +262,7 @@
+ }
+
+ void
+-playq_init(int autoplay, int xmms, int load_dumpfile)
++playq_init(int autoplay, int autoquit, int xmms, int load_dumpfile)
+ {
+ const char *filename;
+ struct vfsref *vr;
+@@ -259,6 +279,9 @@
+ playq_repeat = 1;
+ }
+
++ if (autoquit || config_getopt_bool("playq.autoquit"))
++ playq_autoquit = 1;
++
+ filename = config_getopt("playq.dumpfile");
+ if (load_dumpfile && filename[0] != '\0') {
+ /* Autoload playlist */
+diff -ru herrie-autoplay/herrie-2.0.2/src/playq.h herrie-autoquit/herrie-2.0.2/src/playq.h
+--- herrie-autoplay/herrie-2.0.2/src/playq.h 2008-05-16 20:49:55.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/playq.h 2008-05-16 02:38:12.000000000 -0500
+@@ -33,7 +33,7 @@
+ /**
+ * @brief Initialize the playlist locking.
+ */
+-void playq_init(int autoplay, int xmms, int load_dumpfile);
++void playq_init(int autoplay, int autoquit, int xmms, int load_dumpfile);
+ /**
+ * @brief Spawn the playback thread.
+ */
+diff -ru herrie-autoplay/herrie-2.0.2/src/playq_modules.h herrie-autoquit/herrie-2.0.2/src/playq_modules.h
+--- herrie-autoplay/herrie-2.0.2/src/playq_modules.h 2008-04-23 14:29:24.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/playq_modules.h 2008-05-16 03:01:29.000000000 -0500
+@@ -36,6 +36,11 @@
+ extern int playq_repeat;
+
+ /**
++ * @brief Flag whether autoquit is turned on by the user.
++ */
++extern int playq_autoquit;
++
++/**
+ * @brief Herrie's routine to fetch the next song from the playlist
+ * (always the first song).
+ */
+diff -ru herrie-autoplay/herrie-2.0.2/src/playq_party.c herrie-autoquit/herrie-2.0.2/src/playq_party.c
+--- herrie-autoplay/herrie-2.0.2/src/playq_party.c 2008-04-23 14:29:24.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/playq_party.c 2008-05-16 03:57:41.000000000 -0500
+@@ -49,7 +49,7 @@
+ nvr = vfs_dup(vr);
+ gui_playq_notify_pre_removal(1);
+ vfs_list_remove(&playq_list, vr);
+- if (playq_repeat) {
++ if (playq_repeat && !playq_autoquit) {
+ /* Add it back to the tail */
+ vfs_list_insert_tail(&playq_list, vr);
+ gui_playq_notify_post_insertion(vfs_list_items(&playq_list));
+diff -ru herrie-autoplay/herrie-2.0.2/src/playq_xmms.c herrie-autoquit/herrie-2.0.2/src/playq_xmms.c
+--- herrie-autoplay/herrie-2.0.2/src/playq_xmms.c 2008-05-16 20:49:55.000000000 -0500
++++ herrie-autoquit/herrie-2.0.2/src/playq_xmms.c 2008-05-16 02:50:17.000000000 -0500
+@@ -61,7 +61,7 @@
+ /* Song after current song */
+ cursong = vfs_list_next(cursong);
+ /* We've reached the end */
+- if (cursong == NULL && playq_repeat)
++ if (cursong == NULL && playq_repeat && !playq_autoquit)
+ cursong = vfs_list_first(&playq_list);
+ } else {
+ cursong = vfs_list_first(&playq_list);