Allow user defined cable.xml and terrestrial.xml under /etc/enigma2 just like we...
authorAthanasios Oikonomou <athoik@gmail.com>
Tue, 28 Jul 2015 05:07:35 +0000 (08:07 +0300)
committerAthanasios Oikonomou <athoik@gmail.com>
Tue, 28 Jul 2015 05:07:35 +0000 (08:07 +0300)
lib/dvb/db.cpp

index bbc2fbe..ae50031 100644 (file)
@@ -1072,7 +1072,7 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje
        Element *root = tree.getRoot();
        if (!root)
        {
-               eDebug("[eDVBDB] couldn't open /etc/tuxbox/satellites.xml!!");
+               eDebug("[eDVBDB] couldn't open %s!!", satellitesFilename);
                Py_INCREF(Py_False);
                return Py_False;
        }
@@ -1221,12 +1221,17 @@ PyObject *eDVBDB::readCables(ePyObject cab_list, ePyObject tp_dict)
                return NULL;
        }
        XMLTree tree;
-       tree.setFilename("/etc/tuxbox/cables.xml");
+       const char* cablesFilename = "/etc/enigma2/cables.xml";
+       if (::access(cablesFilename, R_OK) < 0)
+       {
+               cablesFilename = "/etc/tuxbox/cables.xml";
+       }
+       tree.setFilename(cablesFilename);
        tree.read();
        Element *root = tree.getRoot();
        if (!root)
        {
-               eDebug("[eDVBDB] couldn't open /etc/tuxbox/cables.xml!!");
+               eDebug("[eDVBDB] couldn't open %s!!", cablesFilename);
                Py_INCREF(Py_False);
                return Py_False;
        }
@@ -1341,12 +1346,17 @@ PyObject *eDVBDB::readTerrestrials(ePyObject ter_list, ePyObject tp_dict)
                return NULL;
        }
        XMLTree tree;
-       tree.setFilename("/etc/tuxbox/terrestrial.xml");
+       const char* terrestrialFilename = "/etc/enigma2/terrestrial.xml";
+       if (::access(terrestrialFilename, R_OK) < 0)
+       {
+               terrestrialFilename = "/etc/tuxbox/terrestrial.xml";
+       }
+       tree.setFilename(terrestrialFilename);
        tree.read();
        Element *root = tree.getRoot();
        if (!root)
        {
-               eDebug("[eDVBDB] couldn't open /etc/tuxbox/terrestrial.xml!!");
+               eDebug("[eDVBDB] couldn't open %s!!", terrestrialFilename);
                Py_INCREF(Py_False);
                return Py_False;
        }