Files
Yuba/filetypes.php
2020-01-27 03:32:56 -08:00

325 lines
7.9 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_iff = escapeshellarg(__DIR__."/bin/iff");
$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 = "/usr/bin/php";
$bin_qlmanage = "/usr/bin/qlmanage";
$bin_sips = "/usr/bin/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",
"qlgenerator",
"workflow"
);
// 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" );
// Thumbnail bindings
$p['t_b']['mkv'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['avi'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['mpeg'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['mpg'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['vob'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['mp4'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['m4v'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['m2v'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['m2ts'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['asf'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['wmv'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['rm'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['divx'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['fla'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['flv'] = array("ql-thumbnail","ffmpeg");
$p['t_b']['webm'] = array("ql-thumbnail","ffmpeg");
// sips provides a minor speed improvement but also scales small images up
//$p['t_b']['jpg'] = array("sips","ql-thumbnail","vips");
//$p['t_b']['jpeg'] = array("sips","ql-thumbnail","vips");
//$p['t_b']['png'] = array("sips","ql-thumbnail","vips");
$p['t_b']['jpg'] = array("ql-thumbnail","sips","vips");
$p['t_b']['jpeg'] = array("ql-thumbnail","sips","vips");
$p['t_b']['png'] = array("ql-thumbnail","sips","vips");
$p['t_b']['tif'] = array("vips","sips","ql-thumbnail");
$p['t_b']['tiff'] = array("vips","sips","ql-thumbnail");
$p['t_b']['nik'] = array("ql-thumbnail","sips","vips");
$p['t_b']['dng'] = array("ql-thumbnail","sips","vips");
$p['t_b']['gif'] = array("ql-thumbnail","sips","vips");
$p['t_b']['psd'] = array("ql-thumbnail","sips","vips");
$p['t_b']['heic'] = array("ql-thumbnail","sips","vips");
$p['t_b']['pdf'] = array("ql-thumbnail","sips","vips");
$p['t_b']['ai'] = array("ql-thumbnail","sips","vips");
$p['t_b']['ps'] = array("ql-thumbnail","sips","vips");
$p['t_b']['bmp'] = array("ql-thumbnail","sips","vips");
$p['t_b']['pict'] = array("ql-thumbnail","sips","vips");
$p['t_b']['jp2'] = array("ql-thumbnail","sips","vips");
$p['t_b']['flac'] = array("sox");
$p['t_b']['wav'] = array("sox");
$p['t_b']['aif'] = array("sox");
$p['t_b']['aiff'] = array("sox");
$p['t_b']['au'] = array("sox");
$p['t_b']['wv'] = array("sox");
$p['t_b']['snd'] = array("sox");
$p['t_b']['voc'] = array("sox");
$p['t_b']['m4a'] = array("sox","ql-thumbnail");
$p['t_b']['m4b'] = array("sox","ql-thumbnail");
$p['t_b']['ogg'] = array("sox","ql-thumbnail");
$p['t_b']['mp3'] = array();
$p['t_b']['DS_Store'] = array();
foreach ($p['bundles'] as $bundle) { $p['t_b'][$bundle] = array("qltool"); }
$p['t_b']['*'] = "ql-thumbnail";
// 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" );
// Make sox preview icons for these files
$p['i_sox'] = array( "flac",
"wav",
"aif",
"aiff",
"au",
"wv",
"snd",
"voc" );
// 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['i_skip'] as $ext) { $p['i_skip'][] = strtoupper($ext); }
foreach ($p['i_sox'] as $ext) { $p['i_sox'][] = 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, $bundle, $ext, $file);
// Album dirs //////////////////////////////////////////
$p['album_files'] = array("flac","mp3","mp4","wav","ogg","aiff","aif");
$p['cover_files'] = array("cover","folder","front","dir");
$p['cover_exts'] = array("jpg","jpeg","png");
?>