Ticket #808: mythvideo-ignore.patch
File mythvideo-ignore.patch, 5.4 KB (added by , 18 years ago) |
---|
-
mythvideo/mythvideo/videolist.h
3 3 4 4 #include <qapplication.h> 5 5 #include <qdialog.h> 6 #include <qmap.h> 6 7 7 8 #include <mythtv/mythwidgets.h> 8 9 #include <mythtv/uitypes.h> … … 37 38 void buildFsysList(bool flatlist, int parental_level); 38 39 void buildDbList(bool flatlist, int parental_level); 39 40 void buildFileList(const QString& directory); 40 bool ignoreExtension(const QString& extension); 41 bool ignoreExtension(const QString& extension) const; 42 41 43 void removeUpnodes(GenericTree *parent); 42 44 void addUpnodes(GenericTree *parent); 43 45 GenericTree *addDirNode(GenericTree *where_to_add, … … 47 49 48 50 bool m_ListUnknown; 49 51 bool m_LoadMetaData; 50 Q StringListm_IgnoreList;52 QMap<QString,bool> m_IgnoreList; 51 53 52 54 QSqlDatabase *db; 53 55 int nitems; // Number of real items in the tree -
mythvideo/mythvideo/videoscan.h
2 2 #define VIDEO_SCANNER_H 3 3 #include <qobject.h> 4 4 #include <qmap.h> 5 #include <qmap.h> 5 6 6 7 enum VideoFileLocation 7 8 { … … 25 26 bool m_RemoveAll; 26 27 bool m_KeepAll; 27 28 VideoLoadedMap m_VideoFiles; 28 QStringList m_IgnoreList;29 29 30 QMap<QString,bool> m_IgnoreList; 31 30 32 void promptForRemoval(const QString& filename); 31 33 bool ignoreExtension(const QString& extension) const; 32 34 void verifyFiles(); -
mythvideo/mythvideo/videolist.cpp
17 17 m_LoadMetaData = gContext->GetNumSetting("VideoTreeLoadMetaData", 0); 18 18 19 19 MSqlQuery query(MSqlQuery::InitCon()); 20 QString thequery("SELECT extension FROM videotypes WHERE f_ignore = 1;");20 QString thequery("SELECT extension,f_ignore FROM videotypes;"); 21 21 query.exec(thequery); 22 22 23 23 if (query.isActive() && query.size() > 0) 24 24 { 25 25 while (query.next()) 26 26 { 27 m_IgnoreList.append(query.value(0).toString()); 27 QString ext = query.value(0).toString().lower(); 28 bool ignore = query.value(1).toBool(); 29 m_IgnoreList.insert(ext, ignore); 28 30 } 29 31 } 30 32 … … 61 63 } 62 64 } 63 65 66 bool VideoList::ignoreExtension(const QString &extension) const 67 { 68 QString ext = extension.lower(); 69 QMap<QString,bool>::const_iterator it = m_IgnoreList.find(ext); 70 if (it == m_IgnoreList.end()) 71 return !m_ListUnknown; 72 return it.data(); 73 } 64 74 75 65 76 // 66 77 // Build a generic tree containing the video files. You can control the 67 78 // contents and the shape of the tree in de following ways: … … 468 479 continue; 469 480 } 470 481 471 if(!fi->isDir()) 472 { 473 QRegExp r; 474 475 r.setPattern("^" + fi->extension(false) + "$"); 476 r.setCaseSensitive(false); 477 QStringList result = m_IgnoreList.grep(r); 478 if ((!result.isEmpty() && (!m_ListUnknown))) { 482 if(!fi->isDir() && ignoreExtension(fi->extension(false))) 479 483 continue; 480 }481 482 }483 484 484 485 QString filename = fi->absFilePath(); 485 486 if (fi->isDir()) -
mythvideo/mythvideo/videoscan.cpp
16 16 m_ListUnknown = gContext->GetNumSetting("VideoListUnknownFileTypes", 1); 17 17 18 18 MSqlQuery query(MSqlQuery::InitCon()); 19 QString thequery("SELECT extension FROM videotypes WHERE f_ignore = 1;");19 QString thequery("SELECT extension,f_ignore FROM videotypes;"); 20 20 query.exec(thequery); 21 21 22 22 if (query.isActive() && query.size() > 0) 23 23 { 24 24 while (query.next()) 25 25 { 26 m_IgnoreList.append(query.value(0).toString()); 26 QString ext = query.value(0).toString().lower(); 27 bool ignore = query.value(1).toBool(); 28 m_IgnoreList.insert(ext, ignore); 27 29 } 28 30 } 29 31 30 31 32 } 32 33 33 34 void VideoScanner::doScan(const QString& videoDirs) … … 163 164 progressDlg.Close(); 164 165 } 165 166 167 bool VideoScanner::ignoreExtension(const QString &extension) const 168 { 169 QString ext = extension.lower(); 170 QMap<QString,bool>::const_iterator it = m_IgnoreList.find(ext); 171 if (it == m_IgnoreList.end()) 172 return !m_ListUnknown; 173 return it.data(); 174 } 166 175 167 168 176 void VideoScanner::buildFileList(const QString &directory, 169 177 const QStringList &imageExtensions) 170 178 { … … 193 201 { 194 202 continue; 195 203 } 196 197 if(!fi->isDir()) 198 { 199 r.setPattern("^" + fi->extension(false) + "$"); 200 r.setCaseSensitive(false); 201 QStringList result = m_IgnoreList.grep(r); 202 if ((!result.isEmpty() && (!m_ListUnknown))) { 204 205 if(!fi->isDir() && ignoreExtension(fi->extension(false))) 203 206 continue; 204 }205 }206 207 207 208 QString filename = fi->absFilePath(); 208 209 if (fi->isDir())