aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am6
-rw-r--r--plugins/hd/Makefile.am40
-rw-r--r--plugins/hd/lyrics_hd.c52
-rw-r--r--plugins/leoslyrics/Makefile.am43
-rw-r--r--plugins/leoslyrics/easy_download.c89
-rw-r--r--plugins/leoslyrics/easy_download.h31
-rw-r--r--plugins/leoslyrics/lyrics_leoslyrics.c162
7 files changed, 0 insertions, 423 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
deleted file mode 100644
index 9bb784fa3..000000000
--- a/plugins/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-SUBDIRS = \
- ${src_lyr_plugins}
-
-AUTOMAKE_OPTIONS = foreign 1.6
-
-
diff --git a/plugins/hd/Makefile.am b/plugins/hd/Makefile.am
deleted file mode 100644
index f4d4608d8..000000000
--- a/plugins/hd/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-AM_CPPFLAGS =\
- $(GLIB_CFLAGS)\
- $(GTHREAD_CFLAGS)\
- $(libcurl_CFLAGS)\
- -I../../src
-
-###----
-
-plugin_headers =\
- ../src_lyrics.h\
- ../screen_lyrics.h\
- ../easy_download.h\
- ../options.h
-
-###-----
-
-ncmpc_modulesdir = @plugindir@
-
-ncmpc_modules_LTLIBRARIES = libhd.la
-
-### libhd
-
-libhd_la_LIBADD =\
- $(GLIB_LIBS)\
- $(libcurl_LIBS)
-
-libhd_la_headers =\
- $(plugins_headers)
-
-libhd_la_SOURCES =\
- lyrics_hd.c\
- $(libhd_la_headers)
-install:
- @$(MAKE)
- mkdir -p ${ncmpc_modulesdir}
- if test -f .libs/libhd.so; then cp .libs/libhd.so ${ncmpc_modulesdir}/lyrics_hd.so; fi
-
-uninstall:
- @$(MAKE)
- rm -f ${ncmpc_modulesdir}/lyrics_hd.so
diff --git a/plugins/hd/lyrics_hd.c b/plugins/hd/lyrics_hd.c
deleted file mode 100644
index 7a3a8b745..000000000
--- a/plugins/hd/lyrics_hd.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "src_lyrics.h"
-
-char *check_lyr_hd(char *artist, char *title, int how)
-{ //checking whether for lyrics file existence and proper access
- result |= 2;
- static char path[1024];
- snprintf(path, 1024, "%s/.lyrics/%s/%s.lyric",
- getenv("HOME"), artist, title);
-
- if(g_access(path, how) != 0) return NULL;
- return path;
-}
-
-
-int get_lyr_hd(char *artist, char *title)
-{
- char *path = check_lyr_hd(artist, title, R_OK);
- if(path == NULL) return -1;
-
- FILE *lyr_file;
- lyr_file = fopen(path, "r");
- if(lyr_file == NULL) return -1;
- result |= 4;
- char *buf = NULL;
- char **line = &buf;
- size_t n = 0;
-
- while(1)
- {
- n = getline(line, &n, lyr_file);
- if( n < 1 || *line == NULL || feof(lyr_file) != 0 ) return 0;
- add_text_line(&lyr_text, *line, n);
- free(*line);
- *line = NULL; n = 0;
- }
-
- return 0;
-}
-
-int register_me (src_lyr *source_descriptor)
-{
- source_descriptor->check_lyr = check_lyr_hd;
- source_descriptor->get_lyr = get_lyr_hd;
-
- source_descriptor->name = "Harddisk";
- source_descriptor->description = "";
-}
diff --git a/plugins/leoslyrics/Makefile.am b/plugins/leoslyrics/Makefile.am
deleted file mode 100644
index 4eb76f3ee..000000000
--- a/plugins/leoslyrics/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-AM_CPPFLAGS =\
- $(GLIB_CFLAGS)\
- $(GTHREAD_CFLAGS)\
- $(libcurl_CFLAGS)\
- -I../../src
-
-###----
-
-plugin_headers =\
- ../src_lyrics.h\
- ../screen_lyrics.h\
- ../easy_download.h\
- ../options.h
-
-###-----
-
-ncmpc_modulesdir = @plugindir@
-
-ncmpc_modules_LTLIBRARIES = libleoslyrics.la
-
-### libleoslyrics
-
-libleoslyrics_la_LIBADD =\
- $(GLIB_LIBS)\
- $(libcurl_LIBS)
-
-libleoslyrics_la_headers =\
- easy_download.h\
- $(plugins_headers)
-
-libleoslyrics_la_SOURCES =\
- easy_download.c\
- lyrics_leoslyrics.c\
- $(libleoslyrics_la_headers)
-
-install:
- @$(MAKE)
- mkdir -p ${DESTDIR}${libdir}
- if test -f .libs/libleoslyrics.so; then cp .libs/libleoslyrics.so ${ncmpc_modulesdir}/lyrics_leoslyrics.so; fi
-
-uninstall:
- @$(MAKE)
- rm -f ${ncmpc_modulesdir}/lyrics_leoslyrics.so
diff --git a/plugins/leoslyrics/easy_download.c b/plugins/leoslyrics/easy_download.c
deleted file mode 100644
index 83616cf87..000000000
--- a/plugins/leoslyrics/easy_download.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* by Qball
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#include "ncmpc.h"
-
-#ifdef ENABLE_LYRICS_SCREEN
-
-#include <curl/curl.h>
-#include "easy_download.h"
-
-static size_t write_data(void *buffer, size_t size,
- size_t nmemb, easy_download_struct *dld)
-{
- if(dld->data == NULL)
- {
- dld->size = 0;
- }
- dld->data = g_realloc(dld->data,(gulong)(size*nmemb+dld->size));
-
- memset(&(dld->data)[dld->size], '\0', (size*nmemb));
- memcpy(&(dld->data)[dld->size], buffer, size*nmemb);
-
- dld->size += size*nmemb;
- if(dld->size >= dld->max_size && dld->max_size > 0)
- {
- return 0;
- }
- return size*nmemb;
-}
-
-int easy_download(char *url,easy_download_struct *dld,
- curl_progress_callback cb)
-{
- CURL *curl = NULL;
- int res;
- if(!dld) return 0;
- easy_download_clean(dld);
- /* initialize curl */
- curl = curl_easy_init();
- if(!curl) return 0;
- /* set uri */
- curl_easy_setopt(curl, CURLOPT_URL, url);
- /* set callback data */
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, dld);
- /* set callback function */
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
- curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, cb);
- /* run */
- res = curl_easy_perform(curl);
- /* cleanup */
- curl_easy_cleanup(curl);
- if(!res)
- {
- return 1;
- }
- if(dld->data) g_free(dld->data);
- return 0;
-}
-
-void easy_download_clean(easy_download_struct *dld)
-{
- if(dld->data)g_free(dld->data);
- dld->data = NULL;
- dld->size = 0;
- dld->max_size = -1;
-}
-
-#endif
diff --git a/plugins/leoslyrics/easy_download.h b/plugins/leoslyrics/easy_download.h
deleted file mode 100644
index 92dc22e9e..000000000
--- a/plugins/leoslyrics/easy_download.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * by Qball
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <curl/curl.h>
-
-typedef struct _easy_download_struct{
- char *data;
- int size;
- int max_size;
-
-}easy_download_struct;
-
-
-int easy_download(char *url,easy_download_struct *dld,
- curl_progress_callback cb);
-void easy_download_clean(easy_download_struct *dld);
diff --git a/plugins/leoslyrics/lyrics_leoslyrics.c b/plugins/leoslyrics/lyrics_leoslyrics.c
deleted file mode 100644
index 5bcb32242..000000000
--- a/plugins/leoslyrics/lyrics_leoslyrics.c
+++ /dev/null
@@ -1,162 +0,0 @@
-#include "src_lyrics.h"
-#include "easy_download.h"
-#include <expat.h>
-#include <string.h>
-#include "options.h"
-
-#define LEOSLYRICS_SEARCH_URL "http://api.leoslyrics.com/api_search.php?auth=ncmpc&artist=%s&songtitle=%s"
-#define LEOSLYRICS_CONTENT_URL "http://api.leoslyrics.com/api_lyrics.php?auth=ncmpc&hid=%s"
-#define CREDITS "Lyrics provided by www.LeosLyrics.com"
-
-char *hid;
-XML_Parser parser, contentp;
-
-int check_dl_progress(void *clientp, double dltotal, double dlnow,
- double ultotal, double ulnow)
-{
- if(g_timer_elapsed(dltime, NULL) >= options.lyrics_timeout || lock == 4)
- {
- formed_text_init(&lyr_text);
- return -1;
- }
-
- return 0;
-}
-
-
-
-static void check_content(void *data, const char *name, const char **atts)
-{
- if(strstr(name, "text") != NULL)
- {
-
- result |= 16;
- }
-}
-
-
-static void check_search_response(void *data, const char *name,
- const char **atts)
-{
- if(strstr(name, "response") != NULL)
- {
- result |=2;
- return;
- }
-
- if(result & 4)
- {
- if(strstr(name, "result") != NULL)
- {
- if(strstr(atts[2], "hid") != NULL)
- {
- hid = strdup (atts[3]);
- }
-
- if(strstr(atts[2], "exactMatch") != NULL)
- {
- result |= 8;
- }
- }
- }
-
-}
-
-static void end_tag(void *data, const char *name)
-{
- //hmmmmmm
-}
-
- static void check_search_success(void *userData, const XML_Char *s, int len)
- {
- if(result & 2) //lets first check whether we're right
- { //we don't really want to search in the wrong string
- if(strstr((char*) s, "SUCCESS"))
- {
- result |=4;
- }
- }
- }
-
-static void fetch_text(void *userData, const XML_Char *s, int len)
-{
- if(result & 16)
- {
- if (s[0] == 13 ) return; //ignore any single carriage returns
- add_text_line(&lyr_text, s, len);
- }
-}
-
-/*int deregister_lyr_leoslyrics ()
-{
-
-}*/
-
-int check_lyr_leoslyrics(char *artist, char *title, char *url)
-{
- char url_avail[256];
-
- //this replacess the whitespaces with '+'
- g_strdelimit(artist, " ", '+');
- g_strdelimit(title, " ", '+');
-
- //we insert the artist and the title into the url
- snprintf(url_avail, 512, LEOSLYRICS_SEARCH_URL, artist, title);
-
- //download that xml!
- easy_download_struct lyr_avail = {NULL, 0,-1};
-
- g_timer_start(dltime);
- if(!easy_download(url_avail, &lyr_avail, check_dl_progress)) return -1;
- g_timer_stop(dltime);
-
- //we gotta parse that stuff with expat
- parser = XML_ParserCreate(NULL);
- XML_SetUserData(parser, NULL);
-
- XML_SetElementHandler(parser, check_search_response, end_tag);
- XML_SetCharacterDataHandler(parser, check_search_success);
- XML_Parse(parser, lyr_avail.data, strlen(lyr_avail.data), 0);
- XML_ParserFree(parser);
-
- if(!(result & 4)) return -1; //check whether lyrics found
-
- CURL *curl = curl_easy_init ();
- char *esc_hid = curl_easy_escape (curl, hid, 0);
- free (hid);
-
- snprintf(url, 512, LEOSLYRICS_CONTENT_URL, hid);
-
- return 0;
-}
-
-int get_lyr_leoslyrics(char *artist, char *title)
-{
- char url_hid[256];
- if(dltime == NULL) dltime = g_timer_new();
-
- if(check_lyr_leoslyrics(artist, title, url_hid) != 0) return -1;
-
- easy_download_struct lyr_content = {NULL, 0,-1};
- g_timer_continue(dltime);
- if(!(easy_download(url_hid, &lyr_content, check_dl_progress))) return -1;
- g_timer_stop(dltime);
-
- contentp = XML_ParserCreate(NULL);
- XML_SetUserData(contentp, NULL);
- XML_SetElementHandler(contentp, check_content, end_tag);
- XML_SetCharacterDataHandler(contentp, fetch_text);
- XML_Parse(contentp, lyr_content.data, strlen(lyr_content.data), 0);
- XML_ParserFree(contentp);
-
- return 0;
-
-}
-int register_me (src_lyr *source_descriptor)
-{
- source_descriptor->check_lyr = check_lyr_leoslyrics;
- source_descriptor->get_lyr = get_lyr_leoslyrics;
-
- source_descriptor->name = "Leoslyrics";
- source_descriptor->description = "powered by http://www.leoslyrics.com";
-}