Пример #1
0
std::list<std::string> cEpgsearchServiceHandler::SearchTimerList()
{
   std::list<std::string> list;
   cMutexLock SearchExtsLock(&SearchExts);
   for (int i = 0; i < SearchExts.Count(); i++)
   {
      cSearchExt* search = SearchExts.Get(i);
      if (search)
         list.push_back(search->ToText());
   }
   return list;
}
Пример #2
0
bool cEpgsearchServiceHandler::DelSearchTimer(int ID)
{
   cSearchExt *search = SearchExts.GetSearchFromID(ID);
   if (search)
   {
      LogFile.Log(1,"search '%s' deleted via service interface", search->search);
      cMutexLock SearchExtsLock(&SearchExts);
      SearchExts.Del(search);
      SearchExts.Save();
      RecsDone.RemoveSearchID(ID);
      return true;
   }
   else
      LogFile.Log(1,"error deleting search with id '%d' via service interface", ID);
   return false;
}
Пример #3
0
int cEpgsearchServiceHandler::AddSearchTimer(const std::string& settings)
{
   cSearchExt* search = new cSearchExt;
   if (search->Parse(settings.c_str()))
   {
      search->ID = SearchExts.GetNewID();
      LogFile.Log(1,"added search '%s' (%d) via service interface", search->search, search->ID);
      cMutexLock SearchExtsLock(&SearchExts);
      SearchExts.Add(search);
      SearchExts.Save();
      if (search->useAsSearchTimer && !EPGSearchConfig.useSearchTimers) // enable search timer thread if necessary
         cSearchTimerThread::Init((cPluginEpgsearch*) cPluginManager::GetPlugin("epgsearch"), true);
      return search->ID;
   }
   else
   {
      LogFile.Log(1,"error adding '%s' via service interface", search->search);
      delete search;
      return -1;
   }
}
Пример #4
0
void cMenuDirSelect::CreateDirSet(bool extraDirs)
{
    directorySet.clear();

    // add distinct directories from current recordings
    if (Recordings.Count() == 0)
	Recordings.Load();
    for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording))
    {
	if (recording->HierarchyLevels() > 0)
	{
	    char* dir = strdup(recording->Name());
	    // strip the trailing rec dir
	    char* pos = strrchr(dir, '~');
	    if (pos)
	    {
		*pos=0;
		for(int iLevel = 0; iLevel < recording->HierarchyLevels(); iLevel++)
		{
		    directorySet.insert(dir);
		    char* pos = strrchr(dir, '~');
		    if (pos)
			*pos=0;
		}
	    }
	    free(dir);
	}
    }
    // add distinct directories from current timers
    for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer))
    {
	char* dir = strdup(timer->File());
	// strip the trailing name dir
	char* pos = strrchr(dir, '~');
	if (pos)
	{
	    *pos=0;
	    do
	    {
		directorySet.insert(dir);
		char* pos = strrchr(dir, '~');
		if (pos)
		    *pos=0;
		else break;
	    }
	    while(true);
	}
	free(dir);
    }

#if APIVERSNUM >= 10712
    // add distinct directories from folders.conf
    for(cNestedItem* item = Folders.First(); item; item = Folders.Next(item))
      AddVDRFolders(item);
#endif

    if (extraDirs)
      {
	cMutexLock SearchExtsLock(&SearchExts);
	cSearchExt *searchExt = SearchExts.First();
	// add distinct directories from existing search timers
	while (searchExt)
	  {
	    if (strlen(searchExt->directory) > 0)
	      directorySet.insert(searchExt->directory);
	    searchExt = SearchExts.Next(searchExt);
	  }
	// add distinct directories from epgsearchdirs.conf
	DirExts.Load(AddDirectory(CONFIGDIR, "epgsearchdirs.conf"), true);
	cDirExt* DirExt = DirExts.First();
	while (DirExt)
	  {
	    directorySet.insert(DirExt->Name());
	    DirExt = DirExts.Next(DirExt);
	  }
	// add distinct directories from conf.d files
	DirExt = ConfDDirExts.First();
	while (DirExt)
	  {
	    directorySet.insert(DirExt->Name());
	    DirExt = ConfDDirExts.Next(DirExt);
	  }
      }
}