/[svn]/linuxsampler/trunk/src/db/InstrumentsDbUtilities.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/db/InstrumentsDbUtilities.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1717 by iliev, Sun Mar 16 17:43:20 2008 UTC revision 1781 by iliev, Mon Sep 29 18:21:21 2008 UTC
# Line 463  namespace LinuxSampler { Line 463  namespace LinuxSampler {
463          sp->SetStatus((int)(pProgress->factor * 100));          sp->SetStatus((int)(pProgress->factor * 100));
464      }      }
465    
466      AddInstrumentsJob::AddInstrumentsJob(int JobId, ScanMode Mode, String DbDir, String FsDir) {      AddInstrumentsJob::AddInstrumentsJob(int JobId, ScanMode Mode, String DbDir, String FsDir, bool insDir) {
467          this->JobId = JobId;          this->JobId = JobId;
468          Progress.JobId = JobId;          Progress.JobId = JobId;
469          this->Mode = Mode;          this->Mode = Mode;
470          this->DbDir = DbDir;          this->DbDir = DbDir;
471          this->FsDir = FsDir;          this->FsDir = FsDir;
472                    this->insDir = insDir;
473      }      }
474    
475      void AddInstrumentsJob::Run() {      void AddInstrumentsJob::Run() {
# Line 478  namespace LinuxSampler { Line 479  namespace LinuxSampler {
479              switch (Mode) {              switch (Mode) {
480                  case NON_RECURSIVE:                  case NON_RECURSIVE:
481                      Progress.SetTotalFileCount(GetFileCount());                      Progress.SetTotalFileCount(GetFileCount());
482                      db->AddInstrumentsNonrecursive(DbDir, FsDir, &Progress);                      db->AddInstrumentsNonrecursive(DbDir, FsDir, insDir, &Progress);
483                      break;                      break;
484                  case RECURSIVE:                  case RECURSIVE:
485                      db->AddInstrumentsRecursive(DbDir, FsDir, false, &Progress);                      db->AddInstrumentsRecursive(DbDir, FsDir, false, insDir, &Progress);
486                      break;                      break;
487                  case FLAT:                  case FLAT:
488                      db->AddInstrumentsRecursive(DbDir, FsDir, true, &Progress);                      db->AddInstrumentsRecursive(DbDir, FsDir, true, insDir, &Progress);
489                      break;                      break;
490                  default:                  default:
491                      throw Exception("Unknown scan mode");                      throw Exception("Unknown scan mode");
# Line 520  namespace LinuxSampler { Line 521  namespace LinuxSampler {
521          return count;          return count;
522      }      }
523    
524      AddInstrumentsFromFileJob::AddInstrumentsFromFileJob(int JobId, String DbDir, String FilePath, int Index) {      AddInstrumentsFromFileJob::AddInstrumentsFromFileJob(int JobId, String DbDir, String FilePath, int Index, bool insDir) {
525          this->JobId = JobId;          this->JobId = JobId;
526          Progress.JobId = JobId;          Progress.JobId = JobId;
527          Progress.SetTotalFileCount(1);          Progress.SetTotalFileCount(1);
# Line 528  namespace LinuxSampler { Line 529  namespace LinuxSampler {
529          this->DbDir = DbDir;          this->DbDir = DbDir;
530          this->FilePath = FilePath;          this->FilePath = FilePath;
531          this->Index = Index;          this->Index = Index;
532                    this->insDir = insDir;
533      }      }
534    
535      void AddInstrumentsFromFileJob::Run() {      void AddInstrumentsFromFileJob::Run() {
536          try {          try {
537              InstrumentsDb::GetInstrumentsDb()->AddInstruments(DbDir, FilePath, Index, &Progress);              InstrumentsDb::GetInstrumentsDb()->AddInstruments(DbDir, insDir, FilePath, Index, &Progress);
538    
539              // Just to be sure that the frontends will be notified about the job completion              // Just to be sure that the frontends will be notified about the job completion
540              if (Progress.GetTotalFileCount() != Progress.GetScannedFileCount()) {              if (Progress.GetTotalFileCount() != Progress.GetScannedFileCount()) {
# Line 546  namespace LinuxSampler { Line 548  namespace LinuxSampler {
548      }      }
549    
550    
551      void DirectoryScanner::Scan(String DbDir, String FsDir, bool Flat, ScanProgress* pProgress) {      void DirectoryScanner::Scan(String DbDir, String FsDir, bool Flat, bool insDir, ScanProgress* pProgress) {
552          dmsg(2,("DirectoryScanner: Scan(DbDir=%s,FsDir=%s,Flat=%d)\n", DbDir.c_str(), FsDir.c_str(), Flat));          dmsg(2,("DirectoryScanner: Scan(DbDir=%s,FsDir=%s,Flat=%d,insDir=%d)\n", DbDir.c_str(), FsDir.c_str(), Flat, insDir));
553          if (DbDir.empty() || FsDir.empty()) throw Exception("Directory expected");          if (DbDir.empty() || FsDir.empty()) throw Exception("Directory expected");
554                    
555          this->DbDir = DbDir;          this->DbDir = DbDir;
556          this->FsDir = FsDir;          this->FsDir = FsDir;
557            this->insDir = insDir;
558          if (DbDir.at(DbDir.length() - 1) != '/') {          if (DbDir.at(DbDir.length() - 1) != '/') {
559              this->DbDir.append("/");              this->DbDir.append("/");
560          }          }
# Line 580  namespace LinuxSampler { Line 583  namespace LinuxSampler {
583    
584          if (HasInstrumentFiles(Path)) {          if (HasInstrumentFiles(Path)) {
585              if (!db->DirectoryExist(dir)) db->AddDirectory(dir);              if (!db->DirectoryExist(dir)) db->AddDirectory(dir);
586              db->AddInstrumentsNonrecursive(dir, Path, pProgress);              db->AddInstrumentsNonrecursive(dir, Path, insDir, pProgress);
587          }          }
588      };      };
589    
# Line 599  namespace LinuxSampler { Line 602  namespace LinuxSampler {
602      }      }
603    
604      void InstrumentFileCounter::FileEntry(std::string Path) {      void InstrumentFileCounter::FileEntry(std::string Path) {
605            dmsg(2,("InstrumentFileCounter: FileEntry(Path=%s)\n", Path.c_str()));
606          if(Path.length() < 4) return;          if(Path.length() < 4) return;
607          if(!strcasecmp(".gig", Path.substr(Path.length() - 4).c_str())) FileCount++;          if(!strcasecmp(".gig", Path.substr(Path.length() - 4).c_str())) FileCount++;
608      };      };

Legend:
Removed from v.1717  
changed lines
  Added in v.1781

  ViewVC Help
Powered by ViewVC