audacious.diff 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. diff --exclude=.deps -rupN audacious-plugins-1.5.1.orig/src/scrobbler/configure.c audacious-plugins-1.5.1/src/scrobbler/configure.c
  2. --- audacious-plugins-1.5.1.orig/src/scrobbler/configure.c 2008-05-23 18:44:20.000000000 -0400
  3. +++ audacious-plugins-1.5.1/src/scrobbler/configure.c 2009-04-09 10:38:24.000000000 -0400
  4. @@ -21,7 +21,7 @@
  5. #include "configure.h"
  6. #include "plugin.h"
  7. -GtkWidget *entry1, *entry2, *ge_entry1, *ge_entry2, *cfgdlg;
  8. +GtkWidget *entry1, *entry2, *entry3, *ge_entry1, *ge_entry2, *cfgdlg;
  9. guint apply_timeout = 0; /* ID of timeout to save new config */
  10. gboolean running = TRUE; /* if plugin threads are running */
  11. @@ -48,6 +48,7 @@ static void saveconfig(void)
  12. const char *uid = gtk_entry_get_text(GTK_ENTRY(entry1));
  13. const char *pwd = gtk_entry_get_text(GTK_ENTRY(entry2));
  14. + const char *svr = gtk_entry_get_text(GTK_ENTRY(entry3));
  15. const char *ge_uid = gtk_entry_get_text(GTK_ENTRY(ge_entry1));
  16. const char *ge_pwd = gtk_entry_get_text(GTK_ENTRY(ge_entry2));
  17. @@ -56,8 +57,10 @@ static void saveconfig(void)
  18. unsigned char md5pword[16], ge_md5pword[16];
  19. if (uid != NULL && uid[0] != '\0' && strlen(uid) &&
  20. - pwd != NULL && pwd[0] != '\0' && strlen(pwd))
  21. + pwd != NULL && pwd[0] != '\0' && strlen(pwd) &&
  22. + svr != NULL && pwd[0] != '\0' && strlen(svr))
  23. {
  24. + aud_cfg_db_set_string(cfgfile, "audioscrobbler", "server", (char *)svr);
  25. aud_cfg_db_set_string(cfgfile, "audioscrobbler", "username", (char *)uid);
  26. md5_init(&md5state);
  27. md5_append(&md5state, (unsigned const char *)pwd, strlen(pwd));
  28. @@ -65,12 +68,13 @@ static void saveconfig(void)
  29. aud_cfg_db_set_string(cfgfile, "audioscrobbler", "password",
  30. hexify((char*)md5pword, sizeof(md5pword)));
  31. } else if (!uid || uid[0] == '\0') {
  32. + aud_cfg_db_set_string(cfgfile, "audioscrobbler", "server", "post.audioscrobbler.com");
  33. aud_cfg_db_set_string(cfgfile, "audioscrobbler", "username", "");
  34. aud_cfg_db_set_string(cfgfile, "audioscrobbler", "password", "");
  35. }
  36. if (ge_uid != NULL && ge_uid[0] != '\0' && strlen(ge_uid) &&
  37. - ge_pwd != NULL && ge_pwd[0] != '\0' && strlen(ge_pwd))
  38. + ge_pwd != NULL && ge_pwd[0] != '\0' && strlen(ge_pwd))
  39. {
  40. aud_cfg_db_set_string(cfgfile, "audioscrobbler", "ge_username", (char *)ge_uid);
  41. md5_init(&md5state);
  42. @@ -155,15 +159,21 @@ create_cfgdlg(void)
  43. gtk_table_set_row_spacings (GTK_TABLE(table1), 6);
  44. gtk_table_set_col_spacings (GTK_TABLE(table1), 6);
  45. + label1 = gtk_label_new (_("Server:"));
  46. + gtk_widget_show (label1);
  47. + gtk_table_attach_defaults (GTK_TABLE (table1), label1, 0, 1, 2, 3);
  48. + gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);
  49. + gtk_misc_set_alignment (GTK_MISC (label1), 1, 0.5);
  50. +
  51. label2 = gtk_label_new (_("Username:"));
  52. gtk_widget_show (label2);
  53. - gtk_table_attach_defaults (GTK_TABLE (table1), label2, 0, 1, 2, 3);
  54. + gtk_table_attach_defaults (GTK_TABLE (table1), label2, 0, 1, 3, 4);
  55. gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT);
  56. gtk_misc_set_alignment (GTK_MISC (label2), 1, 0.5);
  57. label3 = gtk_label_new (_("Password:"));
  58. gtk_widget_show (label3);
  59. - gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 3, 4,
  60. + gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 4, 5,
  61. (GtkAttachOptions) (GTK_FILL),
  62. (GtkAttachOptions) (0), 0, 0);
  63. gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_RIGHT);
  64. @@ -171,12 +181,17 @@ create_cfgdlg(void)
  65. entry1 = gtk_entry_new ();
  66. gtk_widget_show (entry1);
  67. - gtk_table_attach_defaults (GTK_TABLE (table1), entry1, 1, 2, 2, 3);
  68. + gtk_table_attach_defaults (GTK_TABLE (table1), entry1, 1, 2, 3, 4);
  69. entry2 = gtk_entry_new ();
  70. gtk_entry_set_visibility(GTK_ENTRY(entry2), FALSE);
  71. gtk_widget_show (entry2);
  72. - gtk_table_attach_defaults (GTK_TABLE (table1), entry2, 1, 2, 3, 4);
  73. + gtk_table_attach_defaults (GTK_TABLE (table1), entry2, 1, 2, 4, 5);
  74. +
  75. + entry3 = gtk_entry_new ();
  76. + gtk_entry_set_text(GTK_ENTRY(entry3), "post.audioscrobbler.com");
  77. + gtk_widget_show (entry3);
  78. + gtk_table_attach_defaults (GTK_TABLE (table1), entry3, 1, 2, 2, 3);
  79. label1 = gtk_label_new (_("<b>Last.FM</b>"));
  80. gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
  81. @@ -234,6 +249,7 @@ create_cfgdlg(void)
  82. if ((db = aud_cfg_db_open())) {
  83. gchar *username = NULL;
  84. + gchar *servername = NULL;
  85. // last fm
  86. aud_cfg_db_get_string(db, "audioscrobbler", "username",
  87. &username);
  88. @@ -242,6 +258,13 @@ create_cfgdlg(void)
  89. g_free(username);
  90. username = NULL;
  91. }
  92. + aud_cfg_db_get_string(db, "audioscrobbler", "server",
  93. + &servername);
  94. + if (servername) {
  95. + gtk_entry_set_text(GTK_ENTRY(entry3), servername);
  96. + g_free(servername);
  97. + servername = NULL;
  98. + }
  99. // gerpok
  100. aud_cfg_db_get_string(db, "audioscrobbler", "ge_username",
  101. &username);
  102. diff --exclude=.deps -rupN audacious-plugins-1.5.1.orig/src/scrobbler/plugin.c audacious-plugins-1.5.1/src/scrobbler/plugin.c
  103. --- audacious-plugins-1.5.1.orig/src/scrobbler/plugin.c 2008-05-23 18:44:20.000000000 -0400
  104. +++ audacious-plugins-1.5.1/src/scrobbler/plugin.c 2009-04-09 10:42:13.000000000 -0400
  105. @@ -97,7 +97,7 @@ static void aud_hook_playback_end(gpoint
  106. }
  107. void start(void) {
  108. - char *username = NULL, *password = NULL;
  109. + char *username = NULL, *password = NULL, *server = NULL;
  110. char *ge_username = NULL, *ge_password = NULL;
  111. mcs_handle_t *cfgfile;
  112. sc_going = 1;
  113. @@ -109,6 +109,8 @@ void start(void) {
  114. &username);
  115. aud_cfg_db_get_string(cfgfile, "audioscrobbler", "password",
  116. &password);
  117. + aud_cfg_db_get_string(cfgfile, "audioscrobbler", "server",
  118. + &server);
  119. aud_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_username",
  120. &ge_username);
  121. aud_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_password",
  122. @@ -116,7 +118,7 @@ void start(void) {
  123. aud_cfg_db_close(cfgfile);
  124. }
  125. - if ((!username || !password) || (!*username || !*password))
  126. + if ((!username || !password || !server) || (!*username || !*password || !*server))
  127. {
  128. pdebug("username/password not found - not starting last.fm support",
  129. DEBUG);
  130. @@ -124,10 +126,10 @@ void start(void) {
  131. }
  132. else
  133. {
  134. - sc_init(username, password);
  135. -
  136. + sc_init(username, password, server);
  137. g_free(username);
  138. g_free(password);
  139. + g_free(server);
  140. }
  141. if ((!ge_username || !ge_password) || (!*ge_username || !*ge_password))
  142. diff --exclude=.deps -rupN audacious-plugins-1.5.1.orig/src/scrobbler/scrobbler.c audacious-plugins-1.5.1/src/scrobbler/scrobbler.c
  143. --- audacious-plugins-1.5.1.orig/src/scrobbler/scrobbler.c 2008-05-23 18:44:20.000000000 -0400
  144. +++ audacious-plugins-1.5.1/src/scrobbler/scrobbler.c 2009-04-09 10:54:23.000000000 -0400
  145. @@ -14,9 +14,8 @@
  146. #include <audacious/plugin.h>
  147. -#define SCROBBLER_HS_URL "http://post.audioscrobbler.com"
  148. #define SCROBBLER_CLI_ID "aud"
  149. #define SCROBBLER_HS_WAIT 1800
  150. #define SCROBBLER_SB_WAIT 10
  151. #define SCROBBLER_VERSION "1.2"
  152. #define SCROBBLER_IMPLEMENTATION "0.2" /* This is the implementation, not the player version. */
  153. @@ -41,6 +40,7 @@ static char *sc_submit_url, /* queue
  154. *sc_session_id,
  155. *sc_username = NULL,
  156. *sc_password = NULL,
  157. + *sc_server = NULL,
  158. *sc_challenge_hash,
  159. sc_response_hash[65535],
  160. *sc_srv_res,
  161. @@ -482,8 +482,8 @@ static int sc_handshake(void)
  162. hexify(auth, strlen(auth));
  163. auth_tmp = g_strdup(sc_response_hash);
  164. - g_snprintf(buf, sizeof(buf), "%s/?hs=true&p=%s&c=%s&v=%s&u=%s&t=%ld&a=%s",
  165. - SCROBBLER_HS_URL, SCROBBLER_VERSION,
  166. + g_snprintf(buf, sizeof(buf), "http://%s/?hs=true&p=%s&c=%s&v=%s&u=%s&t=%ld&a=%s",
  167. + sc_server, SCROBBLER_VERSION,
  168. SCROBBLER_CLI_ID, SCROBBLER_IMPLEMENTATION, sc_username, time(NULL),
  169. auth_tmp);
  170. g_free(auth_tmp);
  171. @@ -1060,7 +1060,7 @@ static void sc_checkhandshake(void)
  172. /* Called at session startup*/
  173. -void sc_init(char *uname, char *pwd)
  174. +void sc_init(char *uname, char *pwd, char *svr)
  175. {
  176. sc_hs_status = sc_hs_timeout = sc_hs_errors = sc_submit_timeout =
  177. sc_srv_res_size = sc_giveup = sc_major_error_present =
  178. @@ -1071,6 +1071,7 @@ void sc_init(char *uname, char *pwd)
  179. sc_challenge_hash = sc_major_error = NULL;
  180. sc_username = strdup(uname);
  181. sc_password = strdup(pwd);
  182. + sc_server = strdup(svr);
  183. read_cache();
  184. pdebug("scrobbler starting up", DEBUG);
  185. }
  186. diff --exclude=.deps -rupN audacious-plugins-1.5.1.orig/src/scrobbler/scrobbler.h audacious-plugins-1.5.1/src/scrobbler/scrobbler.h
  187. --- audacious-plugins-1.5.1.orig/src/scrobbler/scrobbler.h 2008-05-23 18:44:20.000000000 -0400
  188. +++ audacious-plugins-1.5.1/src/scrobbler/scrobbler.h 2009-04-09 10:43:46.000000000 -0400
  189. @@ -8,7 +8,7 @@
  190. gboolean sc_timeout(gpointer data);
  191. int sc_idle(GMutex *);
  192. -void sc_init(char *, char *);
  193. +void sc_init(char *, char *, char *);
  194. void sc_addentry(GMutex *, Tuple *, int);
  195. void sc_cleaner(void);
  196. int sc_catch_error(void);