From f41b9942af7278ab67dc799ad6c17ad74dc0aa1b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 16 Sep 2008 19:11:40 +0200 Subject: 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 --- lyrics/hd.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 lyrics/hd.py (limited to 'lyrics/hd.py') diff --git a/lyrics/hd.py b/lyrics/hd.py new file mode 100755 index 000000000..173342c98 --- /dev/null +++ b/lyrics/hd.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +# +# Load lyrics from the user's home directory +# +# Author: Max Kellermann +# + +from sys import argv, exit, stdout +from os import environ +from os.path import expanduser + +path = expanduser("~/.lyrics/%s - %s.txt" % (argv[1], argv[2])) +try: + f = file(path) +except IOError: + exit(2) + +while True: + x = f.read(4096) + if not x: + break + stdout.write(x) -- cgit v1.2.3