summaryrefslogtreecommitdiffhomepage
path: root/lib/media
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-03-31 04:41:32 +0100
committerjao <jao@gnu.org>2021-03-31 04:41:32 +0100
commit42a32586a4f300515fc261499b07e09bba9e5ca6 (patch)
tree2fba1f5dc9a7fd5154d70ac9ca200d76a9e3ad97 /lib/media
parent7fda011fdbaf0d210da820c9c8256f20c82dfab8 (diff)
downloadelibs-42a32586a4f300515fc261499b07e09bba9e5ca6.tar.gz
elibs-42a32586a4f300515fc261499b07e09bba9e5ca6.tar.bz2
unused scripts removed
Diffstat (limited to 'lib/media')
-rwxr-xr-xlib/media/leoslyrics.py84
-rwxr-xr-xlib/media/lyricwiki.rb52
2 files changed, 0 insertions, 136 deletions
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 =~ /<url>\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 =~ /<div class='lyricbox'>\s*(.*?)\s*<!--/im
- $stderr.puts "No <div class='lyricbox'> in lyrics page!\n"
- exit(1)
-end
-
-# if not $1 =~ /^.*<\/div>(.*?)$/im
-if not $1 =~ /^.*<\/script>(.*?)$/im
- $stderr.puts "Couldn't remove leading XML tags in lyricbox!\n"
- exit(1)
-end
-
-puts CGI::unescapeHTML($1.gsub(/<br \/>/, "\n"))