26 bool list_unknown) : m_listUnknown(list_unknown)
28 for (
const auto & ext : ext_disposition)
30 m_extensions.insert(ext_map::value_type(ext.first.toLower(),
38 ext_map::const_iterator
p = m_extensions.find(extension.toLower());
39 if (
p != m_extensions.end())
41 return !m_listUnknown;
54 d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
55 QFileInfoList list =
d.entryInfoList();
62 for (
const auto& entry : std::as_const(list))
64 if (entry.fileName() ==
"Thumbs.db")
70 bool add_as_file =
true;
76 dir_tester.setPath(entry.absoluteFilePath() +
"/VIDEO_TS");
78 bd_dir_tester.setPath(entry.absoluteFilePath() +
"/BDMV");
79 if (dir_tester.exists() || bd_dir_tester.exists())
86 LOG(VB_GENERAL, LOG_DEBUG,
87 QString(
" -- Dir : %1").arg(entry.!absoluteFilePath()));
90 handler->
newDir(entry.fileName(),
91 entry.absoluteFilePath());
95 (void)
scan_dir(entry.absoluteFilePath(), dh, ext_settings);
102 LOG(VB_GENERAL, LOG_DEBUG,
103 QString(
" -- File : %1").arg(entry.fileName()));
105 handler->
handleFile(entry.fileName(), entry.absoluteFilePath(),
115 const ext_lookup &ext_settings,
bool isMaster =
false)
117 QString path = start_path;
119 if (path.startsWith(base_path))
120 path.remove(0, base_path.length());
122 if (!path.endsWith(
"/"))
142 if (!ok || (!list.isEmpty() && list.at(0).startsWith(
"SLAVE UNREACHABLE")))
144 LOG(VB_GENERAL, LOG_INFO,
145 QString(
"Backend : %1 : Is currently Unreachable. Skipping "
146 "this one.") .arg(host));
150 if (list.isEmpty() || (list.at(0) ==
"EMPTY LIST"))
153 for (
const auto& entry : std::as_const(list))
155 QStringList fInfo = entry.split(
"::");
156 const QString&
type = fInfo.at(0);
157 QString fileName = fInfo.at(1);
162 QFileInfo fi(fileName);
164 if ((
type !=
"dir") &&
168 !fileName.endsWith(
"VIDEO_TS") &&
169 !fileName.endsWith(
"BDMV"))
172 LOG(VB_GENERAL, LOG_DEBUG,
173 QString(
" -- Dir : %1").arg(fileName));
183 (void)
scan_sg_dir(start_path +
"/" + fileName, host, base_path,
184 dh, ext_settings, isMaster);
191 if (fileName.endsWith(
"VIDEO_TS") || fileName.endsWith(
"BDMV"))
193 if (path.startsWith(
"/"))
194 path = path.right(path.length() - 1);
195 if (path.endsWith(
"/"))
196 path = path.left(path.length() - 1);
197 QStringList upDirs = path.split(
"/");
198 if (upDirs.count() > 1)
199 fileName = upDirs.takeLast();
207 suffix = fi.suffix();
208 URL = QString(
"%1/%2").arg(path, fileName);
211 URL.replace(
"//",
"/");
213 if (URL.startsWith(
"/"))
214 URL = URL.right(URL.length() - 1);
216 LOG(VB_GENERAL, LOG_GENERAL,
217 QString(
" -- File Filename: %1 URL: %2 Suffix: %3 Host: %4")
218 .arg(fileName).arg(URL).arg(suffix).arg(QString(host)));
220 handler->
handleFile(fileName, URL, fi.suffix(), QString(host));
230 bool list_unknown_extensions)
232 ext_lookup extlookup(ext_disposition, list_unknown_extensions);
234 bool pathScanned =
true;
236 if (!start_path.startsWith(
"myth://"))
238 LOG(VB_GENERAL, LOG_INFO,
239 QString(
"MythVideo::ScanVideoDirectory Scanning (%1)")
242 if (!
scan_dir(start_path, handler, extlookup))
244 LOG(VB_GENERAL, LOG_ERR,
245 QString(
"MythVideo::ScanVideoDirectory failed to scan %1")
252 LOG(VB_GENERAL, LOG_INFO,
253 QString(
"MythVideo::ScanVideoDirectory Scanning Group (%1)")
255 QUrl sgurl = start_path;
256 QString host = sgurl.host();
257 QString path = sgurl.path();
259 if (!
scan_sg_dir(path, host, path, handler, extlookup,
263 LOG(VB_GENERAL, LOG_ERR,
264 QString(
"MythVideo::ScanVideoDirectory failed to scan %1 ")