From 42a32586a4f300515fc261499b07e09bba9e5ca6 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 31 Mar 2021 04:41:32 +0100 Subject: unused scripts removed --- lib/media/leoslyrics.py | 84 ------------------------------------------------- lib/media/lyricwiki.rb | 52 ------------------------------ 2 files changed, 136 deletions(-) delete mode 100755 lib/media/leoslyrics.py delete mode 100755 lib/media/lyricwiki.rb (limited to 'lib/media') diff --git a/lib/media/leoslyrics.py b/lib/media/leoslyrics.py deleted file mode 100755 index 5e4f8c8..0000000 --- a/lib/media/leoslyrics.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/python -# -# (c) 2004-2008 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# 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 -# - -# -# Load lyrics from leoslyrics.com -# - -from sys import argv, exit -from urllib import urlencode, urlopen -from xml.sax import make_parser, SAXException -from xml.sax.handler import ContentHandler - -class SearchContentHandler(ContentHandler): - def __init__(self): - self.code = None - self.hid = None - - def startElement(self, name, attrs): - if name == 'response': - self.code = int(attrs['code']) - elif name == 'result': - if self.hid is None or attrs['exactMatch'] == 'true': - self.hid = attrs['hid'] - -def search(artist, title): - query = urlencode({'auth': 'ncmpc', - 'artist': artist, - 'songtitle': title}) - url = "http://api.leoslyrics.com/api_search.php?" + query - f = urlopen(url) - handler = SearchContentHandler() - parser = make_parser() - parser.setContentHandler(handler) - parser.parse(f) - return handler.hid - -class LyricsContentHandler(ContentHandler): - def __init__(self): - self.code = None - self.is_text = False - self.text = None - - def startElement(self, name, attrs): - if name == 'text': - self.text = '' - self.is_text = True - else: - self.is_text = False - - def characters(self, chars): - if self.is_text: - self.text += chars - -def lyrics(hid): - query = urlencode({'auth': 'ncmpc', - 'hid': hid}) - url = "http://api.leoslyrics.com/api_lyrics.php?" + query - f = urlopen(url) - handler = LyricsContentHandler() - parser = make_parser() - parser.setContentHandler(handler) - parser.parse(f) - return handler.text - -hid = search(argv[1], argv[2]) -if hid is None: - exit(2) -print lyrics(hid).encode('utf-8') diff --git a/lib/media/lyricwiki.rb b/lib/media/lyricwiki.rb deleted file mode 100755 index f163fa4..0000000 --- a/lib/media/lyricwiki.rb +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env ruby -# -# (c) 2004-2008 The Music Player Daemon Project -# http://www.musicpd.org/ -# -# 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 -# - -# -# Load lyrics from lyrics.wikia.com, formerly lyricwiki.org -# - -require 'uri' -require 'net/http' -require 'cgi' - -url = "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong" + \ - "&artist=#{URI.escape(ARGV[0])}&song=#{URI.escape(ARGV[1])}" -response = Net::HTTP.get(URI.parse(url)) - -if not response =~ /\s*(.*?)\s*<\/url>/im - $stderr.puts "No URL in response!" - exit(1) -end - -url = $1 -exit(69) if url =~ /action=edit$/ - -response = Net::HTTP.get(URI.parse(url)) -if not response =~ /
\s*(.*?)\s*