27 bool list_unknown) : m_listUnknown(list_unknown)
29 for (
const auto & ext : ext_disposition)
31 m_extensions.insert(ext_map::value_type(ext.first.toLower(),
39 ext_map::const_iterator
p = m_extensions.find(extension.toLower());
40 if (
p != m_extensions.end())
42 return !m_listUnknown;
55 d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
56 QFileInfoList list =
d.entryInfoList();
63 for (
const auto& entry : std::as_const(list))
65 if (entry.fileName() ==
"Thumbs.db")
71 bool add_as_file =
true;
77 dir_tester.setPath(entry.absoluteFilePath() +
"/VIDEO_TS");
79 bd_dir_tester.setPath(entry.absoluteFilePath() +
"/BDMV");
80 if (dir_tester.exists() || bd_dir_tester.exists())
87 LOG(VB_GENERAL, LOG_DEBUG,
88 QString(
" -- Dir : %1").arg(entry.!absoluteFilePath()));
91 handler->
newDir(entry.fileName(),
92 entry.absoluteFilePath());
96 (void)
scan_dir(entry.absoluteFilePath(), dh, ext_settings);
103 LOG(VB_GENERAL, LOG_DEBUG,
104 QString(
" -- File : %1").arg(entry.fileName()));
106 handler->
handleFile(entry.fileName(), entry.absoluteFilePath(),
116 const ext_lookup &ext_settings,
bool isMaster =
false)
118 QString path = start_path;
120 if (path.startsWith(base_path))
121 path.remove(0, base_path.length());
123 if (!path.endsWith(
"/"))
143 if (!ok || (!list.isEmpty() && list.at(0).startsWith(
"SLAVE UNREACHABLE")))
145 LOG(VB_GENERAL, LOG_INFO,
146 QString(
"Backend : %1 : Is currently Unreachable. Skipping "
147 "this one.") .arg(host));
151 if (list.isEmpty() || (list.at(0) ==
"EMPTY LIST"))
154 for (
const auto& entry : std::as_const(list))
156 QStringList fInfo = entry.split(
"::");
157 const QString&
type = fInfo.at(0);
158 QString fileName = fInfo.at(1);
163 QFileInfo fi(fileName);
165 if ((
type !=
"dir") &&
169 !fileName.endsWith(
"VIDEO_TS") &&
170 !fileName.endsWith(
"BDMV"))
173 LOG(VB_GENERAL, LOG_DEBUG,
174 QString(
" -- Dir : %1").arg(fileName));
184 (void)
scan_sg_dir(start_path +
"/" + fileName, host, base_path,
185 dh, ext_settings, isMaster);
192 if (fileName.endsWith(
"VIDEO_TS") || fileName.endsWith(
"BDMV"))
194 if (path.startsWith(
"/"))
195 path = path.right(path.length() - 1);
196 if (path.endsWith(
"/"))
197 path = path.left(path.length() - 1);
198 QStringList upDirs = path.split(
"/");
199 if (upDirs.count() > 1)
200 fileName = upDirs.takeLast();
208 suffix = fi.suffix();
209 URL = QString(
"%1/%2").arg(path, fileName);
212 URL.replace(
"//",
"/");
214 if (URL.startsWith(
"/"))
215 URL = URL.right(URL.length() - 1);
217 LOG(VB_GENERAL, LOG_GENERAL,
218 QString(
" -- File Filename: %1 URL: %2 Suffix: %3 Host: %4")
219 .arg(fileName).arg(URL).arg(suffix).arg(QString(host)));
221 handler->
handleFile(fileName, URL, fi.suffix(), QString(host));
231 bool list_unknown_extensions)
233 ext_lookup extlookup(ext_disposition, list_unknown_extensions);
235 bool pathScanned =
true;
237 if (!start_path.startsWith(
"myth://"))
239 LOG(VB_GENERAL, LOG_INFO,
240 QString(
"MythVideo::ScanVideoDirectory Scanning (%1)")
243 if (!
scan_dir(start_path, handler, extlookup))
245 LOG(VB_GENERAL, LOG_ERR,
246 QString(
"MythVideo::ScanVideoDirectory failed to scan %1")
253 LOG(VB_GENERAL, LOG_INFO,
254 QString(
"MythVideo::ScanVideoDirectory Scanning Group (%1)")
256 QUrl sgurl = start_path;
257 QString host = sgurl.host();
258 QString path = sgurl.path();
260 if (!
scan_sg_dir(path, host, path, handler, extlookup,
264 LOG(VB_GENERAL, LOG_ERR,
265 QString(
"MythVideo::ScanVideoDirectory failed to scan %1 ")