summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2010-03-05 12:07:54 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2010-03-06 10:55:52 +0100
commit80ed3d8e31b212c3a9d1e6edf41f1112e8029b59 (patch)
tree97b1e03d35493dd13ca209ee3686bec84eb26025 /src
parent3838e77238e383d6bea6496a7bc035702f320210 (diff)
downloadpianobar-80ed3d8e31b212c3a9d1e6edf41f1112e8029b59.tar.gz
pianobar-80ed3d8e31b212c3a9d1e6edf41f1112e8029b59.tar.bz2
pianobar-80ed3d8e31b212c3a9d1e6edf41f1112e8029b59.zip
wardrobe: Removed internal last.fm scrobbling library
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/main.c39
-rw-r--r--src/pianobar.114
-rw-r--r--src/settings.c20
-rw-r--r--src/settings.h4
5 files changed, 1 insertions, 79 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e1de583..1357510 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -59,7 +59,6 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
include_directories (
${pianobar_SOURCE_DIR}/libpiano/src
- ${pianobar_SOURCE_DIR}/libwardrobe/src
${pianobar_SOURCE_DIR}/libwaitress/src
${CMAKE_CURRENT_BINARY_DIR}
${FAAD_INCLUDE_DIRS} ${LIBAO_INCLUDE_DIRS}
@@ -67,7 +66,7 @@ include_directories (
add_executable (pianobar main.c terminal.c settings.c player.c ui.c ui_act.c
ui_readline.c)
-target_link_libraries (pianobar piano wardrobe waitress ${FAAD_LIBRARIES}
+target_link_libraries (pianobar piano waitress ${FAAD_LIBRARIES}
${LIBAO_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${MAD_LIBRARIES} ${LIBM})
install (TARGETS pianobar RUNTIME DESTINATION ${BIN_INSTALL_DIR})
diff --git a/src/main.c b/src/main.c
index d842179..b7f6235 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,10 +38,6 @@ THE SOFTWARE.
#include <fcntl.h>
/* tcset/getattr () */
#include <termios.h>
-
-/* last.fm scrobbling library */
-#include <wardrobe.h>
-
#include <pthread.h>
/* pandora.com library */
@@ -61,12 +57,10 @@ int main (int argc, char **argv) {
static struct audioPlayer player;
BarSettings_t settings;
pthread_t playerThread;
- WardrobeHandle_t wh;
/* playlist; first item is current song */
PianoSong_t *playlist = NULL;
PianoSong_t *songHistory = NULL;
PianoStation_t *curStation = NULL;
- WardrobeSong_t scrobbleSong;
char doQuit = 0;
/* FIXME: max path length? */
char ctlPath[1024];
@@ -88,7 +82,6 @@ int main (int argc, char **argv) {
/* init some things */
ao_initialize ();
PianoInit (&ph);
- WardrobeInit (&wh);
BarSettingsInit (&settings);
BarSettingsRead (&settings);
@@ -122,11 +115,6 @@ int main (int argc, char **argv) {
settings.password = strdup (passBuf);
}
- if (settings.enableScrobbling) {
- wh.user = strdup (settings.lastfmUser);
- wh.password = strdup (settings.lastfmPassword);
- }
-
/* setup control connection */
if (settings.controlProxy != NULL) {
char tmpPath[2];
@@ -171,24 +159,6 @@ int main (int argc, char **argv) {
while (!doQuit) {
/* song finished playing, clean up things/scrobble song */
if (player.mode == PLAYER_FINISHED_PLAYBACK) {
- scrobbleSong.length = player.songDuration / BAR_PLAYER_MS_TO_S_FACTOR;
- /* scrobble when >= nn% are played; use seconds, not
- * milliseconds */
- if (scrobbleSong.length > 0 && settings.enableScrobbling &&
- player.songPlayed / BAR_PLAYER_MS_TO_S_FACTOR * 100 /
- scrobbleSong.length >= settings.lastfmScrobblePercent) {
- WardrobeReturn_t wRet;
-
- BarUiMsg (MSG_INFO, "Scrobbling song... ");
- if ((wRet = WardrobeSubmit (&wh, &scrobbleSong)) ==
- WARDROBE_RET_OK) {
- BarUiMsg (MSG_NONE, "Ok.\n");
- } else {
- BarUiMsg (MSG_ERR, "Error: %s\n",
- WardrobeErrorToString (wRet));
- }
- }
- WardrobeSongDestroy (&scrobbleSong);
/* FIXME: pthread_join blocks everything if network connection
* is hung up e.g. */
void *threadRet;
@@ -263,14 +233,6 @@ int main (int argc, char **argv) {
if (playlist->audioUrl == NULL) {
BarUiMsg (MSG_ERR, "Invalid song url.\n");
} else {
- /* setup artist and song name for scrobbling (playlist
- * may be NULL later) */
- WardrobeSongInit (&scrobbleSong);
- scrobbleSong.artist = strdup (playlist->artist);
- scrobbleSong.title = strdup (playlist->title);
- scrobbleSong.album = strdup (playlist->album);
- scrobbleSong.started = time (NULL);
-
/* setup player */
memset (&player, 0, sizeof (player));
@@ -359,7 +321,6 @@ int main (int argc, char **argv) {
PianoDestroy (&ph);
PianoDestroyPlaylist (songHistory);
PianoDestroyPlaylist (playlist);
- WardrobeDestroy (&wh);
ao_shutdown();
BarSettingsDestroy (&settings);
diff --git a/src/pianobar.1 b/src/pianobar.1
index ffd6d1c..e7dbcfe 100644
--- a/src/pianobar.1
+++ b/src/pianobar.1
@@ -145,20 +145,6 @@ File that is executed when event occurs. See section
Keep a history of the last n songs (5, by default). You can rate these songs.
.TP
-.B lastfm_user = your_username
-If you want to send your played songs to last.fm set this to your last.fm
-username.
-
-.TP
-.B lastfm_password = plain_password
-A password is needed too if you want to scrobble your played song.
-
-.TP
-.B lastfm_scrobble_percent = 50-100
-When should a track be submitted to last.fm. Percent value. Don't append
-percent sign, do not set larger than 90 to ensure all songs are scrobbled.
-
-.TP
.B password = plaintext_password
Your pandora.com password. Plain-text.
diff --git a/src/settings.c b/src/settings.c
index 1136a3a..4ac2fea 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -74,8 +74,6 @@ void BarSettingsDestroy (BarSettings_t *settings) {
free (settings->controlProxy);
free (settings->username);
free (settings->password);
- free (settings->lastfmUser);
- free (settings->lastfmPassword);
free (settings->autostartStation);
free (settings->eventCmd);
memset (settings, 0, sizeof (*settings));
@@ -136,12 +134,6 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->username = strdup (val);
} else if (strcmp ("password", key) == 0) {
settings->password = strdup (val);
- } else if (strcmp ("lastfm_user", key) == 0) {
- settings->lastfmUser = strdup (val);
- } else if (strcmp ("lastfm_password", key) == 0) {
- settings->lastfmPassword = strdup (val);
- } else if (strcmp ("lastfm_scrobble_percent", key) == 0) {
- settings->lastfmScrobblePercent = atoi (val);
} else if (memcmp ("act_", key, 4) == 0) {
/* keyboard shortcuts */
for (i = 0; i < BAR_KS_COUNT; i++) {
@@ -167,17 +159,5 @@ void BarSettingsRead (BarSettings_t *settings) {
}
}
- /* some checks */
- /* last.fm requests tracks to be played at least 50% */
- if (settings->lastfmScrobblePercent < 50 ||
- settings->lastfmScrobblePercent > 100) {
- settings->lastfmScrobblePercent = 50;
- }
-
- /* only scrobble tracks if username and password are set */
- if (settings->lastfmUser != NULL && settings->lastfmPassword != NULL) {
- settings->enableScrobbling = 1;
- }
-
fclose (configfd);
}
diff --git a/src/settings.h b/src/settings.h
index 4ecc7b2..6185b93 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -66,10 +66,6 @@ typedef struct {
char *username;
char *password;
char *controlProxy; /* non-american listeners need this */
- char *lastfmUser;
- char *lastfmPassword;
- unsigned char lastfmScrobblePercent;
- char enableScrobbling;
char keys[BAR_KS_COUNT];
PianoAudioFormat_t audioFormat;
char *autostartStation;