]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Ensure PyEPG does not appear in basic list unless its installed.
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 14 Sep 2012 11:02:04 +0000 (12:02 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Fri, 14 Sep 2012 11:02:39 +0000 (12:02 +0100)
src/epggrab/module/pyepg.c
src/spawn.c
src/spawn.h

index a9ccd0ee25c381e91d2b36f1d41ee04518f0f498..0eda3adef1f14c8af9449f676c151a445d8b7b33 100644 (file)
@@ -419,10 +419,12 @@ static int _pyepg_parse
 
 void pyepg_init ( void )
 {
+  char buf[256];
+
   /* Internal module */
-  epggrab_module_int_create(NULL, "/usr/bin/pyepg", "PyEPG", 4,
-                            "/usr/bin/pyepg",
-                            NULL, _pyepg_parse, NULL, NULL);
+  if (find_exec("pyepg", buf, sizeof(buf)-1))
+    epggrab_module_int_create(NULL, "pyepg-internal", "PyEPG", 4, buf,
+                              NULL, _pyepg_parse, NULL, NULL);
 
   /* External module */
   _pyepg_module = (epggrab_module_t*)
index c7ffbe51f282138ea0119ac78d9ec10f37e33181..1ae7489159128c09ae264d4d85aed7ef2ae4d4b7 100644 (file)
@@ -48,8 +48,8 @@ typedef struct spawn {
 /*
  * Search PATH for executable
  */
-static int
-_find_exec ( const char *name, char *out, size_t len )
+int
+find_exec ( const char *name, char *out, size_t len )
 {
   int ret = 0;
   char bin[512];
@@ -161,7 +161,7 @@ spawn_and_store_stdout(const char *prog, char *argv[], char **outp)
   const char *local_argv[2] = { NULL, NULL };
 
   if (*prog != '/' && *prog != '.') {
-    if (!_find_exec(prog, bin, sizeof(bin))) return -1;
+    if (!find_exec(prog, bin, sizeof(bin))) return -1;
     prog = bin;
   }
 
@@ -233,7 +233,7 @@ spawnv(const char *prog, char *argv[])
   const char *local_argv[2] = { NULL, NULL };
 
   if (*prog != '/' && *prog != '.') {
-    if (!_find_exec(prog, bin, sizeof(bin))) return -1;
+    if (!find_exec(prog, bin, sizeof(bin))) return -1;
     prog = bin;
   }
 
index 606a375b2f49e68c23ecc08b31c7fce9c9e0b3b7..5f89426b6ed6513de1d343ad82f95961cedbcc41 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef SPAWN_H
 #define SPAWN_H
 
+int find_exec ( const char *name, char *out, size_t len );
+
 int spawn_and_store_stdout(const char *prog, char *argv[], char **outp);
 
 int spawnv(const char *prog, char *argv[]);