Logo Search packages:      
Sourcecode: vdr-plugin-live version File versions  Download package

vdrlive::RecordingsTree::RecordingsTree ( RecordingsManagerPtr  recMan  )  [private]

Implementation of class RecordingsTree:

Definition at line 233 of file recman.cpp.

                                                                :
            m_maxLevel(0),
            m_root(new RecordingsItemDir("", 0, RecordingsItemPtr()))
      {
            // esyslog("DH: ****** RecordingsTree::RecordingsTree() ********");
            for (cRecording* recording = Recordings.First(); recording != 0; recording = Recordings.Next(recording)) {
                  if (m_maxLevel < recording->HierarchyLevels()) {
                        m_maxLevel = recording->HierarchyLevels();
                  }

                  RecordingsItemPtr dir = m_root;
                  string name(recording->Name());

                  // esyslog("DH: recName = '%s'", recording->Name());
                  int level = 0;
                  size_t index = 0;
                  size_t pos = 0;
                  do {
                        pos = name.find('~', index);
                        if (pos != string::npos) {
                              string dirName(name.substr(index, pos - index));
                              index = pos + 1;
                              RecordingsMap::iterator i = findDir(dir, dirName);
                              if (i == dir->m_entries.end()) {
                                    RecordingsItemPtr recPtr (new RecordingsItemDir(dirName, level, dir));
                                    dir->m_entries.insert(pair< string, RecordingsItemPtr > (dirName, recPtr));
                                    i = findDir(dir, dirName);
                                    if (i != dir->m_entries.end()) {
                                          // esyslog("DH: added dir: '%s'", dirName.c_str());
                                    }
                                    else {
                                          // esyslog("DH: panic: didn't found inserted dir: '%s'", dirName.c_str());
                                    }
                              }
                              dir = i->second;
                              // esyslog("DH: current dir: '%s'", dir->Name().c_str());
                              level++;
                        }
                        else {
                              string recName(name.substr(index, name.length() - index));
                              RecordingsItemPtr recPtr (new RecordingsItemRec(recMan->Md5Hash(recording), recName, recording, dir));
                              dir->m_entries.insert(pair< string, RecordingsItemPtr > (recName, recPtr));
                              // esyslog("DH: added rec: '%s'", recName.c_str());
                        }
                  } while (pos != string::npos);
            }
            // esyslog("DH: ------ RecordingsTree::RecordingsTree() --------");
      }


Generated by  Doxygen 1.6.0   Back to index