Re: [Musicpd-dev-team] mpdscribble for win32?
On Mon, Feb 6, 2012 at 11:18 AM, Bart Nagel b...@tremby.net wrote: Hi, folks. I've just started at a new job and have been given a Windows box. I've managed to get MPD and a couple of clients running (which is going to make my life much more comfortable) but I can't find a win32 binary for mpdscribble. I'm not up to compiling it myself (in a Windows environment, anyway), so does anyone know of an existing binary, or is anyone willing to do me a favour and produce one? I can offer a small bounty if that swings it. I will tonight. No bounty, it works oob with my scripts. -- avuton -- Fortes fortuna adiuvat -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] mpdscribble for win32?
At 2012-02-06 13:11:36 -0800, Avuton Olrich wrote: On Mon, Feb 6, 2012 at 11:18 AM, Bart Nagel b...@tremby.net wrote: Hi, folks. I've just started at a new job and have been given a Windows box. I've managed to get MPD and a couple of clients running (which is going to make my life much more comfortable) but I can't find a win32 binary for mpdscribble. I'm not up to compiling it myself (in a Windows environment, anyway), so does anyone know of an existing binary, or is anyone willing to do me a favour and produce one? I can offer a small bounty if that swings it. I will tonight. No bounty, it works oob with my scripts. Thanks very much! -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] mpdscribble for win32?
On Mon, Feb 6, 2012 at 1:13 PM, Bart Nagel b...@tremby.net wrote: At 2012-02-06 13:11:36 -0800, Avuton Olrich wrote: On Mon, Feb 6, 2012 at 11:18 AM, Bart Nagel b...@tremby.net wrote: Hi, folks. I've just started at a new job and have been given a Windows box. I've managed to get MPD and a couple of clients running (which is going to make my life much more comfortable) but I can't find a win32 binary for mpdscribble. I'm not up to compiling it myself (in a Windows environment, anyway), so does anyone know of an existing binary, or is anyone willing to do me a favour and produce one? I can offer a small bounty if that swings it. I will tonight. No bounty, it works oob with my scripts. Thanks very much! I didn't test it, but last time I tested it, it was fine. If you run into any issues, feel free to shoot me an email. http://sourceforge.net/projects/musicpd/files/mpdscribble/0.22/mpdscribble-0.22-win32.zip/download -- avuton -- Fortes fortuna adiuvat -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] mpdscribble for win32?
At 2012-02-06 18:01:10 -0800, Avuton Olrich wrote: On Mon, Feb 6, 2012 at 1:13 PM, Bart Nagel b...@tremby.net wrote: At 2012-02-06 13:11:36 -0800, Avuton Olrich wrote: On Mon, Feb 6, 2012 at 11:18 AM, Bart Nagel b...@tremby.net wrote: Hi, folks. I've just started at a new job and have been given a Windows box. I've managed to get MPD and a couple of clients running (which is going to make my life much more comfortable) but I can't find a win32 binary for mpdscribble. I'm not up to compiling it myself (in a Windows environment, anyway), so does anyone know of an existing binary, or is anyone willing to do me a favour and produce one? I can offer a small bounty if that swings it. I will tonight. No bounty, it works oob with my scripts. Thanks very much! I didn't test it, but last time I tested it, it was fine. If you run into any issues, feel free to shoot me an email. http://sourceforge.net/projects/musicpd/files/mpdscribble/0.22/mpdscribble-0.22-win32.zip/download That's working. Thanks! --bart -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] mpdscribble
Somebody claiming to be Max Kellermann wrote: On 2009/04/07 19:01, Stephen Paul Weber singpol...@singpolyma.net wrote: Attached please find 5 patch files, each the output of a git show for 5 commits that progressively implement this feature :) Found a major problem: conn.c does not deal with more than one connection at a time. There's the global variable g, which needs to be converted to a parameter, so we have a per-server conn object. Result: mpdscribble: src/conn.c:89: conn_initiate: Assertion `!g.pending' failed. Attached is a patch to deal with that :) -- Stephen Paul Weber, @singpolyma Please see http://singpolyma.net for how I prefer to be contacted. nerve perfume pogo. commit 7c960b224524ee6471faf8f146fbf1dec3dae352 Author: Stephen Paul Weber singpol...@singpolyma.net Date: Wed Apr 8 17:15:28 2009 -0400 Get rid of globals for conn.c diff --git a/src/as.c b/src/as.c index 629d351..d87bae0 100644 --- a/src/as.c +++ b/src/as.c @@ -413,7 +413,7 @@ static void as_handshake(struct config_as_host *as_host) // notice (handshake url:\n%s, url); - if (!conn_initiate(url-str, as_handshake_callback, NULL, as_host)) { + if (!conn_initiate(url-str, as_handshake_callback, NULL, as_host, as_host-conn)) { g_warning(something went wrong when trying to connect, probably a bug\n); @@ -472,7 +472,7 @@ as_send_now_playing(const char *artist, const char *track, g_message(sending 'now playing' notification to '%s'\n, as_host-url); if (!conn_initiate(as_host-g_nowplay_url, as_submit_callback, - post_data-str, as_host)) { + post_data-str, as_host, as_host-conn)) { g_warning(failed to POST to %s\n, as_host-g_nowplay_url); as_host-g_state = AS_READY; @@ -559,7 +559,7 @@ static void as_submit(struct config_as_host *as_host) g_submit_pending = count; if (!conn_initiate(as_host-g_submit_url, as_submit_callback, - post_data-str, as_host)) { + post_data-str, as_host, as_host-conn)) { g_warning(something went wrong when trying to connect, probably a bug\n); @@ -635,9 +635,8 @@ void as_init(void) g_message(loaded %i song%s from cache\n, queue_length, queue_length == 1 ? : s); - conn_setup(); - do { + current_host-conn = conn_setup(); current_host-g_session = NULL; current_host-g_nowplay_url = NULL; current_host-g_submit_url = NULL; @@ -695,6 +694,4 @@ void as_cleanup(void) g_queue_foreach(queue, free_queue_song, NULL); g_queue_free(queue); - - conn_cleanup(); } diff --git a/src/conn.c b/src/conn.c index 6214d82..56cbff4 100644 --- a/src/conn.c +++ b/src/conn.c @@ -21,29 +21,13 @@ #include conn.h #include file.h #include as.h -#include config.h - -#include libsoup/soup-uri.h -#include libsoup/soup-session-async.h #include assert.h #include stdlib.h #include stdio.h #include string.h -struct global { - SoupSession *session; - char *base; - bool pending; - callback_t *callback; -#ifdef HAVE_SOUP_24 - SoupURI *proxy; -#else - SoupUri *proxy; -#endif -}; - -static struct global g; +int g_thread_done = 0; static void #ifdef HAVE_SOUP_24 @@ -53,51 +37,62 @@ conn_callback(G_GNUC_UNUSED SoupSession * session, conn_callback(SoupMessage * msg, gpointer data) #endif { - assert(g.pending); + struct global *g = data; + assert(g-pending); - g.pending = false; + g-pending = false; /* NOTE: does not support redirects */ if (SOUP_STATUS_IS_SUCCESSFUL(msg-status_code)) { #ifdef HAVE_SOUP_24 - g.callback(msg-response_body-length, - msg-response_body-data, data); + g-callback(msg-response_body-length, + msg-response_body-data, g-data); #else - g.callback(msg-response.length, msg-response.body, data); + g-callback(msg-response.length, msg-response.body, g-data); #endif } else - g.callback(0, NULL, data); + g-callback(0, NULL, g-data); } -void conn_setup(void) +struct global *conn_setup(void) { - g_type_init(); - g_thread_init(NULL); - g.pending = false; + if(!g_thread_done) { + g_type_init(); + g_thread_init(NULL); + g_thread_done = 1; + } + + struct global *g = malloc(sizeof *g); + + g-pending = false; if (file_config.proxy != NULL) - g.proxy = soup_uri_new(file_config.proxy); + g-proxy = soup_uri_new(file_config.proxy); else - g.proxy = NULL; + g-proxy = NULL; + + return g; } int -conn_initiate(char *url, callback_t * callback, char *post_data, void *data) +conn_initiate(char *url, callback_t * callback, char *post_data, void *data, struct global *g) { SoupMessage *msg; - assert(!g.pending); + assert(!g-pending); + + g-data = data; - g.callback = callback; + g-callback = callback; - g.base = url; + g-base = url; - g.session = - soup_session_async_new_with_options(SOUP_SESSION_PROXY_URI, g.proxy, + g-session = + soup_session_async_new_with_options(SOUP_SESSION_PROXY_URI, g-proxy, NULL); if (post_data) { - msg = soup_message_new(SOUP_METHOD_POST, g.base); + msg = soup_message_new(SOUP_METHOD_POST, g-base); #ifdef HAVE_SOUP_24
Re: [Musicpd-dev-team] mpdscribble
Somebody claiming to be Max Kellermann wrote: On 2009/04/07 01:39, Stephen Paul Weber singpol...@singpolyma.net wrote: Yes, this is exactly the functionality I had in mind :) Be sure that old configuration files continue to work. Attached please find 5 patch files, each the output of a git show for 5 commits that progressively implement this feature :) -- Stephen Paul Weber, @singpolyma Please see http://singpolyma.net for how I prefer to be contacted. nerve perfume pogo. commit 4134470abcc4d23e6c971056826036461882c4eb Author: Stephen Paul Weber singpol...@singpolyma.net Date: Tue Apr 7 10:52:34 2009 -0400 Don't assume last.fm AS_HOST + config parsing In fact, don't assume global state for username/password either. A lot of changes to as.c, conn.c, conn.h just to allow a pointer to a struct containing the state instead of assuming global. This patch still just uses the first as_host from the list. file.h and file.c have been modified to actually parse the new config file format and create a linked list of as_hosts. There is a memory leak in the config parser: the linked list is not freed. Since we need it all in memory until shutting down, this is likely not a problem, but a comment reminder has been added. diff --git a/src/as.c b/src/as.c index 545189c..c2fe75d 100644 --- a/src/as.c +++ b/src/as.c @@ -45,8 +45,6 @@ #define MAX_VAR_SIZE 8192 #define MAX_TIMESTAMP_SIZE 64 -#define AS_HOST http://post.audioscrobbler.com/; - /* don't submit more than this amount of songs in a batch. */ #define MAX_SUBMIT_COUNT 10 @@ -128,13 +126,13 @@ add_var_i(GString * s, const char *key, signed char idx, const char *val) } static void -as_schedule_handshake(void); +as_schedule_handshake(struct config_as_host *as_host); static void -as_submit(void); +as_submit(struct config_as_host *as_host); static void -as_schedule_submit(void); +as_schedule_submit(struct config_as_host *as_host); static void as_increase_interval(void) { @@ -217,7 +215,7 @@ static void as_song_cleanup(struct song *s, int free_struct) free(s); } -static void as_handshake_callback(size_t length, const char *response) +static void as_handshake_callback(size_t length, const char *response, void *as_host) { as_handshaking state = AS_COMMAND; char *newline; @@ -230,7 +228,7 @@ static void as_handshake_callback(size_t length, const char *response) if (!length) { g_warning(handshake timed out\n); as_increase_interval(); - as_schedule_handshake(); + as_schedule_handshake(as_host); return; } @@ -242,7 +240,7 @@ static void as_handshake_callback(size_t length, const char *response) if (!ret) { g_free(next); as_increase_interval(); -as_schedule_handshake(); +as_schedule_handshake(as_host); return; } @@ -268,7 +266,7 @@ static void as_handshake_callback(size_t length, const char *response) /* handshake was successful: see if we have songs to submit */ - as_submit(); + as_submit(as_host); return; } @@ -279,7 +277,7 @@ static void as_handshake_callback(size_t length, const char *response) } as_increase_interval(); - as_schedule_handshake(); + as_schedule_handshake(as_host); } static void as_queue_remove_oldest(unsigned count) @@ -292,7 +290,7 @@ static void as_queue_remove_oldest(unsigned count) } } -static void as_submit_callback(size_t length, const char *response) +static void as_submit_callback(size_t length, const char *response, void *as_host) { char *newline; @@ -303,7 +301,7 @@ static void as_submit_callback(size_t length, const char *response) g_submit_pending = 0; g_warning(submit timed out\n); as_increase_interval(); - as_schedule_submit(); + as_schedule_submit(as_host); return; } @@ -329,15 +327,15 @@ static void as_submit_callback(size_t length, const char *response) /* submit the next chunk (if there is some left) */ - as_submit(); + as_submit(as_host); break; case AS_SUBMIT_FAILED: as_increase_interval(); - as_schedule_submit(); + as_schedule_submit(as_host); break; case AS_SUBMIT_HANDSHAKE: g_state = AS_NOTHING; - as_schedule_handshake(); + as_schedule_handshake(as_host); break; } } @@ -403,7 +401,7 @@ static char *as_md5(const char *password, const char *timestamp) return result; } -static void as_handshake(void) +static void as_handshake(struct config_as_host *as_host) { GString *url; char *timestr, *md5; @@ -411,15 +409,15 @@ static void as_handshake(void) g_state = AS_HANDSHAKING; timestr = as_timestamp(); - md5 = as_md5(file_config.password, timestr); + md5 = as_md5(as_host-password, timestr); /* construct the handshake url. */ - url = g_string_new(AS_HOST); + url = g_string_new(as_host-url); first_var(url, hs, true); add_var(url, p, 1.2); add_var(url, c, AS_CLIENT_ID); add_var(url, v, AS_CLIENT_VERSION); - add_var(url, u, file_config.username); + add_var(url, u,
Re: [Musicpd-dev-team] mpdscribble
On 2009/04/06 20:17, Stephen Paul Weber singpol...@singpolyma.net wrote: More and more web services are starting to implement the audioscrobbler API (jamendo.com, libre.fm). I would like to scrobble all my mpd listens to multiple of these services with mpdscribble. As it is, I can change the host in the config, which works, but then I can only switch providers, I cannot use more than one. So you have multiple MPD installations, and you want to scrobble all of them? Looking at the source it seems this would not be too difficult to implement. I may be able to figure it out (though I'm not familiar with glib), but thought I would ask the list first to see if someone has a better idea about this. Sure this is possible, but it will make the code more complex and less readable. I'm not sure if this is a good idea. Why not run a separate mpdscribble on each MPD server? Max -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] mpdscribble
I think the idea was to send the audioscrobbler data to multiple servers, not to connect to multiple instances of mpd - this got confused by the use of the word host in the sample config. I think the idea would be more something like this (using similar format to mpdconf): scrobbleserver { server = jamendo.com user = ... password = ... } scrobbleserver { ... } ...other mpdscribble options... Obviously the format of the config can be changed. Is this the functionality you had in mind? Jeffrey On Mon, Apr 6, 2009 at 2:44 PM, Max Kellermann m...@duempel.org wrote: On 2009/04/06 20:17, Stephen Paul Weber singpol...@singpolyma.net wrote: More and more web services are starting to implement the audioscrobbler API (jamendo.com, libre.fm). I would like to scrobble all my mpd listens to multiple of these services with mpdscribble. As it is, I can change the host in the config, which works, but then I can only switch providers, I cannot use more than one. So you have multiple MPD installations, and you want to scrobble all of them? Looking at the source it seems this would not be too difficult to implement. I may be able to figure it out (though I'm not familiar with glib), but thought I would ask the list first to see if someone has a better idea about this. Sure this is possible, but it will make the code more complex and less readable. I'm not sure if this is a good idea. Why not run a separate mpdscribble on each MPD server? Max -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team
Re: [Musicpd-dev-team] mpdscribble
On 2009/04/07 01:39, Stephen Paul Weber singpol...@singpolyma.net wrote: Yes, this is exactly the functionality I had in mind :) OK, understand. While I'm not interested in that feature, I understand others are, and I'd be willing to merge that. Give the configuration file format a good thought when you hack on that: currently, mpdscribble uses GKeyFile to parse the configuration file in .INI style. The parser invocation contains a hack, because historically, there is no section name in the file. We could say that users who want to use multiple scrobbler servers have to explicitly add the section name. What you could do now is make one INI section per scrobbling server. Example: [mpdscribble] log=syslog host=localhost scrobblers=foo bar [foo] username=foo password=secret server=http://foo.fm [bar] username=bar password=secret server=http://bar.fm Be sure that old configuration files continue to work. Max -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team