add possibility to request tsid/onid for iDVBChannel
[enigma2.git] / lib / dvb / metaparser.cpp
index 7d671adfa0d893790ec5b64656c383322f3db97d..3e3f9a79143df6cde1b7b50f6e8af02168f35fcd 100644 (file)
@@ -5,6 +5,7 @@
 eDVBMetaParser::eDVBMetaParser()
 {
        m_time_create = 0;
+       m_data_ok = 0;
 }
 
 int eDVBMetaParser::parseFile(const std::string &basename)
@@ -55,12 +56,16 @@ int eDVBMetaParser::parseMeta(const std::string &tsname)
                case 3:
                        m_time_create = atoi(line);
                        break;
+               case 4:
+                       m_tags = line;
+                       break;
                default:
                        break;
                }
                ++linecnt;
        }
        fclose(f);
+       m_data_ok = 1;
        return 0;
 }
 
@@ -108,6 +113,8 @@ int eDVBMetaParser::parseRecordings(const std::string &filename)
                        m_name = description;
                        m_description = "";
                        m_time_create = 0;
+                       
+                       m_data_ok = 1;
                        fclose(f);
                        return 0;
                }
@@ -115,3 +122,17 @@ int eDVBMetaParser::parseRecordings(const std::string &filename)
        fclose(f);
        return -1;
 }
+
+int eDVBMetaParser::updateMeta(const std::string &tsname)
+{
+       if (!m_data_ok) 
+               return -1;
+       std::string filename = tsname + ".meta";
+
+       FILE *f = fopen(filename.c_str(), "w");
+       if (!f)
+               return -ENOENT;
+       fprintf(f, "%s\n%s\n%s\n%d\n%s\n", m_ref.toString().c_str(), m_name.c_str(), m_description.c_str(), m_time_create, m_tags.c_str());
+       fclose(f);
+       return 0;
+}