[girl] GNOME Internet Radio Locator 9.1.0



commit 1bbabfe06c26b86588f67c47caaa13f288a722dc
Author: Ole Aamot <oka oka no>
Date:   Tue Jun 7 13:09:43 2016 +0200

    GNOME Internet Radio Locator 9.1.0

 NEWS               |   12 +++++++
 configure          |   20 ++++++------
 configure.ac       |    2 +-
 girl.spec.in       |    6 ++++
 src/Makefile.am    |    4 +-
 src/Makefile.in    |    4 +-
 src/girl-station.c |   83 ++++++++++++++++++++++++++++++++++++++++++++++-----
 src/girl.c         |   19 ++++++++----
 src/girl.h         |    6 +++-
 src/girl.xml       |    4 +-
 10 files changed, 127 insertions(+), 33 deletions(-)
---
diff --git a/NEWS b/NEWS
index bbaefb8..8260fbb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,16 @@
 =============
+Version 9.1.0
+=============
+
+GUI
+       * girl-station.c: Implement async processes with GAsyncReadyCallback
+
+Stations
+
+       * src/girl.xml: Add Radio USP (São Paulo, Brazil)
+       * src/girl.xml: Add Radio Uchile (Santiago, Chile)
+
+=============
 Version 9.0.0
 =============
 
diff --git a/configure b/configure
index 99d7b16..99d1423 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for girl 9.0.0.
+# Generated by GNU Autoconf 2.69 for girl 9.1.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='girl'
 PACKAGE_TARNAME='girl'
