diff options
author | Max Kellermann <max@duempel.org> | 2008-09-16 19:11:40 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-16 19:11:40 +0200 |
commit | f41b9942af7278ab67dc799ad6c17ad74dc0aa1b (patch) | |
tree | 69c7c715ff3abd78bb26a7a4d80dd1da5fd5c08b /lyrics/lyricswiki.rb | |
parent | 4d01c183b4c1e4c51dff3d9aeec1c01ce13a4323 (diff) | |
download | mpd-f41b9942af7278ab67dc799ad6c17ad74dc0aa1b.tar.gz mpd-f41b9942af7278ab67dc799ad6c17ad74dc0aa1b.tar.xz mpd-f41b9942af7278ab67dc799ad6c17ad74dc0aa1b.zip |
lyrics: converted in-process plugins to external programs
In-process plugins are very problematic. It is much easier and
flexible to move the lyrics plugins to external programs, with a
trivial protocol. This is work in progress, among the things missing:
- protocol specification, including exit codes
- plugin installation
- plugin search directory
- run-time configuration (currently hard coded)
- automatic polling (using glib's main loop?)
- better and more robust error handling
Diffstat (limited to 'lyrics/lyricswiki.rb')
-rwxr-xr-x | lyrics/lyricswiki.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lyrics/lyricswiki.rb b/lyrics/lyricswiki.rb new file mode 100755 index 000000000..39aa4a5b7 --- /dev/null +++ b/lyrics/lyricswiki.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# Load lyrics from lyricswiki.org +# +# Author: Max Kellermann <max@duempel.org> +# + +require 'uri' +require 'net/http' + +url = "http://lyricwiki.org/api.php" + \ + "?artist=#{URI.escape(ARGV[0])}&song=#{URI.escape(ARGV[1])}" +response = Net::HTTP.get(URI.parse(url)) + +exit(2) unless response =~ /<pre>\s*(.*?)\s*<\/pre>/im +puts $1 |