[ontv] Replace system call to tv_find_grabbers with python code
- From: Olof Kindgren <olki src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ontv] Replace system call to tv_find_grabbers with python code
- Date: Mon, 1 Nov 2010 16:13:09 +0000 (UTC)
commit 164a6a4bd2b419364699d5643c459f244f3a11ce
Author: Olof Kindgren <olki src gnome org>
Date: Mon Nov 1 17:10:12 2010 +0100
Replace system call to tv_find_grabbers with python code
tv_find_grabbers is a simple perl script. It's simpler to implement
a light version directly in python instead of parsing its output.
ontv/assistant.py | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/ontv/assistant.py b/ontv/assistant.py
index 33fcab6..8c8a519 100644
--- a/ontv/assistant.py
+++ b/ontv/assistant.py
@@ -105,17 +105,18 @@ class XMLTVAssistant(gtk.Assistant):
self.__country_combobox_changed, page)
# Add grabbers which are in path
- cmd = "tv_find_grabbers"
-
self.grabbers = {}
- if utils.is_in_path(cmd):
- output = subprocess.Popen([cmd], stdout=subprocess.PIPE).communicate()[0]
-
- for line in output.split('\n'):
- parts = line.split('|')
- if(len(parts)==2):
- self.grabbers[parts[1]] = parts[0].split('/')[-1]
+ for dir in os.environ["PATH"].split(':'):
+ if os.access(dir, os.F_OK):
+ files = os.listdir(dir)
+ for file in files:
+ if file[0:8] =="tv_grab_":
+ cmd = os.path.join(dir,file)
+ output = subprocess.Popen([cmd,"--capabilities"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
+ if "baseline" in output:
+ output = subprocess.Popen([cmd,"--description"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].strip()
+ self.grabbers[output] = file
for country in self.grabbers.keys():
self.country_combobox.append_text(country)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]