Skip to content

Commit

Permalink
Don't allow both scrobblers to be loaded simultaneously.
Browse files Browse the repository at this point in the history
This starts issue #7.
  • Loading branch information
Pitxyoki committed Feb 3, 2013
1 parent 1f2d766 commit ac33873
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/scrobbler/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <audacious/misc.h>
#include <audacious/playlist.h>
#include <audacious/plugin.h>
#include <audacious/plugins.h>
#include <libaudcore/audstrings.h>
#include <libaudcore/hook.h>
#include <libaudgui/libaudgui.h>
Expand Down Expand Up @@ -137,6 +138,14 @@ void stop(void) {

static gboolean init(void)
{
PluginHandle *new_scrobbler = aud_plugin_lookup_basename("scrobbler2");
if (new_scrobbler != NULL && aud_plugin_get_enabled(new_scrobbler)) {
aud_interface_show_error(N_("This is an old, legacy version of the Scrobbler plugin.\n"
"To use it, disable the Scrobbler 2.0 plugin."));
return FALSE;
}


start();
return TRUE;
}
Expand Down
11 changes: 11 additions & 0 deletions src/scrobbler2/scrobbler.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
* It is licensed under the GNU General Public License, version 3.
*/

//TODO: this is to be removed when the old scrobbler is deprecated
#include <audacious/plugins.h>

//audacious includes
#include <config.h>
#include <audacious/plugin.h>
#include <audacious/drct.h>
#include <audacious/playlist.h>
#include <libaudcore/hook.h>


//plugin includes
#include "scrobbler.h"

Expand Down Expand Up @@ -209,7 +213,14 @@ static void unpaused (void *hook_data, void *user_data) {
play_started_at = g_get_monotonic_time();
}



static bool_t scrobbler_init (void) {
PluginHandle *old_scrobbler = aud_plugin_lookup_basename("scrobbler");
if (old_scrobbler != NULL && aud_plugin_get_enabled(old_scrobbler)) {
aud_plugin_enable(old_scrobbler, FALSE);
}

// Initialize libXML and check potential ABI mismatches between
// the version it was compiled for and the actual libXML in use
LIBXML_TEST_VERSION
Expand Down

0 comments on commit ac33873

Please sign in to comment.