-PACKAGE_VERSION='9.0.0'
-PACKAGE_STRING='girl 9.0.0'
+PACKAGE_VERSION='9.1.0'
+PACKAGE_STRING='girl 9.1.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1364,7 +1364,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures girl 9.0.0 to adapt to many kinds of systems.
+\`configure' configures girl 9.1.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1430,7 +1430,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of girl 9.0.0:";;
+     short | recursive ) echo "Configuration of girl 9.1.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1545,7 +1545,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-girl configure 9.0.0
+girl configure 9.1.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1910,7 +1910,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by girl $as_me 9.0.0, which was
+It was created by girl $as_me 9.1.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2773,7 +2773,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='girl'
- VERSION='9.0.0'
+ VERSION='9.1.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -7457,7 +7457,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by girl $as_me 9.0.0, which was
+This file was extended by girl $as_me 9.1.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7523,7 +7523,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-girl config.status 9.0.0
+girl config.status 9.1.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 59361a4..5f01a26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(girl, 9.0.0)
+AC_INIT(girl, 9.1.0)
 AM_INIT_AUTOMAKE([no-dist-gzip dist-xz])
 AC_CONFIG_SRCDIR([src/girl.c])
 AC_CONFIG_HEADER([config.h])
diff --git a/girl.spec.in b/girl.spec.in
index 7fdd817..ee1d40d 100644
--- a/girl.spec.in
+++ b/girl.spec.in
@@ -70,6 +70,12 @@ fi
 %{_datadir}/help/*/%{name}
 
 %changelog
+* Tue Jun 07 2016 Ole Aamot - 9.1.0-1.fc23
+- Girl 9.1.0 build on Fedora Linux 23
+
+* Sun May 22 2016 Ole Aamot - 9.0.0-1.fc23
+- Girl 9.0.0 build on Fedora Linux 23
+
 * Sat May 21 2016 Ole Aamot - 8.5.0-1.fc23
 - Girl 8.5.0 build on Fedora Linux 23
 
diff --git a/src/Makefile.am b/src/Makefile.am
index fc13bad..bcd70cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,9 +44,9 @@ girl_CFLAGS  = $(GIRL_CFLAGS) \
 girl_LDADD = $(GIRL_LIBS)
 
 girldir = $(datadir)/girl
-girl_DATA = girl-8.0.dtd girl-logo.png girl.png girl.xml
+girl_DATA = girl-9.1.dtd girl-logo.png girl.png girl.xml
 
-EXTRA_DIST = girl.h girl-station.h girl-stations-map.h girl-tz.h girl-gui.h girl-listener.h girl-program.h 
girl-runners.h girl-streams.h girl-8.0.dtd girl-map.png girl-logo.png girl.png girl.xml
+EXTRA_DIST = girl.h girl-station.h girl-stations-map.h girl-tz.h girl-gui.h girl-listener.h girl-program.h 
girl-runners.h girl-streams.h girl-9.1.dtd girl-map.png girl-logo.png girl.png girl.xml
 
 all-local: check-local
 
diff --git a/src/Makefile.in b/src/Makefile.in
index 9bce41f..b3f8d45 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -400,8 +400,8 @@ girl_CFLAGS = $(GIRL_CFLAGS) \
 
 girl_LDADD = $(GIRL_LIBS)
 girldir = $(datadir)/girl
-girl_DATA = girl-8.0.dtd girl-logo.png girl.png girl.xml
-EXTRA_DIST = girl.h girl-station.h girl-stations-map.h girl-tz.h girl-gui.h girl-listener.h girl-program.h 
girl-runners.h girl-streams.h girl-8.0.dtd girl-map.png girl-logo.png girl.png girl.xml
+girl_DATA = girl-9.1.dtd girl-logo.png girl.png girl.xml
+EXTRA_DIST = girl.h girl-station.h girl-stations-map.h girl-tz.h girl-gui.h girl-listener.h girl-program.h 
girl-runners.h girl-streams.h girl-9.1.dtd girl-map.png girl-logo.png girl.png girl.xml
 all: all-am
 
 .SUFFIXES:
diff --git a/src/girl-station.c b/src/girl-station.c
index e0a7eaa..5d088f0 100644
--- a/src/girl-station.c
+++ b/src/girl-station.c
@@ -31,6 +31,7 @@
 #include <sys/resource.h>
 #include <glib.h>
 #include <glib/gstdio.h>
+#include <gio/gio.h>
 #include <gtk/gtk.h>
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
@@ -67,6 +68,18 @@ void show_error(gchar * msg)
 #endif                         /* GIRL_CLI */
 }
 
+GAsyncReadyCallback
+cb_subprocess_player (GSubprocess *subprocess)
+{
+       g_subprocess_force_exit(subprocess);
+}
+
+GAsyncReadyCallback
+cb_subprocess_record (GSubprocess *subprocess)
+{
+       g_subprocess_force_exit(subprocess);
+}
+
 static void
 cb_child_watch_player( GPid  pid,
                       gint  status)
@@ -145,7 +158,7 @@ cb_timeout( )
        return( TRUE );
 }
 
-void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType helper)
+void girl_helper_run(gchar *url, gchar *name, GirlStreamType type, GirlHelperType helper)
 {
        GError *err = NULL;
        GTimeVal mtime;
@@ -155,6 +168,9 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
        char **argv = NULL;
        gint argc;
        gboolean    ret;
+       GError *error = NULL;
+       GCancellable *player_cancellable;
+       GCancellable *record_cancellable;
        
        if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
                perror(0);
@@ -215,14 +231,12 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
                                
                                /* printf("Archiving program at %s\n", archive); */
                                
-                               appbar_send_msg(_("Recording from %s in %s on %s to %s"),
+                               appbar_send_msg(_("Recording from %s in %s to %s"),
                                                girl->selected_station_name,
                                                girl->selected_station_location,
-                                               girl->selected_station_uri,
                                                girl->selected_archive_file);           
                                
                                command = g_strconcat(app, " ", url, " -d ", g_get_home_dir(), "/.girl/ -D 
%D", NULL);
-
                                GIRL_DEBUG_MSG("%s\n", command);
 
                                // girl_archive_new("Archive", girl->selected_archive_file);
@@ -335,7 +349,22 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
 #endif
 
                /* Original async player code */
-               
+
+               girl->player_launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
+               girl->player_subprocess = g_subprocess_launcher_spawn (girl->player_launcher, &error, app, 
url, NULL);
+               if (girl->player_subprocess == NULL) {
+                       msg = g_strdup_printf(_("Failed to open URL: '%s'\n"
+                                               "Details: %s"), url, error->message);
+                       show_error(msg);
+                       g_error_free(error);
+                       g_free(msg);
+                       goto quit_player;
+               } else {
+                       girl->player_status = GIRL_PLAYER_TRUE;
+                       GIRL_DEBUG_MSG("Launching %s player\n", command);
+               }
+
+#if 0
                if (!g_spawn_command_line_async(command, &err)) {
                        msg = g_strdup_printf(_("Failed to open URL: '%s'\n"
                                                "Details: %s"), url, err->message);
@@ -345,8 +374,12 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
                } else {
                        girl->player_status = GIRL_PLAYER_TRUE;
                        GIRL_DEBUG_MSG("Launching %s player\n", command);
+                       g_subprocess_wait_async (girl->player_subprocess,
+                                                player_cancellable,
+                                                (GAsyncReadyCallback)cb_subprocess_player,
+                                                NULL);
                }
-
+#endif
        }
        
        if (helper == GIRL_STREAM_RECORD) {
@@ -354,7 +387,25 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
 /* #if 0 */
                /* gchar *argv[] = { command, NULL }; */
                /* Spawn child process */
-               
+               gchar *recording_path_name = g_strconcat(g_get_home_dir(), "/.girl/", NULL);
+               gchar *formatting_argument = g_strdup("-D %D");
+               girl->record_launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
+               girl->record_subprocess = g_subprocess_launcher_spawn (girl->record_launcher, &error, 
GIRL_HELPER_RECORD, url, "-d", recording_path_name, "-D", "%D", NULL);
+               if (girl->record_subprocess == NULL) {
+                       msg = g_strdup_printf(_("Failed to run '%s'\n"
+                                               "Details: %s"), GIRL_HELPER_RECORD, error->message);
+                       show_error(msg);
+                       g_error_free(error);
+                       g_free(msg);
+                       goto quit_record;
+               } else {
+                       GIRL_DEBUG_MSG("Launching %s\n", command);
+                       g_subprocess_wait_async (girl->record_subprocess,
+                                                record_cancellable,
+                                                (GAsyncReadyCallback)cb_subprocess_record, NULL);
+               }
+
+#if 0
                g_shell_parse_argv(command,
                                   &argc,
                                   &argv,
@@ -384,7 +435,7 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
                /* girl->record_pid = pid; */
                girl->record_status = GIRL_RECORD_TRUE;
 
-               girl_archive_new("Archive", girl->selected_archive_file);
+               girl_archive_new("Archive", girl->selected_archive_file, girl->selected_streams_codec);
                                
                /* Install timeout fnction that will move the progress bar */
                girl->timeout_id = g_timeout_add(100,(GSourceFunc)cb_timeout,girl);
@@ -432,7 +483,21 @@ void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType
                 * will clean any remnants of process. */
                g_child_watch_add( girl->record_pid, (GChildWatchFunc)cb_child_watch_record, girl );
 #endif
+#endif
        }
+
+quit_player:
+
+        if (girl->player_subprocess)
+               g_object_unref(girl->player_subprocess);
+        if (girl->player_launcher)
+               g_object_unref(girl->player_launcher);
+quit_record:
+        if (girl->record_subprocess)
+               g_object_unref(girl->record_subprocess);
+        if (girl->record_launcher)
+               g_object_unref(girl->record_launcher);
+
 }
 
 void girl_stream_player(GtkWidget * widget, gpointer data)
@@ -699,7 +764,7 @@ gint girl_station_update (GirlStationInfo *head, gchar *station_band, gchar *sta
                stationinfo = stationinfo->next;
 
        }
-       fprintf(fp, "  <station band=\"%s\" id=\"%s\" lang=\"en\" name=\"%s\" rank=\"1.0\" type=\"org\">\n    
<frequency uri=\"%s\">%s in %s</frequency>\n    <location>%s</location>\n    <description 
lang=\"en\">%s</description>\n    <stream uri=\"%s\" />\n    <uri>%s</uri>\n  </station>\n", 
new_station->band, new_station->name, new_station->name, new_station->uri, new_station->band, 
new_station->location, new_station->location, new_station->description, new_station->uri, new_station->uri);
+       fprintf(fp, "  <station band=\"%s\" id=\"%s\" lang=\"en\" name=\"%s\" rank=\"1.0\" type=\"org\">\n    
<frequency uri=\"%s\">%s in %s</frequency>\n    <location>%s</location>\n    <description 
lang=\"en\">%s</description>\n    <stream uri=\"%s\" />\n    <uri>%s</uri>\n  </station>\n", 
new_station->band, new_station->name, new_station->name, new_station->uri, new_station->band, 
new_station->location, new_station->location, new_station->description, new_station->stream->uri, 
new_station->uri);
        fprintf(fp, "</girl>\n");
        fclose(fp);
        girl_stations = g_list_append(girl_stations, (GirlStationInfo *)new_station);
diff --git a/src/girl.c b/src/girl.c
index 2dec9bb..ffc99d7 100644
--- a/src/girl.c
+++ b/src/girl.c
@@ -610,6 +610,9 @@ void quit_app(GtkWidget * a, gpointer user_data)
        // girl_station_save(stationinfo, NULL, NULL, NULL, NULL, NULL, NULL);
        g_spawn_close_pid(girl->record_pid);
        g_spawn_close_pid(girl->player_pid);
+
+       g_subprocess_force_exit(girl->player_subprocess);
+       g_subprocess_force_exit(girl->record_subprocess);
        // kill(girl->record_pid,SIGHUP);
        // kill(girl->player_pid,SIGHUP);
        gtk_main_quit();
@@ -875,8 +878,10 @@ void on_stop_button_clicked(GtkWidget *a, gpointer user_data)
        if (girl->record_status == GIRL_RECORD_TRUE) {
                
                /* Close pid */
-               
-               g_spawn_close_pid( girl->record_pid);
+
+               g_subprocess_force_exit(girl->record_subprocess);
+
+               // g_spawn_close_pid( girl->record_pid);
 
                appbar_send_msg(_("Finished saving recording from the radio station %s in %s from %s to %s"),
                                girl->selected_station_name,
@@ -889,8 +894,10 @@ void on_stop_button_clicked(GtkWidget *a, gpointer user_data)
        } else {
 
                if (girl->player_status == GIRL_PLAYER_TRUE) {
-                       
-                       g_spawn_close_pid( girl->player_pid);
+
+                       g_subprocess_force_exit(girl->player_subprocess);
+
+                       // g_spawn_close_pid( girl->player_pid);
                        
                        appbar_send_msg(_("To finish playing from the radio station %s in %s, exit the 
application Videos."),
                                        girl->selected_station_name,
@@ -947,13 +954,13 @@ girl_archive_progress_callback(GnomeVFSXferProgressInfo * info, gpointer data)
        return TRUE;
 }
 
-gint girl_archive_new(gchar *title, gchar *file)
+gint girl_archive_new(gchar *title, gchar *file, gchar *codec)
        
 {
        int ret;
        gchar *oldpath, *newpath;
 
-       oldpath = g_strconcat(g_get_home_dir(), "/.girl/incomplete/ - .mp3", NULL);
+       oldpath = g_strconcat(g_get_home_dir(), "/.girl/incomplete/ - .", strtok(codec, "/"), NULL);
        newpath = g_strconcat(file, NULL);
        
        GIRL_DEBUG_MSG("Renaming %s to %s\n", oldpath, newpath);
diff --git a/src/girl.h b/src/girl.h
index 8125f8e..1e9a394 100644
--- a/src/girl.h
+++ b/src/girl.h
@@ -71,7 +71,7 @@ void statusbar_send_msg(const char *a, ...);
 gchar *copy_to_mem(GnomeVFSURI * uri, GnomeVFSFileSize len);
 
 void appbar_send_msg(const char *a, ...);
-gint girl_archive_new(gchar *title, gchar *file);
+gint girl_archive_new(gchar *title, gchar *file, gchar *codec);
 
 /* Fetcher for the channels */
 
@@ -140,6 +140,10 @@ struct _GirlData {
        GdkPixbuf *icon;
        gint player_status;
        GPid player_pid;
+       GSubprocess *player_subprocess;
+       GSubprocess *record_subprocess;
+       GSubprocessLauncher *player_launcher;
+       GSubprocessLauncher *record_launcher;
        gint record_status;
        GPid record_pid;
 };
diff --git a/src/girl.xml b/src/girl.xml
index 08ef375..7bd076a 100644
--- a/src/girl.xml
+++ b/src/girl.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet type="text/xsl" href="girl.xsl" ?>
-<!DOCTYPE girl SYSTEM "girl-8.0.dtd">
-<girl version="8.4.1">
+<!DOCTYPE girl SYSTEM "girl-9.1.dtd">
+<girl version="9.1.0">
   <station band="102.5FM" id="radiouchile" lang="es" name="Radio Uchile" rank="1.0" type="edu">
     <frequency uri="http://radio.uchile.cl/";>102.5 FM in Santiago, Chile</frequency>
     <location>Santiago, Chile</location>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]