292 lines
6.0 KiB
PHP
Executable File
292 lines
6.0 KiB
PHP
Executable File
<?php
|
|
|
|
// Filetypes
|
|
//////////////////////////////////////////
|
|
|
|
// Bundled tools
|
|
$bin_gfi = escapeshellarg(__DIR__."/bin/GetFileInfo");
|
|
$bin_mediainfo = escapeshellarg(__DIR__."/bin/mediainfo");
|
|
$bin_exiftool = escapeshellarg(__DIR__."/bin/exiftool");
|
|
$bin_ffmpeg = escapeshellarg(__DIR__."/bin/ffmpeg");
|
|
$bin_qlthumb = escapeshellarg(__DIR__."/bin/ql-thumbnail");
|
|
$bin_qlicon = escapeshellarg(__DIR__."/bin/ql-icon");
|
|
$bin_qltool = escapeshellarg(__DIR__."/bin/qltool");
|
|
$bin_sox = escapeshellarg(__DIR__."/bin/sox");
|
|
$bin_pngquant = escapeshellarg(__DIR__."/bin/pngquant");
|
|
$bin_parallel = escapeshellarg(__DIR__."/bin/parallel");
|
|
$bin_convert = escapeshellarg(__DIR__."/bin/convert");
|
|
$bin_flacicon = escapeshellarg(__DIR__."/bin/flacicon");
|
|
$bin_flacdiricon = escapeshellarg(__DIR__."/bin/flacdiricon");
|
|
|
|
// System tools
|
|
$bin_php = "php";
|
|
$bin_qlmanage = "qlmanage";
|
|
$bin_sips = "sips";
|
|
|
|
// External tools
|
|
$bin_vips = "/opt/local/bin/vipsthumbnail";
|
|
|
|
// Treat these directories as files
|
|
$p['bundles'] = array( "app",
|
|
"bundle",
|
|
"sparsebundle",
|
|
"photoslibrary",
|
|
"aplibrary",
|
|
"apvault",
|
|
"abbu",
|
|
"calendar",
|
|
"framework",
|
|
"plugin",
|
|
"kext",
|
|
"rtfd"
|
|
);
|
|
|
|
// Completely ignore these files
|
|
$p['ignore'] = array( ".Trashes",
|
|
".DocumentRevisions-V100",
|
|
".Spotlight-V100",
|
|
".TemporaryItems",
|
|
".apdisk",
|
|
".com.apple.timemachine.donotpresent",
|
|
".fseventsd",
|
|
".metadata-never-index",
|
|
".neofinder.abemeda.volinfo.xml"
|
|
);
|
|
|
|
// Use these files as a directory preview
|
|
$p['p_files'] = array( "folder.jpg",
|
|
"cover.jpg",
|
|
"preview.jpg",
|
|
"cover.png",
|
|
"folder.png",
|
|
"preview.png");
|
|
|
|
// Gather contents for these files
|
|
$p['c_files'] = array( "DS_Store",
|
|
"txt",
|
|
"md",
|
|
"nfo",
|
|
"log",
|
|
"cue",
|
|
"csv",
|
|
"webloc",
|
|
"svg",
|
|
"rtf",
|
|
"rtfd",
|
|
"doc",
|
|
"docx" );
|
|
|
|
// Use ffmpeg to generate thumbnails for these files
|
|
$p['t_files']['ffmpeg'] = array( "mkv",
|
|
"avi",
|
|
"mpeg",
|
|
"mpg",
|
|
"vob",
|
|
"mp4",
|
|
"m4v",
|
|
"m2v",
|
|
"m2ts",
|
|
"asf",
|
|
"wmv",
|
|
"rm",
|
|
"divx",
|
|
"fla",
|
|
"flv",
|
|
"webm" );
|
|
|
|
// Use sips to generate thumbnails for these files
|
|
// SIPS does not currently support JPEG Orientation EXIF Tag,
|
|
// so images will sometimes appear sideways
|
|
//$p['t_files']['sips'] = array( "jpg",
|
|
// "jpeg",
|
|
// "tif",
|
|
// "tiff",
|
|
// "gif",
|
|
// "psd",
|
|
// "png",
|
|
// "heic",
|
|
// "pdf",
|
|
// "ai",
|
|
// "ps",
|
|
// "bmp",
|
|
// "pict",
|
|
// "jp2" );
|
|
|
|
// Use sox to generate thumbnails for these files
|
|
$p['t_files']['sox'] = array( "flac",
|
|
"wav",
|
|
"aif",
|
|
"aiff" );
|
|
|
|
// Don't make thumbnails for these files
|
|
$p['t_skip'] = array( "emlx",
|
|
"DS_Store" );
|
|
|
|
// Don't make icons for these files
|
|
$p['i_skip'] = array( "jpg",
|
|
"jpeg",
|
|
"tif",
|
|
"tiff",
|
|
"gif",
|
|
"png",
|
|
"heic",
|
|
"flac",
|
|
"wav",
|
|
"aiff",
|
|
"aif",
|
|
"zip",
|
|
"DS_Store" );
|
|
|
|
// Run mediainfo on these files
|
|
$p['m_files'] = array( "mkv",
|
|
"ogg",
|
|
"avi",
|
|
"wav",
|
|
"mpeg",
|
|
"mpg",
|
|
"vob",
|
|
"mp4",
|
|
"m2v",
|
|
"mp3",
|
|
"asf",
|
|
"wma",
|
|
"wmv",
|
|
"qt",
|
|
"mov",
|
|
"rm",
|
|
"ifo",
|
|
"ac3",
|
|
"dts",
|
|
"aac",
|
|
"ape",
|
|
"flac",
|
|
"aiff",
|
|
"m2ts" );
|
|
|
|
// Run exiftool on these files
|
|
$p['e_files'] = array( "ai",
|
|
"aiff",
|
|
"ape",
|
|
"asf",
|
|
"avi",
|
|
"bmp",
|
|
"divx",
|
|
"dng",
|
|
"doc",
|
|
"docx",
|
|
"eps",
|
|
"epub",
|
|
"exe",
|
|
"exif",
|
|
"fla",
|
|
"flac",
|
|
"flv",
|
|
"gif",
|
|
"heic",
|
|
"icc",
|
|
"iso",
|
|
"jpg",
|
|
"jpeg",
|
|
"m2ts",
|
|
"m4a",
|
|
"m4b",
|
|
"m4v",
|
|
"mkv",
|
|
"mobi",
|
|
"azw",
|
|
"azw3",
|
|
"mov",
|
|
"qt",
|
|
"mp3",
|
|
"mp4",
|
|
"mpeg",
|
|
"mpg",
|
|
"m2v",
|
|
"nef",
|
|
"numbers",
|
|
"ogg",
|
|
"pages",
|
|
"pdf",
|
|
"pict",
|
|
"png",
|
|
"ppm",
|
|
"ppt",
|
|
"psd",
|
|
"psb",
|
|
"qif",
|
|
"raw",
|
|
"rtf",
|
|
"sr2",
|
|
"srf",
|
|
"svg",
|
|
"swf",
|
|
"tiff",
|
|
"tif",
|
|
"torrent",
|
|
"vcf",
|
|
"vob",
|
|
"wav",
|
|
"webm",
|
|
"wma",
|
|
"wmv",
|
|
"xls",
|
|
"xlsx",
|
|
"xmp",
|
|
"zip",
|
|
"ps" );
|
|
|
|
// Ucase
|
|
foreach ($p['bundles'] as $bundle) { $p['nodescend'][] = "*.".$bundle; }
|
|
foreach ($p['c_files'] as $ext) { $p['c_files'][] = strtoupper($ext); }
|
|
foreach ($p['e_files'] as $ext) { $p['e_files'][] = strtoupper($ext); }
|
|
foreach ($p['m_files'] as $ext) { $p['m_files'][] = strtoupper($ext); }
|
|
foreach ($p['t_files']['ffmpeg'] as $ext) { $p['t_files']['ffmpeg'][] = strtoupper($ext); }
|
|
//foreach ($p['t_files']['sips'] as $ext) { $p['t_files']['sips'][] = strtoupper($ext); }
|
|
foreach ($p['t_skip'] as $ext) { $p['t_skip'][] = strtoupper($ext); }
|
|
foreach ($p['i_skip'] as $ext) { $p['i_skip'][] = strtoupper($ext); }
|
|
foreach ($p['p_files'] as $file) { $p['p_files'][] = strtoupper($file); }
|
|
|
|
// Spotlight //////////////////////////////////////////
|
|
|
|
$mb['i'] = array( "PixelWidth",
|
|
"PixelHeight",
|
|
"Latitude",
|
|
"Longitude",
|
|
"DurationSeconds",
|
|
"UseCount",
|
|
"FSInvisible",
|
|
"NumberOfPages",
|
|
"PageHeight",
|
|
"PageWidth",
|
|
"TotalBitRate" );
|
|
|
|
$mb['t'] = array( "Title",
|
|
"ContentType",
|
|
"Creator",
|
|
"FSCreatorCode",
|
|
"Kind",
|
|
"FSTypeCode" );
|
|
|
|
$mb['a'] = array( "UserTags",
|
|
"WhereFroms",
|
|
"EncodingApplications" );
|
|
|
|
$mb['d'] = array( "DateAdded",
|
|
"LastUsedDate",
|
|
"ContentModificationDate",
|
|
"ContentCreationDate" );
|
|
|
|
$ibuild[] = ":pid, :spotlight";
|
|
$cbuild[] = "pid TEXT, spotlight TEXT";
|
|
foreach (array_merge($mb['i'],$mb['d']) as $item) {
|
|
$cbuild[] = $item." INTEGER";
|
|
$ibuild[] = ":".$item;
|
|
}
|
|
foreach (array_merge($mb['t'],$mb['a']) as $item) {
|
|
$cbuild[] = $item." TEXT";
|
|
$ibuild[] = ":".$item;
|
|
}
|
|
|
|
unset($item);
|
|
|
|
?>
|