Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f870df2a16 | |||
| 47417e1175 | |||
| 84a8287bf9 | |||
| 0bbd78a9a9 | |||
| fbe2b8a7e8 | |||
| 743ee4be1f | |||
| 4c161b0526 | |||
| 6edb46cc86 | |||
| 8166dfa42f | |||
| 754c5a0d2e | |||
| 7c96c474ee | |||
| f297d9d846 | |||
| 3ca3ef2685 | |||
| a0b4219cad | |||
| a344259e40 |
27
CHANGELOG.md
@@ -1,6 +1,33 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All notable changes to this project will be documented in this file. Older changes are summarized on individual commits.
|
All notable changes to this project will be documented in this file. Older changes are summarized on individual commits.
|
||||||
|
|
||||||
|
## [0.8.1.0]
|
||||||
|
- Mitigate parallel crash by passing "-j" flag
|
||||||
|
- Revamp parallel preferences
|
||||||
|
|
||||||
|
## [0.8.0.2]
|
||||||
|
- Tweaks to directory and bundle icons
|
||||||
|
- Switch from qltool to iff
|
||||||
|
- Output redirection fixes
|
||||||
|
- Thumbnail bindings
|
||||||
|
- "Add to existing" prefs option
|
||||||
|
- Fixed a fid bug introduced in 0.8.0.0
|
||||||
|
|
||||||
|
## [0.8.0.1]
|
||||||
|
- Move batchfile generation to Prescan
|
||||||
|
- Rewrite batchfile generation (batch now handles files, links, dirs)
|
||||||
|
- Rewrite spotlight and move to batch
|
||||||
|
- Replace directory previews with flacdiricon tool
|
||||||
|
|
||||||
|
## [0.8.0.0]
|
||||||
|
- Refactor for thumb/icon "modes"
|
||||||
|
- Integrate ql-icon
|
||||||
|
- flacfile shell tool
|
||||||
|
- Move more operations into helper
|
||||||
|
- "Open in browser" postflight
|
||||||
|
- Clean up prefs
|
||||||
|
- Better logic for external tools (sips can be disabled manually)
|
||||||
|
|
||||||
## [0.7.13.2]
|
## [0.7.13.2]
|
||||||
- Added PHP extension checks
|
- Added PHP extension checks
|
||||||
- Moved icon, thumb, meta, contents into helper
|
- Moved icon, thumb, meta, contents into helper
|
||||||
|
|||||||
4
MainMenu.nib/designable.nib
generated
@@ -55,7 +55,7 @@
|
|||||||
<rect key="contentRect" x="472" y="537" width="600" height="83"/>
|
<rect key="contentRect" x="472" y="537" width="600" height="83"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
|
||||||
<value key="minSize" type="size" width="600" height="83"/>
|
<value key="minSize" type="size" width="600" height="83"/>
|
||||||
<value key="maxSize" type="size" width="1200" height="83"/>
|
<value key="maxSize" type="size" width="1800" height="83"/>
|
||||||
<view key="contentView" id="2">
|
<view key="contentView" id="2">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="83"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="83"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
@@ -548,7 +548,7 @@ Gw
|
|||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Hk1-72-Owa">
|
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Hk1-72-Owa">
|
||||||
<rect key="frame" x="1" y="1" width="559" height="365"/>
|
<rect key="frame" x="1" y="1" width="559" height="365"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" allowsDocumentBackgroundColorChange="YES" linkDetection="YES" id="225">
|
<textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" allowsDocumentBackgroundColorChange="YES" linkDetection="YES" id="225">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="559" height="365"/>
|
<rect key="frame" x="0.0" y="0.0" width="559" height="365"/>
|
||||||
|
|||||||
BIN
MainMenu.nib/keyedobjects.nib
generated
10
README.md
@@ -1,10 +1,10 @@
|
|||||||
<img align='left' src='/git/p/Yuba/raw/master/icon.iconset/icon_512x512.png' width='128'>
|
<img align='left' src='icon.iconset/icon_512x512.png' width='128'>
|
||||||
|
|
||||||
# Yuba
|
# Yuba
|
||||||
|
|
||||||
**Yuba** generates web-browsable catalogues from locally attached HFS+ filesystems. Its client application gathers forensic-quality data about a volume, properly interpreting bundles, reading Spotlight data, Finder flags, labels, and other contextual information. It can generate hashes, thumbnails, and gather 3rd party metadata with exiftool and mediainfo. Yuba's SQLite catalogues are comprehensive, lightweight, optimized for massive (1 million+) trees, and reflect incremental changes to contents and metadata. A server-side PHP script is provided, which allows familiar, Finder-style browsing of a catalogue.
|
**Yuba** generates web-browsable catalogues from locally attached HFS+ filesystems. Its client application gathers forensic-quality data about a volume, properly interpreting bundles, reading Spotlight data, Finder flags, labels, and other contextual information. It can generate hashes, thumbnails, and gather 3rd party metadata with exiftool and mediainfo. Yuba's SQLite catalogues are comprehensive, lightweight, optimized for massive (1 million+) trees, and reflect incremental changes to contents and metadata. A server-side PHP script is provided, which allows familiar, Finder-style browsing of a catalogue.
|
||||||
|
|
||||||
####[⇩ Download Yuba 0.7.13.2](https://www.profiteroles.org/git/p/Yuba/raw/master/Yuba.app.zip) ([Changelog](CHANGELOG.md))
|
####[⇩ Download Yuba 0.8.1.0](https://git1.profiteroles.org/p/Yuba/raw/master/Yuba.app.zip) ([Changelog](CHANGELOG.md))
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
<img src='/git/p/Yuba/raw/master/screenshot_1.png' width='977'>
|
<img src='screenshot_1.png' width='977'>
|
||||||
<img src='/git/p/Yuba/raw/master/screenshot_2.png' width='1779'>
|
<img src='screenshot_2.png' width='1779'>
|
||||||
<img src='/git/p/Yuba/raw/master/screenshot_3.png' width='1779'>
|
<img src='screenshot_3.png' width='1779'>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
|||||||
BIN
Tester.zip
@@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
// Yuba Preview Tester 0.1.5
|
// Yuba Preview Tester 0.1.6
|
||||||
|
|
||||||
//print_r($argv);
|
//print_r($argv);
|
||||||
|
|
||||||
@@ -12,13 +12,16 @@ $bin_mediainfo = __DIR__."/bin/mediainfo";
|
|||||||
$bin_exiftool = __DIR__."/bin/exiftool";
|
$bin_exiftool = __DIR__."/bin/exiftool";
|
||||||
$bin_ffmpeg = __DIR__."/bin/ffmpeg";
|
$bin_ffmpeg = __DIR__."/bin/ffmpeg";
|
||||||
$bin_qlthumb = __DIR__."/bin/ql-thumbnail";
|
$bin_qlthumb = __DIR__."/bin/ql-thumbnail";
|
||||||
$bin_qlicon = __DIR__."/bin/ql-icon";
|
$bin_qlicon = __DIR__."/bin/ql-icon_old";
|
||||||
$bin_qltool = __DIR__."/bin/qltool";
|
$bin_qltool = __DIR__."/bin/qltool";
|
||||||
$bin_sox = __DIR__."/bin/sox";
|
$bin_sox = __DIR__."/bin/sox";
|
||||||
$bin_pngquant = __DIR__."/bin/pngquant";
|
$bin_pngquant = __DIR__."/bin/pngquant";
|
||||||
$bin_parallel = __DIR__."/bin/parallel";
|
$bin_parallel = __DIR__."/bin/parallel";
|
||||||
$bin_convert = __DIR__."/bin/convert";
|
$bin_convert = __DIR__."/bin/convert";
|
||||||
|
|
||||||
|
$bin_zqlicon = __DIR__."/bin/ql-icon";
|
||||||
|
$bin_zicon = __DIR__."/bin/iff";
|
||||||
|
|
||||||
// System tools
|
// System tools
|
||||||
$bin_php = "php";
|
$bin_php = "php";
|
||||||
$bin_qlmanage = "qlmanage";
|
$bin_qlmanage = "qlmanage";
|
||||||
@@ -37,13 +40,16 @@ $p['icon_size'] = 512;
|
|||||||
$p['thumb_size'] = 1024;
|
$p['thumb_size'] = 1024;
|
||||||
|
|
||||||
$shellpath = escapeshellarg($argv[2]);
|
$shellpath = escapeshellarg($argv[2]);
|
||||||
$tprefix = "/tmp/".md5($shellpath.time())."/";
|
$tprefix = "/tmp/tester/".md5($shellpath.time())."/";
|
||||||
$wprefix = "/tmp/".md5($shellpath.time())."_work/";
|
$wprefix = "/tmp/tester/".md5($shellpath.time())."_work/";
|
||||||
mkdir($tprefix);
|
mkdir($tprefix,0777,true);
|
||||||
mkdir($wprefix);
|
mkdir($wprefix,0777,true);
|
||||||
|
|
||||||
if ($mode == "thumb") {
|
if ($mode == "thumb") {
|
||||||
|
|
||||||
|
$cmd['ql-thumbnail'][] = $bin_qlthumb." ".$shellpath." ".$tprefix."ql-thumbnail.jpg public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8";
|
||||||
|
$cmd['ql-thumbnail'][] = $tprefix."ql-thumbnail.jpg";
|
||||||
|
|
||||||
$cmd['sips'][] = $bin_sips." -s format jpeg -s formatOptions 80 -Z ".$p['thumb_size']." ".$shellpath." --out ".$tprefix."sips.jpg"; // add ?? "-d profile --deleteColorManagementProperties"
|
$cmd['sips'][] = $bin_sips." -s format jpeg -s formatOptions 80 -Z ".$p['thumb_size']." ".$shellpath." --out ".$tprefix."sips.jpg"; // add ?? "-d profile --deleteColorManagementProperties"
|
||||||
$cmd['sips'][] = $tprefix."sips.jpg";
|
$cmd['sips'][] = $tprefix."sips.jpg";
|
||||||
|
|
||||||
@@ -59,12 +65,23 @@ if ($mode == "thumb") {
|
|||||||
$cmd['qlmanage'][] = $bin_qlmanage." -t -s ".$p['thumb_size']." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage.png";
|
$cmd['qlmanage'][] = $bin_qlmanage." -t -s ".$p['thumb_size']." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage.png";
|
||||||
$cmd['qlmanage'][] = $tprefix."qlmanage.png";
|
$cmd['qlmanage'][] = $tprefix."qlmanage.png";
|
||||||
|
|
||||||
$cmd['ql-thumbnail'][] = $bin_qlthumb." ".$shellpath." ".$tprefix."qlthumb.jpg public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8";
|
$cmd['sox_q'][] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o - | ".$bin_pngquant." - -o ".$tprefix."sox-quant.png";
|
||||||
$cmd['ql-thumbnail'][] = $tprefix."qlthumb.jpg";
|
$cmd['sox_q'][] = $tprefix."sox-quant.png";
|
||||||
|
|
||||||
$cmd['sox'][] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o - | ".$bin_convert." - -crop 800x515+58+30 +dither -colors 16 ".$tprefix."sox.png";
|
$cmd['sox_c'][] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o - | ".$bin_convert." - -quality 85% ".$tprefix."sox-convert.jpg";
|
||||||
//$cmd['sox'][] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o ".$tpfile."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($tpfile)." --out ".$tprefix."sox.png";
|
$cmd['sox_c'][] = $tprefix."sox-convert.jpg";
|
||||||
$cmd['sox'][] = $tprefix."sox.png";
|
|
||||||
|
$cmd['sox_cx'][] = $bin_sox." ".$shellpath." -n remix - trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/20}') spectrogram -r -o - | ".$bin_convert." - -quality 85% ".$tprefix."sox-convert_x.jpg";
|
||||||
|
$cmd['sox_cx'][] = $tprefix."sox-convert_x.jpg";
|
||||||
|
|
||||||
|
$cmd['sox_cy'][] = $bin_sox." ".$shellpath." -n remix - trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/4}') spectrogram -r -o - | ".$bin_convert." - -quality 85% ".$tprefix."sox-convert_y.jpg";
|
||||||
|
$cmd['sox_cy'][] = $tprefix."sox-convert_y.jpg";
|
||||||
|
|
||||||
|
$cmd['sox_cz'][] = $bin_sox." ".$shellpath." -n remix - spectrogram -r -o - | ".$bin_convert." - -quality 85% ".$tprefix."sox-convert_all.jpg";
|
||||||
|
$cmd['sox_cz'][] = $tprefix."sox-convert_all.jpg";
|
||||||
|
|
||||||
|
$cmd['sox_s'][] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o ".escapeshellarg($wprefix.basename($argv[2]).".png")."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($wprefix.basename($argv[2]).".png")." --out ".$tprefix."sox-sips.jpg";
|
||||||
|
$cmd['sox_s'][] = $tprefix."sox-sips.jpg";
|
||||||
|
|
||||||
$cmd['ffmpeg'][] = $bin_ffmpeg." -ss $(( $(".$bin_mediainfo." --Inform='Video;%Duration%' ".$shellpath." | cut -d'.' -f1) / 10000 )) -i ".$shellpath." -vframes 1 -filter:v scale='".$p['thumb_size'].":-2' -q:v 3 ".$tprefix."ffmpeg.jpg"; // only works properly on horizontal videos
|
$cmd['ffmpeg'][] = $bin_ffmpeg." -ss $(( $(".$bin_mediainfo." --Inform='Video;%Duration%' ".$shellpath." | cut -d'.' -f1) / 10000 )) -i ".$shellpath." -vframes 1 -filter:v scale='".$p['thumb_size'].":-2' -q:v 3 ".$tprefix."ffmpeg.jpg"; // only works properly on horizontal videos
|
||||||
$cmd['ffmpeg'][] = $tprefix."ffmpeg.jpg";
|
$cmd['ffmpeg'][] = $tprefix."ffmpeg.jpg";
|
||||||
@@ -74,20 +91,32 @@ if ($mode == "thumb") {
|
|||||||
$cmd['qltool'][] = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode | ".$bin_convert." - -scale 50% -strip -define png:compression-level=9 ".$tprefix."qltool.png";
|
$cmd['qltool'][] = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode | ".$bin_convert." - -scale 50% -strip -define png:compression-level=9 ".$tprefix."qltool.png";
|
||||||
$cmd['qltool'][] = $tprefix."qltool.png";
|
$cmd['qltool'][] = $tprefix."qltool.png";
|
||||||
|
|
||||||
$cmd['ql-icon'][] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." --output=".$tprefix."qlicon.png";
|
$cmd['zicon'][] = $bin_zicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." --output=".$tprefix."zicon.png";
|
||||||
$cmd['ql-icon'][] = $tprefix."qlicon.png";
|
$cmd['zicon'][] = $tprefix."zicon.png";
|
||||||
|
|
||||||
$cmd['ql-icon_q'][] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." | ".$bin_pngquant." - > ".$tprefix."qlicon-quant.png";
|
$cmd['qltool_q'][] = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode | ".$bin_convert." - -scale 50% - | ".$bin_pngquant." - -o ".$tprefix."qltool_quant.png";
|
||||||
$cmd['ql-icon_q'][] = $tprefix."qlicon-quant.png";
|
$cmd['qltool_q'][] = $tprefix."qltool_quant.png";
|
||||||
|
|
||||||
$cmd['qlmanage_sx'][] = $bin_qlmanage." -ti -s ".$p['icon_size']." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage-size.png";
|
$cmd['zql-icon'][] = $bin_zqlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." --output=".$tprefix."zql-icon.png";
|
||||||
$cmd['qlmanage_sx'][] = $tprefix."qlmanage-size.png";
|
$cmd['zql-icon'][] = $tprefix."zql-icon.png";
|
||||||
|
|
||||||
$cmd['qlmanage_fx'][] = $bin_qlmanage." -ti -f ".floor($p['icon_size']/128)." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage-multiplier.png";
|
$cmd['zql-iconj'][] = $bin_zqlicon." --input=".$shellpath." --type=public.jpeg --width=".$p['icon_size']." --height=".$p['icon_size']." --output=".$tprefix."zql-iconj.jpg";
|
||||||
$cmd['qlmanage_fx'][] = $tprefix."qlmanage-multiplier.png";
|
$cmd['zql-iconj'][] = $tprefix."zql-iconj.jpg";
|
||||||
|
|
||||||
$cmd['qlmanage_zx'][] = $bin_qlmanage." -ti -F ".floor($p['icon_size']/64)." -o ".$wprefix." ".$shellpath." ; sips -z ".$p['icon_size']." ".$p['icon_size']." ".escapeshellarg($wprefix.basename($argv[2]).".png")." --out ".$tprefix."qlmanage-multiplier_large.png";
|
$cmd['ql-icon'][] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." --output=".$tprefix."ql-icon.png";
|
||||||
$cmd['qlmanage_zx'][] = $tprefix."qlmanage-multiplier_large.png";
|
$cmd['ql-icon'][] = $tprefix."ql-icon.png";
|
||||||
|
|
||||||
|
$cmd['ql-icon_q'][] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." | ".$bin_pngquant." - -o ".$tprefix."ql-icon_quant.png";
|
||||||
|
$cmd['ql-icon_q'][] = $tprefix."ql-icon_quant.png";
|
||||||
|
|
||||||
|
$cmd['qlmanage_sx'][] = $bin_qlmanage." -ti -s ".$p['icon_size']." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage_size.png";
|
||||||
|
$cmd['qlmanage_sx'][] = $tprefix."qlmanage_size.png";
|
||||||
|
|
||||||
|
$cmd['qlmanage_fx'][] = $bin_qlmanage." -ti -f ".floor($p['icon_size']/128)." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage_multiplier.png";
|
||||||
|
$cmd['qlmanage_fx'][] = $tprefix."qlmanage_multiplier.png";
|
||||||
|
|
||||||
|
$cmd['qlmanage_zx'][] = $bin_qlmanage." -ti -F ".floor($p['icon_size']/64)." -o ".$wprefix." ".$shellpath." ; sips -z ".$p['icon_size']." ".$p['icon_size']." ".escapeshellarg($wprefix.basename($argv[2]).".png")." --out ".$tprefix."qlmanage_multiplierlarge.png";
|
||||||
|
$cmd['qlmanage_zx'][] = $tprefix."qlmanage_multiplierlarge.png";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +126,7 @@ foreach ($cmd as $exec) {
|
|||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
echo $exec[0]."\n";
|
echo $exec[0]."\n";
|
||||||
shell_exec($exec[0]);
|
shell_exec($exec[0]);
|
||||||
$elapsed = substr((microtime(true)-$start),2,3);
|
$elapsed = substr((microtime(true)-$start),0,4);
|
||||||
|
|
||||||
$ext = pathinfo($exec[1], PATHINFO_EXTENSION);
|
$ext = pathinfo($exec[1], PATHINFO_EXTENSION);
|
||||||
$file = pathinfo($exec[1], PATHINFO_FILENAME);
|
$file = pathinfo($exec[1], PATHINFO_FILENAME);
|
||||||
@@ -105,6 +134,7 @@ foreach ($cmd as $exec) {
|
|||||||
|
|
||||||
if(!filesize($exec[1])) {
|
if(!filesize($exec[1])) {
|
||||||
echo "NO RESULT\n";
|
echo "NO RESULT\n";
|
||||||
|
unlink($exec[1]);
|
||||||
} else {
|
} else {
|
||||||
rename($exec[1],$dir."/".$i."_".$file."_".$elapsed."msec.".$ext);
|
rename($exec[1],$dir."/".$i."_".$file."_".$elapsed."msec.".$ext);
|
||||||
}
|
}
|
||||||
@@ -113,5 +143,6 @@ foreach ($cmd as $exec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shell_exec("qlmanage -p ".$tprefix."/* > /dev/null 2>&1");
|
shell_exec("qlmanage -p ".$tprefix."/* > /dev/null 2>&1");
|
||||||
|
shell_exec("open ".$tprefix);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
BIN
Yuba.app.zip
298
Yuba.php
@@ -35,7 +35,7 @@ require("filetypes.php");
|
|||||||
|
|
||||||
// Manual prefs
|
// Manual prefs
|
||||||
|
|
||||||
$wopt_steps = 8; // total number of steps
|
$wopt_steps = 7; // total number of steps
|
||||||
$wopt_currstep = 1;
|
$wopt_currstep = 1;
|
||||||
if ($p['debug']) { $wopt_clear = 0; } else { $wopt_clear = 1; }
|
if ($p['debug']) { $wopt_clear = 0; } else { $wopt_clear = 1; }
|
||||||
|
|
||||||
@@ -98,10 +98,11 @@ if ($p['contents'] && !extension_loaded("zip")) {
|
|||||||
if (!isset($argv[1]) || $argv[1] == "") { echo "No input"; die; }
|
if (!isset($argv[1]) || $argv[1] == "") { echo "No input"; die; }
|
||||||
$zpath = realpath(@$argv[1]);
|
$zpath = realpath(@$argv[1]);
|
||||||
if ($p['bdest']) { $bdest = realpath($p['bdest']); } else { $bdest = "/Users/".get_current_user()."/Documents/Yuba/"; }
|
if ($p['bdest']) { $bdest = realpath($p['bdest']); } else { $bdest = "/Users/".get_current_user()."/Documents/Yuba/"; }
|
||||||
if (!is_dir($bdest)) { if (!mkdir($bdest)) { echo "Error creating directory: ".$bdest; die; } }
|
if (!is_dir($bdest)) { if (!mkdir($bdest,0777,true)) { echo "Error creating destination directory"; die; } }
|
||||||
|
|
||||||
// Check for bundle
|
// Check for bundle
|
||||||
if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); }
|
if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); }
|
||||||
|
if (!$p['reuse']) { $blabel .= "-".$mytime; }
|
||||||
if (is_writable($zpath)) { echo "Warning: source is writeable\n"; }
|
if (is_writable($zpath)) { echo "Warning: source is writeable\n"; }
|
||||||
|
|
||||||
$bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle";
|
$bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle";
|
||||||
@@ -126,6 +127,21 @@ if (!empty($generators)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parallel check
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
$physicalcpu = trim(shell_exec("sysctl -n hw.physicalcpu"));
|
||||||
|
|
||||||
|
if ($p['parallel'] > $physicalcpu) {
|
||||||
|
alert("Parallel hardware mismatch");
|
||||||
|
echo "QUITAPP\n";
|
||||||
|
}
|
||||||
|
if ($p['parallel'] == 1) {
|
||||||
|
$wopt_parallelmsg = "max";
|
||||||
|
} else {
|
||||||
|
$wopt_parallelmsg = $p['parallel'];
|
||||||
|
}
|
||||||
|
|
||||||
// Banner
|
// Banner
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@@ -137,6 +153,7 @@ echo msg($banner."\n".str_repeat("-", strlen($banner)));
|
|||||||
// System Info
|
// System Info
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
echo msg("Using ".$wopt_parallelmsg." cores");
|
||||||
echo msg("Gathering system info...");
|
echo msg("Gathering system info...");
|
||||||
|
|
||||||
// Disks
|
// Disks
|
||||||
@@ -226,10 +243,10 @@ $dbo = new PDO("sqlite:".$bpath."/".$stamp.".sqlite3");
|
|||||||
$dbo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$dbo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
//$dbo->query("PRAGMA page_size = 4096");
|
$dbo->query("PRAGMA page_size = 4096");
|
||||||
//$dbo->query("PRAGMA cache_size = 10000");
|
$dbo->query("PRAGMA cache_size = 10000");
|
||||||
//$dbo->query("PRAGMA locking_mode = EXCLUSIVE");
|
$dbo->query("PRAGMA synchronous = NORMAL");
|
||||||
//$dbo->query("PRAGMA synchronous = NORMAL");
|
$dbo->query("PRAGMA locking_mode = NORMAL");
|
||||||
$dbo->query("PRAGMA journal_mode = WAL");
|
$dbo->query("PRAGMA journal_mode = WAL");
|
||||||
|
|
||||||
$dbo->exec("CREATE TABLE _skim (
|
$dbo->exec("CREATE TABLE _skim (
|
||||||
@@ -305,6 +322,7 @@ $dbo->exec("CREATE TABLE files (
|
|||||||
thumb_height INTEGER,
|
thumb_height INTEGER,
|
||||||
thumb_tool TEXT,
|
thumb_tool TEXT,
|
||||||
icon_filename TEXT,
|
icon_filename TEXT,
|
||||||
|
icon_tool TEXT,
|
||||||
contents_filename TEXT
|
contents_filename TEXT
|
||||||
)");
|
)");
|
||||||
|
|
||||||
@@ -396,20 +414,6 @@ if (!$passed_total) {
|
|||||||
|
|
||||||
echo msg("Total files: ".$passed_total."");
|
echo msg("Total files: ".$passed_total."");
|
||||||
|
|
||||||
// Pool DB
|
|
||||||
//////////////////////////////////////////
|
|
||||||
|
|
||||||
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
|
|
||||||
|
|
||||||
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
|
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS md5 (fid TEXT, hash TEXT)");
|
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS exiftool (fid TEXT, tags TEXT)");
|
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS mediainfo (fid TEXT, info TEXT)");
|
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS thumbs (fid TEXT, created INTEGER, relative_path TEXT, width INTEGER, height INTEGER, tool TEXT)");
|
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS icons (fid TEXT, hash TEXT, created INTEGER, relative_path TEXT, tool TEXT)");
|
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS contents (fid TEXT, created INTEGER, relative_path TEXT)");
|
|
||||||
|
|
||||||
// Prescan
|
// Prescan
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@@ -417,8 +421,8 @@ $i = 0;
|
|||||||
$family = array();
|
$family = array();
|
||||||
$fids = array();
|
$fids = array();
|
||||||
$noread = array();
|
$noread = array();
|
||||||
$fx = new SplFixedArray($passed_file);
|
|
||||||
$splcount = 0;
|
$splcount = 0;
|
||||||
|
$bline = array();
|
||||||
|
|
||||||
echo ProgressBar::start($passed_total,"Prescan (".stepString().")");
|
echo ProgressBar::start($passed_total,"Prescan (".stepString().")");
|
||||||
|
|
||||||
@@ -429,14 +433,15 @@ foreach ($files as $splFileInfo) {
|
|||||||
$shellpath = escapeshellarg($splFileInfo->getPathname());
|
$shellpath = escapeshellarg($splFileInfo->getPathname());
|
||||||
$realpath = $splFileInfo->getRealPath();
|
$realpath = $splFileInfo->getRealPath();
|
||||||
|
|
||||||
$key = md5($pathname);
|
$pid = md5($pathname);
|
||||||
$pkey = md5($path);
|
$pkey = md5($path);
|
||||||
|
$fid = null;
|
||||||
|
|
||||||
if (array_key_exists($key, $family)) {
|
if (array_key_exists($pid, $family)) {
|
||||||
echo msg("Duplicate key on ".$pathname.""); die;
|
echo msg("Duplicate key on ".$pathname.""); die;
|
||||||
}
|
}
|
||||||
|
|
||||||
$family[$key] = array();
|
$family[$pid] = array();
|
||||||
|
|
||||||
// Path-agnostic Unique File ID (to prevent redundant hashes and thumbs)
|
// Path-agnostic Unique File ID (to prevent redundant hashes and thumbs)
|
||||||
|
|
||||||
@@ -444,8 +449,7 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
$fid = md5($splFileInfo->getSize().$splFileInfo->getMtime().$splFileInfo->getBasename());
|
$fid = md5($splFileInfo->getSize().$splFileInfo->getMtime().$splFileInfo->getBasename());
|
||||||
$dx[$fid][] = $pathname;
|
$dx[$fid][] = $pathname;
|
||||||
$fx[$splcount] = array($fid, $pathname);
|
$family[$pid]['fid'] = $fid;
|
||||||
$family[$key]['fid'] = $fid;
|
|
||||||
$splcount++;
|
$splcount++;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -469,6 +473,27 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create batch
|
||||||
|
|
||||||
|
if ($p['thumbs'] || $p['icons'] || $p['meta'] || $p['hash'] || $p['contents'] || $p['spotlight']) {
|
||||||
|
|
||||||
|
$parts = array();
|
||||||
|
$parts[] = $bin_php;
|
||||||
|
$parts[] = escapeshellarg(realpath("helper.php"));
|
||||||
|
$parts[] = $i;
|
||||||
|
$parts[] = $passed_total;
|
||||||
|
$parts[] = $fid ?: $pid;
|
||||||
|
$parts[] = escapeshellarg($pathname);
|
||||||
|
$parts[] = $splFileInfo->getType();
|
||||||
|
$parts[] = escapeshellarg($bpath);
|
||||||
|
$parts[] = $mytime;
|
||||||
|
$parts[] = $p['spotlight'];
|
||||||
|
|
||||||
|
$tcmd = implode(" ",$parts);
|
||||||
|
$bline[] = $tcmd;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Check file can be read
|
// Check file can be read
|
||||||
|
|
||||||
if ($realpath && !is_readable($realpath)) {
|
if ($realpath && !is_readable($realpath)) {
|
||||||
@@ -477,7 +502,6 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
// Children
|
// Children
|
||||||
|
|
||||||
//$family[$pkey]['children'][] = $key;
|
|
||||||
$family[$pkey]['children'][] = $i+1;
|
$family[$pkey]['children'][] = $i+1;
|
||||||
|
|
||||||
echo ProgressBar::next(true);
|
echo ProgressBar::next(true);
|
||||||
@@ -485,6 +509,12 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$batchfile = $tmpdir."/batch.sh";
|
||||||
|
if (!empty($bline)) {
|
||||||
|
file_put_contents($batchfile,implode("\n", $bline));
|
||||||
|
msg("Writing batch to file");
|
||||||
|
}
|
||||||
|
|
||||||
echo ProgressBar::finish($wopt_clear);
|
echo ProgressBar::finish($wopt_clear);
|
||||||
|
|
||||||
// Thow permissions error
|
// Thow permissions error
|
||||||
@@ -561,46 +591,43 @@ $dbo->exec($stmt);
|
|||||||
|
|
||||||
$wopt_currstep++;
|
$wopt_currstep++;
|
||||||
|
|
||||||
// Directory Previews
|
// Init Spotlight DB
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
echo ProgressBar::start(count($fx),"Searching for directory previews (".stepString().")");
|
if ($p['spotlight']) { $dbo->exec("CREATE TABLE mdls (id INTEGER PRIMARY KEY,".implode(",",$cbuild).")"); }
|
||||||
foreach ($fx as $array) {
|
|
||||||
$fid = $array[0];
|
// Pool DB
|
||||||
$pathname = $array[1];
|
//////////////////////////////////////////
|
||||||
if (in_array(basename($pathname),$p['p_files'])) {
|
|
||||||
$dpreview[dirname($pathname)] = $fid;
|
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
|
||||||
}
|
|
||||||
echo ProgressBar::next();
|
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
}
|
|
||||||
echo ProgressBar::finish($wopt_clear);
|
$dbp->query("PRAGMA page_size = 4096");
|
||||||
|
$dbp->query("PRAGMA cache_size = 10000");
|
||||||
|
$dbp->query("PRAGMA synchronous = NORMAL");
|
||||||
|
$dbp->query("PRAGMA locking_mode = NORMAL");
|
||||||
|
$dbp->query("PRAGMA journal_mode = WAL");
|
||||||
|
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS md5 (fid TEXT, hash TEXT)");
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS exiftool (fid TEXT, tags TEXT)");
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS mediainfo (fid TEXT, info TEXT)");
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS thumbs (fid TEXT, created INTEGER, relative_path TEXT, width INTEGER, height INTEGER, tool TEXT)");
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS icons (fid TEXT, hash TEXT, created INTEGER, relative_path TEXT, tool TEXT)");
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS contents (fid TEXT, created INTEGER, relative_path TEXT)");
|
||||||
|
|
||||||
// Helper
|
// Helper
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
if ($p['thumbs'] || $p['icons'] || $p['meta'] || $p['hash'] || $p['contents']) {
|
if (file_exists($batchfile)) {
|
||||||
|
|
||||||
echo ProgressBar::start($passed_file,"Creating batch (".stepString().")",1);
|
|
||||||
|
|
||||||
$batchfile = $tmpdir."/_batch.sh";
|
|
||||||
$helper = realpath("helper.php");
|
|
||||||
|
|
||||||
foreach ($fx as $count => $array) {
|
|
||||||
$fid = $array[0];
|
|
||||||
$pathname = $array[1];
|
|
||||||
$tcmd = $bin_php." ".escapeshellarg($helper)." ".$fid." ".escapeshellarg($pathname)." ".escapeshellarg($bpath)." ".$mytime."; printf '\\n".ProgressBar::next()."'";
|
|
||||||
msg($tcmd);
|
|
||||||
$line[] = $tcmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
file_put_contents($batchfile,implode("\n", $line));
|
|
||||||
echo ProgressBar::finish($wopt_clear);
|
|
||||||
|
|
||||||
echo ProgressBar::start($passed_file,"Running batch (".stepString().")");
|
echo ProgressBar::start($passed_file,"Running batch (".stepString().")");
|
||||||
if ($p['parallel']) {
|
if ($p['parallel'] === 0) {
|
||||||
|
passthru("bash ".$batchfile);
|
||||||
|
} elseif ($p['parallel'] === 1) {
|
||||||
passthru($bin_parallel." < ".$batchfile);
|
passthru($bin_parallel." < ".$batchfile);
|
||||||
} else {
|
} else {
|
||||||
passthru("bash ".$batchfile);
|
passthru($bin_parallel." -j ".$p['parallel']." < ".$batchfile);
|
||||||
}
|
}
|
||||||
echo ProgressBar::finish($wopt_clear);
|
echo ProgressBar::finish($wopt_clear);
|
||||||
|
|
||||||
@@ -618,102 +645,6 @@ $dbp->exec("CREATE INDEX IF NOT EXISTS mediainfo_index ON mediainfo (fid)");
|
|||||||
$dbp->exec("CREATE INDEX IF NOT EXISTS thumbs_index ON thumbs (fid)");
|
$dbp->exec("CREATE INDEX IF NOT EXISTS thumbs_index ON thumbs (fid)");
|
||||||
$dbp->exec("CREATE INDEX IF NOT EXISTS icons_index ON icons (fid)");
|
$dbp->exec("CREATE INDEX IF NOT EXISTS icons_index ON icons (fid)");
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($p['spotlight']) {
|
|
||||||
|
|
||||||
echo ProgressBar::start($passed_total,"Spotlight (".stepString().")");
|
|
||||||
|
|
||||||
$dbo->exec("CREATE TABLE mdls (".implode(",",$cbuild).")");
|
|
||||||
|
|
||||||
foreach ($files as $splFileInfo) {
|
|
||||||
|
|
||||||
$path = $splFileInfo->getPathname();
|
|
||||||
msg($path);
|
|
||||||
|
|
||||||
$pid = md5($path);
|
|
||||||
$shellpath = escapeshellarg($path);
|
|
||||||
$mdls = shell_exec("mdls -plist - ".$shellpath." 2>&1");
|
|
||||||
|
|
||||||
if (substr_count(@$mdls,"\n") > 1) {
|
|
||||||
$spotlight = $parser->parseString(utf8_for_xml($mdls));
|
|
||||||
} else {
|
|
||||||
$spotlight = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = $dbo->prepare("INSERT INTO mdls VALUES (".implode(",",$ibuild).")");
|
|
||||||
|
|
||||||
foreach ($mb as $key => $list) {
|
|
||||||
foreach ($list as $item) {
|
|
||||||
|
|
||||||
if (@$spotlight["kMDItem".$item]) {
|
|
||||||
$stmt->BindValue(":pid",$pid);
|
|
||||||
$stmt->BindValue(":spotlight",$mdls);
|
|
||||||
switch($key) {
|
|
||||||
case "i":
|
|
||||||
case "t":
|
|
||||||
$stmt->BindValue(":".$item,$spotlight["kMDItem".$item]);
|
|
||||||
break;
|
|
||||||
case "a":
|
|
||||||
$stmt->BindValue(":".$item,serialize($spotlight["kMDItem".$item]));
|
|
||||||
break;
|
|
||||||
case "d":
|
|
||||||
$stmt->BindValue(":".$item,strtotime($spotlight["kMDItem".$item]));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->execute();
|
|
||||||
echo ProgressBar::next(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
echo ProgressBar::finish($wopt_clear);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Files
|
// Files
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@@ -725,7 +656,7 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
// DB
|
// DB
|
||||||
|
|
||||||
$stmt = $dbo->prepare("INSERT INTO files VALUES (:pid, :fid, :Pathname, :Path, :Filename, :Extension, :Type, :Size, :Inode, :Perms, :Owner, :ATime, :MTime, :CTime, :LinkTarget, :RealPath, :stat, :items, :newest, :fkind, :gfi_type, :gfi_attr, :gfi_created, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :thumb_tool, :icon_filename, :contents_filename)");
|
$stmt = $dbo->prepare("INSERT INTO files VALUES (:pid, :fid, :Pathname, :Path, :Filename, :Extension, :Type, :Size, :Inode, :Perms, :Owner, :ATime, :MTime, :CTime, :LinkTarget, :RealPath, :stat, :items, :newest, :fkind, :gfi_type, :gfi_attr, :gfi_created, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :thumb_tool, :icon_filename, :icon_tool, :contents_filename)");
|
||||||
|
|
||||||
// Identify dir, file, link or bundle dir
|
// Identify dir, file, link or bundle dir
|
||||||
|
|
||||||
@@ -852,7 +783,13 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
if ($type == "file") {
|
if ($type == "file") {
|
||||||
|
|
||||||
unset($fetch_exif, $fetch_media, $fetch_hash, $fetch_thumb, $yes_exif, $yes_media, $yes_hash);
|
$fetch_icon = @$dbp->query("SELECT * FROM icons WHERE fid='".$fid."'")->fetch();
|
||||||
|
if (@$fetch_icon['relative_path']) {
|
||||||
|
$stmt->BindValue(":icon_filename",$fetch_icon['relative_path']);
|
||||||
|
$stmt->BindValue(":icon_tool",$fetch_icon['tool']);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($fetch_exif, $fetch_media, $fetch_hash, $fetch_thumb, $fetch_icon, $yes_exif, $yes_media, $yes_hash);
|
||||||
|
|
||||||
$yes_exif = $dbp->query("SELECT rowid FROM exiftool WHERE fid='".$fid."'")->fetch()[0];
|
$yes_exif = $dbp->query("SELECT rowid FROM exiftool WHERE fid='".$fid."'")->fetch()[0];
|
||||||
$stmt->BindValue(":has_exif",$yes_exif);
|
$stmt->BindValue(":has_exif",$yes_exif);
|
||||||
@@ -866,9 +803,8 @@ foreach ($files as $splFileInfo) {
|
|||||||
$yes_contents = $dbp->query("SELECT relative_path FROM contents WHERE fid='".$fid."'")->fetch()[0];
|
$yes_contents = $dbp->query("SELECT relative_path FROM contents WHERE fid='".$fid."'")->fetch()[0];
|
||||||
$stmt->BindValue(":contents_filename",$yes_contents);
|
$stmt->BindValue(":contents_filename",$yes_contents);
|
||||||
|
|
||||||
if (!in_array($extension, $p['t_skip'])) {
|
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$fid."'")->fetch();
|
||||||
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$fid."'")->fetch();
|
|
||||||
}
|
|
||||||
if (@$fetch_thumb['relative_path']) {
|
if (@$fetch_thumb['relative_path']) {
|
||||||
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
|
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
|
||||||
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
||||||
@@ -878,30 +814,29 @@ foreach ($files as $splFileInfo) {
|
|||||||
$stmt->BindValue(":thumb_filename",null);
|
$stmt->BindValue(":thumb_filename",null);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fetch_icon = $dbp->query("SELECT * FROM icons WHERE fid='".$fid."'")->fetch();
|
} else {
|
||||||
|
|
||||||
|
unset($fetch_icon, $fetch_thumb);
|
||||||
|
|
||||||
|
$fetch_icon = @$dbp->query("SELECT * FROM icons WHERE fid='".$pid."'")->fetch();
|
||||||
if (@$fetch_icon['relative_path']) {
|
if (@$fetch_icon['relative_path']) {
|
||||||
$stmt->BindValue(":icon_filename",$fetch_icon['relative_path']);
|
$stmt->BindValue(":icon_filename",$fetch_icon['relative_path']);
|
||||||
} else {
|
$stmt->BindValue(":icon_tool",$fetch_icon['tool']);
|
||||||
$stmt->BindValue(":icon_filename",null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($type == "dir") {
|
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$pid."'")->fetch();
|
||||||
|
|
||||||
if (@is_array($dpreview) && $dpreview[$pathname]) {
|
if (@$fetch_thumb['relative_path']) {
|
||||||
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$dpreview[$pathname]."'")->fetch();
|
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
|
||||||
if (@$fetch_thumb['relative_path']) {
|
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
||||||
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
|
$stmt->BindValue(":thumb_height",$fetch_thumb['height']);
|
||||||
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
$stmt->BindValue(":thumb_tool",$fetch_thumb['tool']);
|
||||||
$stmt->BindValue(":thumb_height",$fetch_thumb['height']);
|
} else {
|
||||||
$stmt->BindValue(":thumb_tool",$fetch_thumb['tool']);
|
$stmt->BindValue(":thumb_filename",null);
|
||||||
} else {
|
|
||||||
$stmt->BindValue(":thumb_filename",null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------ //
|
// ------------------------------------------------ //
|
||||||
|
|
||||||
// Write to DB
|
// Write to DB
|
||||||
@@ -1036,9 +971,11 @@ while ($row_a = $loop->fetch()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$m['m']['SkimTrackCount'] = @count($m_base);
|
$m['m']['SkimTrackCount'] = @count($m_base);
|
||||||
foreach (@$m_base as $track) {
|
if (is_array($m_base)) {
|
||||||
if (!@$m['m']['SkimDims'] && @$track['Width'] && @$track['Height']) {
|
foreach (@$m_base as $track) {
|
||||||
$m['m']['SkimDims'] = @sanitize($track['Width'],"i").$display_delimiter.@sanitize($track['Height'],"i");
|
if (!@$m['m']['SkimDims'] && @$track['Width'] && @$track['Height']) {
|
||||||
|
$m['m']['SkimDims'] = @sanitize($track['Width'],"i").$display_delimiter.@sanitize($track['Height'],"i");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,7 +1014,7 @@ while ($row_a = $loop->fetch()) {
|
|||||||
} elseif (!$found) {
|
} elseif (!$found) {
|
||||||
|
|
||||||
// find a single value
|
// find a single value
|
||||||
list($kind,$item) = explode("^",$dindex);
|
list($kind,$item) = @explode("^",$dindex);
|
||||||
if (@$m[$kind][$item]) {
|
if (@$m[$kind][$item]) {
|
||||||
$stmt->BindValue(":".$name,@sanitize($m[$kind][$item],$type));
|
$stmt->BindValue(":".$name,@sanitize($m[$kind][$item],$type));
|
||||||
$found = 1;
|
$found = 1;
|
||||||
@@ -1108,7 +1045,10 @@ $dbo->exec("UPDATE _skim SET status='completed_in_".$seconds."'");
|
|||||||
|
|
||||||
// rsync
|
// rsync
|
||||||
|
|
||||||
if ($p['postflight'] == 2 && $p['rsync_dest']) {
|
if ($p['postflight'] == 3) {
|
||||||
|
$url = "http://localhost/rtc.php?db=data/".basename($bpath)."/".$stamp.".sqlite3";
|
||||||
|
exec("open ".$url);
|
||||||
|
} elseif ($p['postflight'] == 2 && $p['rsync_dest']) {
|
||||||
echo msg("rsync...");
|
echo msg("rsync...");
|
||||||
$command = "rsync -avv -e ssh ".$bpath." ".$p['rsync_dest'];
|
$command = "rsync -avv -e ssh ".$bpath." ".$p['rsync_dest'];
|
||||||
$count = trim(shell_exec("find ".escapeshellarg($bpath)." | wc -l"));
|
$count = trim(shell_exec("find ".escapeshellarg($bpath)." | wc -l"));
|
||||||
@@ -1125,6 +1065,6 @@ $done = "Finished ".$zpath." in ".$seconds." seconds";
|
|||||||
$done_m = "Memory usage: ".prettysize(memory_get_usage(true));
|
$done_m = "Memory usage: ".prettysize(memory_get_usage(true));
|
||||||
echo msg($done."\n".$done_m); notification($done);
|
echo msg($done."\n".$done_m); notification($done);
|
||||||
|
|
||||||
unset($dbo, $dbp, $files, $family, $fx);
|
unset($dbo, $dbp, $files, $family);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -6,32 +6,29 @@
|
|||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
|
||||||
function makeWindowString($p, $strings) {
|
function makeWindowString($p, $strings, $pstrings) {
|
||||||
|
|
||||||
$conf = "
|
$conf = "
|
||||||
# Set window title
|
# Set window title
|
||||||
*.title = Preferences
|
*.title = Preferences
|
||||||
*.floating = 1
|
*.floating = 1
|
||||||
|
|
||||||
parallel.type = checkbox
|
|
||||||
parallel.label = Execute shell commands in parallel
|
|
||||||
parallel.default = ".$p['parallel']."
|
|
||||||
|
|
||||||
debug.type = checkbox
|
|
||||||
debug.label = Enable verbose logging
|
|
||||||
debug.default = ".$p['debug']."
|
|
||||||
|
|
||||||
bdest.type = openbrowser
|
bdest.type = openbrowser
|
||||||
bdest.filetype = directory
|
bdest.filetype = directory
|
||||||
bdest.label = Destination
|
bdest.label = Destination
|
||||||
bdest.default = ".$p['bdest']."
|
bdest.default = ".$p['bdest']."
|
||||||
bdest.width = 380
|
bdest.width = 380
|
||||||
|
|
||||||
|
reuse.type = checkbox
|
||||||
|
reuse.label = Add to existing catalogs
|
||||||
|
reuse.default = ".$p['reuse']."
|
||||||
|
|
||||||
postflight.type = popup
|
postflight.type = popup
|
||||||
postflight.label = When finished
|
postflight.label = When finished
|
||||||
postflight.option = ".$strings[0][0]."
|
postflight.option = ".$strings[0][0]."
|
||||||
postflight.option = ".$strings[0][1]."
|
postflight.option = ".$strings[0][1]."
|
||||||
postflight.option = ".$strings[0][2]."
|
postflight.option = ".$strings[0][2]."
|
||||||
|
postflight.option = ".$strings[0][3]."
|
||||||
postflight.default = ".$strings[0][$p['postflight']]."
|
postflight.default = ".$strings[0][$p['postflight']]."
|
||||||
postflight.width = 380
|
postflight.width = 380
|
||||||
|
|
||||||
@@ -41,6 +38,28 @@ function makeWindowString($p, $strings) {
|
|||||||
rsync_dest.placeholder = user@server.com:files/
|
rsync_dest.placeholder = user@server.com:files/
|
||||||
rsync_dest.width = 380
|
rsync_dest.width = 380
|
||||||
|
|
||||||
|
hr0.type = image
|
||||||
|
hr0.path = ".__DIR__."/hr.png"."
|
||||||
|
hr0.width = 380
|
||||||
|
hr0.height = 2
|
||||||
|
|
||||||
|
parallel.type = popup
|
||||||
|
parallel.width = 180
|
||||||
|
parallel.default = ".$pstrings[$p['parallel']]."
|
||||||
|
";
|
||||||
|
|
||||||
|
foreach ($pstrings as $pstring) {
|
||||||
|
$conf .= "parallel.option = ".$pstring."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$conf .= "
|
||||||
|
|
||||||
|
debug.type = checkbox
|
||||||
|
debug.label = Verbose logging
|
||||||
|
debug.default = ".$p['debug']."
|
||||||
|
debug.x = 200
|
||||||
|
debug.y = 443
|
||||||
|
|
||||||
hr1.type = image
|
hr1.type = image
|
||||||
hr1.path = ".__DIR__."/hr.png"."
|
hr1.path = ".__DIR__."/hr.png"."
|
||||||
hr1.width = 380
|
hr1.width = 380
|
||||||
@@ -79,15 +98,14 @@ function makeWindowString($p, $strings) {
|
|||||||
thumbs.default = ".$strings[2][$p['thumbs']]."
|
thumbs.default = ".$strings[2][$p['thumbs']]."
|
||||||
thumbs.width = 120
|
thumbs.width = 120
|
||||||
|
|
||||||
thumb_priority.type = popup
|
thumb_mode.type = popup
|
||||||
thumb_priority.label = Priority
|
thumb_mode.label = Mode
|
||||||
thumb_priority.option = ".$strings[3][0]."
|
thumb_mode.option = ".$strings[3][0]."
|
||||||
thumb_priority.option = ".$strings[3][1]."
|
thumb_mode.option = ".$strings[3][1]."
|
||||||
thumb_priority.option = ".$strings[3][2]."
|
thumb_mode.default = ".$strings[3][$p['thumb_mode']]."
|
||||||
thumb_priority.default = ".$strings[3][$p['thumb_priority']]."
|
thumb_mode.width = 120
|
||||||
thumb_priority.width = 120
|
thumb_mode.x = 150
|
||||||
thumb_priority.x = 150
|
thumb_mode.y = 227
|
||||||
thumb_priority.y = 227
|
|
||||||
|
|
||||||
thumb_size.type = textfield
|
thumb_size.type = textfield
|
||||||
thumb_size.default = ".$p['thumb_size']."
|
thumb_size.default = ".$p['thumb_size']."
|
||||||
@@ -105,14 +123,15 @@ function makeWindowString($p, $strings) {
|
|||||||
icons.default = ".$strings[2][$p['icons']]."
|
icons.default = ".$strings[2][$p['icons']]."
|
||||||
icons.width = 120
|
icons.width = 120
|
||||||
|
|
||||||
icon_tool.type = popup
|
icon_mode.type = popup
|
||||||
icon_tool.label = Tool
|
icon_mode.label = Mode
|
||||||
icon_tool.option = ".$strings[4][0]."
|
icon_mode.option = ".$strings[4][0]."
|
||||||
icon_tool.option = ".$strings[4][1]."
|
icon_mode.option = ".$strings[4][1]."
|
||||||
icon_tool.default = ".$strings[4][$p['icon_tool']]."
|
icon_mode.option = ".$strings[4][2]."
|
||||||
icon_tool.width = 120
|
icon_mode.default = ".$strings[4][$p['icon_mode']]."
|
||||||
icon_tool.x = 150
|
icon_mode.width = 120
|
||||||
icon_tool.y = 162
|
icon_mode.x = 150
|
||||||
|
icon_mode.y = 162
|
||||||
|
|
||||||
icon_size.type = textfield
|
icon_size.type = textfield
|
||||||
icon_size.default = ".$p['icon_size']."
|
icon_size.default = ".$p['icon_size']."
|
||||||
@@ -198,16 +217,25 @@ if(!$p['bdest']) {
|
|||||||
|
|
||||||
// Load strings
|
// Load strings
|
||||||
|
|
||||||
$strings[] = array("Do nothing","Reveal result in Finder","Upload result with rsync");
|
$strings[] = array("Do nothing","Reveal result in Finder","Upload result with rsync","Open via localhost URL");
|
||||||
$strings[] = array("Skip","Collect","Collect & verify","Collect & repair atimes");
|
$strings[] = array("Skip","Collect","Collect & verify","Collect & repair atimes");
|
||||||
$strings[] = array("Skip","Generate","Rebuild");
|
$strings[] = array("Skip","Generate","Rebuild");
|
||||||
$strings[] = array("external","ql-thumbnail","qlmanage");
|
$strings[] = array("Most files","Some files");
|
||||||
$strings[] = array("qltool","qlmanage");
|
$strings[] = array("All files","Most files","Some files");
|
||||||
|
|
||||||
|
// Parallel strings
|
||||||
|
|
||||||
|
$physicalcpu = trim(shell_exec("sysctl -n hw.physicalcpu"));
|
||||||
|
|
||||||
|
$pstrings = array("Sequential","Max (Not advised)");
|
||||||
|
foreach(range(2, $physicalcpu-1) as $index) {
|
||||||
|
$pstrings[] = $index." Cores";
|
||||||
|
}
|
||||||
|
|
||||||
// Launch Pashua and parse results
|
// Launch Pashua and parse results
|
||||||
|
|
||||||
$path = __DIR__."/bin/Pashua.app/Contents/MacOS/Pashua";
|
$path = __DIR__."/bin/Pashua.app/Contents/MacOS/Pashua";
|
||||||
$raw = shell_exec("echo ".escapeshellarg(makeWindowString($p, $strings))." | ".escapeshellarg($path)." - ");
|
$raw = shell_exec("echo ".escapeshellarg(makeWindowString($p, $strings, $pstrings))." | ".escapeshellarg($path)." - ");
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach (explode("\n", $raw) as $line) {
|
foreach (explode("\n", $raw) as $line) {
|
||||||
preg_match('/^(\w+)=(.*)$/', $line, $matches);
|
preg_match('/^(\w+)=(.*)$/', $line, $matches);
|
||||||
@@ -229,9 +257,10 @@ if (@$result['cb']) {
|
|||||||
$result['postflight'] = array_search($result['postflight'],$strings[0]);
|
$result['postflight'] = array_search($result['postflight'],$strings[0]);
|
||||||
$result['stat_mode'] = array_search($result['stat_mode'],$strings[1]);
|
$result['stat_mode'] = array_search($result['stat_mode'],$strings[1]);
|
||||||
$result['thumbs'] = array_search($result['thumbs'],$strings[2]);
|
$result['thumbs'] = array_search($result['thumbs'],$strings[2]);
|
||||||
$result['thumb_priority'] = array_search($result['thumb_priority'],$strings[3]);
|
$result['thumb_mode'] = array_search($result['thumb_mode'],$strings[3]);
|
||||||
$result['icons'] = array_search($result['icons'],$strings[2]);
|
$result['icons'] = array_search($result['icons'],$strings[2]);
|
||||||
$result['icon_tool'] = array_search($result['icon_tool'],$strings[4]);
|
$result['icon_mode'] = array_search($result['icon_mode'],$strings[4]);
|
||||||
|
$result['parallel'] = array_search($result['parallel'],$pstrings);
|
||||||
|
|
||||||
// If the user didn't specify a destpath, set to default
|
// If the user didn't specify a destpath, set to default
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0.7.13.2
|
0.8.1.0
|
||||||
180
filetypes.php
@@ -9,16 +9,20 @@ $bin_mediainfo = escapeshellarg(__DIR__."/bin/mediainfo");
|
|||||||
$bin_exiftool = escapeshellarg(__DIR__."/bin/exiftool");
|
$bin_exiftool = escapeshellarg(__DIR__."/bin/exiftool");
|
||||||
$bin_ffmpeg = escapeshellarg(__DIR__."/bin/ffmpeg");
|
$bin_ffmpeg = escapeshellarg(__DIR__."/bin/ffmpeg");
|
||||||
$bin_qlthumb = escapeshellarg(__DIR__."/bin/ql-thumbnail");
|
$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_qltool = escapeshellarg(__DIR__."/bin/qltool");
|
||||||
$bin_sox = escapeshellarg(__DIR__."/bin/sox");
|
$bin_sox = escapeshellarg(__DIR__."/bin/sox");
|
||||||
$bin_pngcrush = escapeshellarg(__DIR__."/bin/pngcrush");
|
$bin_pngquant = escapeshellarg(__DIR__."/bin/pngquant");
|
||||||
$bin_parallel = escapeshellarg(__DIR__."/bin/parallel");
|
$bin_parallel = escapeshellarg(__DIR__."/bin/parallel");
|
||||||
$bin_convert = escapeshellarg(__DIR__."/bin/convert");
|
$bin_convert = escapeshellarg(__DIR__."/bin/convert");
|
||||||
|
$bin_flacicon = escapeshellarg(__DIR__."/bin/flacicon");
|
||||||
|
$bin_flacdiricon = escapeshellarg(__DIR__."/bin/flacdiricon");
|
||||||
|
|
||||||
// System tools
|
// System tools
|
||||||
$bin_php = "php";
|
$bin_php = "/usr/bin/php";
|
||||||
$bin_qlmanage = "qlmanage";
|
$bin_qlmanage = "/usr/bin/qlmanage";
|
||||||
$bin_sips = "sips";
|
$bin_sips = "/usr/bin/sips";
|
||||||
|
|
||||||
// External tools
|
// External tools
|
||||||
$bin_vips = "/opt/local/bin/vipsthumbnail";
|
$bin_vips = "/opt/local/bin/vipsthumbnail";
|
||||||
@@ -35,7 +39,9 @@ $p['bundles'] = array( "app",
|
|||||||
"framework",
|
"framework",
|
||||||
"plugin",
|
"plugin",
|
||||||
"kext",
|
"kext",
|
||||||
"rtfd"
|
"rtfd",
|
||||||
|
"qlgenerator",
|
||||||
|
"workflow"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Completely ignore these files
|
// Completely ignore these files
|
||||||
@@ -73,53 +79,67 @@ $p['c_files'] = array( "DS_Store",
|
|||||||
"doc",
|
"doc",
|
||||||
"docx" );
|
"docx" );
|
||||||
|
|
||||||
// thumbnail bindings
|
// Thumbnail bindings
|
||||||
$p['t_f']['pdf'][] = "jpg";
|
|
||||||
$p['t_f']['pdf'][] = array("gs","qlmanage","sips","vips");
|
|
||||||
|
|
||||||
// Use ffmpeg to generate thumbnails for these files
|
$p['t_b']['mkv'] = array("ql-thumbnail","ffmpeg");
|
||||||
$p['t_files']['ffmpeg'] = array( "mkv",
|
$p['t_b']['avi'] = array("ql-thumbnail","ffmpeg");
|
||||||
"avi",
|
$p['t_b']['mpeg'] = array("ql-thumbnail","ffmpeg");
|
||||||
"mpeg",
|
$p['t_b']['mpg'] = array("ql-thumbnail","ffmpeg");
|
||||||
"mpg",
|
$p['t_b']['vob'] = array("ql-thumbnail","ffmpeg");
|
||||||
"vob",
|
$p['t_b']['mp4'] = array("ql-thumbnail","ffmpeg");
|
||||||
"mp4",
|
$p['t_b']['m4v'] = array("ql-thumbnail","ffmpeg");
|
||||||
"m4v",
|
$p['t_b']['m2v'] = array("ql-thumbnail","ffmpeg");
|
||||||
"m2v",
|
$p['t_b']['m2ts'] = array("ql-thumbnail","ffmpeg");
|
||||||
"m2ts",
|
$p['t_b']['asf'] = array("ql-thumbnail","ffmpeg");
|
||||||
"asf",
|
$p['t_b']['wmv'] = array("ql-thumbnail","ffmpeg");
|
||||||
"wmv",
|
$p['t_b']['rm'] = array("ql-thumbnail","ffmpeg");
|
||||||
"rm",
|
$p['t_b']['divx'] = array("ql-thumbnail","ffmpeg");
|
||||||
"divx",
|
$p['t_b']['fla'] = array("ql-thumbnail","ffmpeg");
|
||||||
"fla",
|
$p['t_b']['flv'] = array("ql-thumbnail","ffmpeg");
|
||||||
"flv",
|
$p['t_b']['webm'] = array("ql-thumbnail","ffmpeg");
|
||||||
"webm" );
|
|
||||||
|
|
||||||
// Use sips to generate thumbnails for these files
|
// sips provides a minor speed improvement but also scales small images up
|
||||||
$p['t_files']['sips'] = array( "jpg",
|
//$p['t_b']['jpg'] = array("sips","ql-thumbnail","vips");
|
||||||
"jpeg",
|
//$p['t_b']['jpeg'] = array("sips","ql-thumbnail","vips");
|
||||||
"tif",
|
//$p['t_b']['png'] = array("sips","ql-thumbnail","vips");
|
||||||
"tiff",
|
$p['t_b']['jpg'] = array("ql-thumbnail","sips","vips");
|
||||||
"gif",
|
$p['t_b']['jpeg'] = array("ql-thumbnail","sips","vips");
|
||||||
"psd",
|
$p['t_b']['png'] = array("ql-thumbnail","sips","vips");
|
||||||
"png",
|
|
||||||
"heic",
|
|
||||||
"pdf",
|
|
||||||
"ai",
|
|
||||||
"ps",
|
|
||||||
"bmp",
|
|
||||||
"pict",
|
|
||||||
"jp2" );
|
|
||||||
|
|
||||||
// Use sox to generate thumbnails for these files
|
$p['t_b']['tif'] = array("vips","sips","ql-thumbnail");
|
||||||
$p['t_files']['sox'] = array( "flac",
|
$p['t_b']['tiff'] = array("vips","sips","ql-thumbnail");
|
||||||
"wav",
|
|
||||||
"aif",
|
|
||||||
"aiff" );
|
|
||||||
|
|
||||||
// Don't make thumbnails for these files
|
$p['t_b']['nik'] = array("ql-thumbnail","sips","vips");
|
||||||
$p['t_skip'] = array( "emlx",
|
$p['t_b']['dng'] = array("ql-thumbnail","sips","vips");
|
||||||
"DS_Store" );
|
$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
|
// Don't make icons for these files
|
||||||
$p['i_skip'] = array( "jpg",
|
$p['i_skip'] = array( "jpg",
|
||||||
@@ -136,8 +156,15 @@ $p['i_skip'] = array( "jpg",
|
|||||||
"zip",
|
"zip",
|
||||||
"DS_Store" );
|
"DS_Store" );
|
||||||
|
|
||||||
// Custom qlgenerator bindings
|
// Make sox preview icons for these files
|
||||||
$p['i_bindings']['indd'] = array("com.adobe.indesign-document","Art View.qlgenerator");
|
$p['i_sox'] = array( "flac",
|
||||||
|
"wav",
|
||||||
|
"aif",
|
||||||
|
"aiff",
|
||||||
|
"au",
|
||||||
|
"wv",
|
||||||
|
"snd",
|
||||||
|
"voc" );
|
||||||
|
|
||||||
// Run mediainfo on these files
|
// Run mediainfo on these files
|
||||||
$p['m_files'] = array( "mkv",
|
$p['m_files'] = array( "mkv",
|
||||||
@@ -242,10 +269,57 @@ foreach ($p['bundles'] as $bundle) { $p['nodescend'][] = "*.".$bundle; }
|
|||||||
foreach ($p['c_files'] as $ext) { $p['c_files'][] = strtoupper($ext); }
|
foreach ($p['c_files'] as $ext) { $p['c_files'][] = strtoupper($ext); }
|
||||||
foreach ($p['e_files'] as $ext) { $p['e_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['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['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); }
|
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");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -76,6 +76,33 @@ class ProgressBar {
|
|||||||
// Functions
|
// Functions
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
function globext($array) {
|
||||||
|
$globparts = array();
|
||||||
|
foreach ($array as $ext) {
|
||||||
|
$globstring = "";
|
||||||
|
$parts = str_split($ext);
|
||||||
|
foreach ($parts as $char) {
|
||||||
|
$globstring .= "[".$char.strtoupper($char)."]";
|
||||||
|
}
|
||||||
|
$globparts[] = $globstring;
|
||||||
|
}
|
||||||
|
return "{".implode(",",$globparts)."}";
|
||||||
|
}
|
||||||
|
|
||||||
|
function globstring($array,$base = "*") {
|
||||||
|
if (!is_array($base)) {
|
||||||
|
return $base.".".globext($array);
|
||||||
|
} else {
|
||||||
|
$globparts = array();
|
||||||
|
foreach ($base as $file) {
|
||||||
|
$globparts[] = $file;
|
||||||
|
$globparts[] = strtoupper($file);
|
||||||
|
$globparts[] = ucfirst($file);
|
||||||
|
}
|
||||||
|
return "{".implode(",",$globparts)."}".".".globext($array);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function revise_prefs($array) { // bad practice
|
function revise_prefs($array) { // bad practice
|
||||||
$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Yuba.php";
|
$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Yuba.php";
|
||||||
$p = unserialize(file_get_contents($prefs_file));
|
$p = unserialize(file_get_contents($prefs_file));
|
||||||
@@ -102,11 +129,11 @@ function askMulti($string, $buttons) {
|
|||||||
return array_search($result,$buttons);
|
return array_search($result,$buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
function msg($string) {
|
function msg($string, $extra=true) {
|
||||||
global $messages_log_file;
|
global $messages_log_file;
|
||||||
$logstring = "[".date('Y-m-d h:i:s')."] ".$string."\n";
|
$logstring = "[".date('Y-m-d h:i:s')."] ".$string."\n";
|
||||||
file_put_contents($messages_log_file, $logstring, FILE_APPEND);
|
file_put_contents($messages_log_file, $logstring, FILE_APPEND);
|
||||||
file_put_contents("/tmp/yuba/debug.log", $logstring, FILE_APPEND);
|
if ($extra) { file_put_contents("/tmp/yuba/debug.log", $logstring, FILE_APPEND); }
|
||||||
return $string."\n";
|
return $string."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +209,7 @@ function shortlabel($pathname, $max = 99) {
|
|||||||
} else {
|
} else {
|
||||||
$return = $basename;
|
$return = $basename;
|
||||||
}
|
}
|
||||||
return $return;
|
return str_replace("\r","",$return); // filter out weird carriage returns in Icon filenames
|
||||||
}
|
}
|
||||||
|
|
||||||
function human_filesize($bytes, $decimals = 2) {
|
function human_filesize($bytes, $decimals = 2) {
|
||||||
|
|||||||
453
helper.php
@@ -4,6 +4,9 @@
|
|||||||
// //
|
// //
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
ini_set('memory_limit', '10240M');
|
||||||
|
date_default_timezone_set("America/Los_Angeles");
|
||||||
|
|
||||||
$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Yuba.php";
|
$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Yuba.php";
|
||||||
$p = unserialize(file_get_contents($prefs_file));
|
$p = unserialize(file_get_contents($prefs_file));
|
||||||
|
|
||||||
@@ -13,73 +16,105 @@ require("filetypes.php");
|
|||||||
$dm = "";
|
$dm = "";
|
||||||
function dfm ($string, $flag = 0) {
|
function dfm ($string, $flag = 0) {
|
||||||
// dumb workaround for debug messages appearing out of order
|
// dumb workaround for debug messages appearing out of order
|
||||||
|
// uncomment next line to revert to instant message printing
|
||||||
|
//dm($string); return;
|
||||||
|
|
||||||
global $dm;
|
global $dm;
|
||||||
if ($flag) {
|
if ($flag == 1) {
|
||||||
$dm .= str_repeat("-",33)."\n".$string."\n".str_repeat("-",33)."\n";
|
$dm .= str_repeat("-",33)."\n".$string."\n".str_repeat("-",33)."\n";
|
||||||
|
} elseif ($flag == 2) {
|
||||||
|
$dm .= str_repeat("-",66)."\n".$string."\n".str_repeat("-",66)."\n";
|
||||||
} else {
|
} else {
|
||||||
$dm .= "[".date('Y-m-d h:i:s')."] ".$string."\n";
|
$dm .= "[".date('Y-m-d h:i:s')."] ".$string."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fid = $argv[1];
|
$bdone = $argv[1];
|
||||||
$pathname = $argv[2];
|
$btotal = $argv[2];
|
||||||
|
$fid = $argv[3];
|
||||||
|
$pathname = $argv[4];
|
||||||
|
$pid = md5($pathname);
|
||||||
$shellpath = escapeshellarg($pathname);
|
$shellpath = escapeshellarg($pathname);
|
||||||
$ext = pathinfo($pathname,PATHINFO_EXTENSION);
|
$ext = pathinfo($pathname,PATHINFO_EXTENSION);
|
||||||
$bpath = $argv[3];
|
$extl = strtolower($ext);
|
||||||
$mytime = $argv[4];
|
$file = pathinfo($pathname, PATHINFO_BASENAME);
|
||||||
|
$btype = $argv[5];
|
||||||
|
$bpath = $argv[6];
|
||||||
|
$mytime = $argv[7];
|
||||||
|
|
||||||
|
$parser = new plistParser();
|
||||||
|
|
||||||
$stamp = date("Y-m-d_H-i-s", $mytime);
|
$stamp = date("Y-m-d_H-i-s", $mytime);
|
||||||
$messages_log_file = $bpath."/".$stamp."_messages.log";
|
$messages_log_file = $bpath."/".$stamp."_messages.log";
|
||||||
|
$error_log_file = $bpath."/".$stamp."_error.log";
|
||||||
|
|
||||||
|
if ($p['debug']) {
|
||||||
|
$redirect = "2>&1 | tee -a /tmp/yuba/debug.log";
|
||||||
|
} else {
|
||||||
|
$redirect = "2>> ".$error_log_file;
|
||||||
|
}
|
||||||
|
|
||||||
$tmpdir = "/tmp/yuba/".$mytime;
|
$tmpdir = "/tmp/yuba/".$mytime;
|
||||||
if (!is_dir($tmpdir)) { mkdir($tmpdir,0777,true); dfm("mkdir ",$tmpdir); }
|
if (!is_dir($tmpdir)) { mkdir($tmpdir,0777,true); dfm("mkdir ",$tmpdir); }
|
||||||
|
|
||||||
$file = pathinfo($pathname, PATHINFO_BASENAME);
|
// Main DB
|
||||||
$ext = pathinfo($pathname, PATHINFO_EXTENSION);
|
|
||||||
|
$dbo = new PDO("sqlite:".$bpath."/".$stamp.".sqlite3");
|
||||||
|
$dbo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$dbo->query("PRAGMA page_size = 4096");
|
||||||
|
$dbo->query("PRAGMA cache_size = 10000");
|
||||||
|
$dbo->query("PRAGMA synchronous = NORMAL");
|
||||||
|
$dbo->query("PRAGMA locking_mode = NORMAL");
|
||||||
|
$dbo->query("PRAGMA journal_mode = WAL");
|
||||||
|
|
||||||
|
// Pool DB
|
||||||
|
|
||||||
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
|
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
|
||||||
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$dbp->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
$dbp->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
//$dbp->query("PRAGMA page_size = 4096");
|
$dbp->query("PRAGMA page_size = 4096");
|
||||||
//$dbp->query("PRAGMA cache_size = 10000");
|
$dbp->query("PRAGMA cache_size = 10000");
|
||||||
//$dbp->query("PRAGMA locking_mode = EXCLUSIVE");
|
$dbp->query("PRAGMA synchronous = NORMAL");
|
||||||
//$dbp->query("PRAGMA synchronous = NORMAL");
|
$dbo->query("PRAGMA locking_mode = NORMAL");
|
||||||
$dbp->query("PRAGMA journal_mode = WAL");
|
$dbp->query("PRAGMA journal_mode = WAL");
|
||||||
|
|
||||||
$sbatch = array();
|
$sbatch = array();
|
||||||
|
|
||||||
$estring = "\nBATCH: ".basename($pathname);
|
$estring = "\n[BATCH] ".shortlabel(basename($pathname),20);
|
||||||
|
|
||||||
dfm("BATCH INIT ".$file.":".print_r($argv,true));
|
dfm("BATCH INIT ".$file.":".print_r($argv,true),2);
|
||||||
|
|
||||||
// Thumbs //////////////////////////////////////////
|
// Thumbs //////////////////////////////////////////
|
||||||
|
|
||||||
thumbs:
|
thumbs:
|
||||||
if ($p['thumbs']) {
|
if ($p['thumbs'] && $ext && $ext != "DS_Store") {
|
||||||
|
|
||||||
dfm("THUMBS",1);
|
dfm("THUMBS",1);
|
||||||
|
|
||||||
$estring .= " THUMBS";
|
$estring .= " THUMBS";
|
||||||
|
|
||||||
// "bad" filesizes
|
// "bad" filesizes from generic audio file icons
|
||||||
$discard = array( 3953,
|
$discard = array( 3953,
|
||||||
4977,
|
4977,
|
||||||
5019,
|
5019,
|
||||||
|
7133,
|
||||||
6059,
|
6059,
|
||||||
6616,
|
6616,
|
||||||
17393 );
|
17393 );
|
||||||
|
|
||||||
$tfile = $tmpdir."/".substr($fid,0,2)."/".$fid.".jpg";
|
$tfile = $tmpdir."/thumbs/".substr($fid,0,2)."/".$fid.".jpg";
|
||||||
$tpfile = $tmpdir."/".substr($fid,0,2)."/".$file.".png"; // workaround for qlmanage naming convention
|
$tpfile = $tmpdir."/thumbs/".substr($fid,0,2)."/".$file.".png"; // workaround for qlmanage naming convention
|
||||||
$dfile = $bpath."/thumbs/".substr($fid, 0, 2)."/".$fid.".jpg";;
|
$dfile = $bpath."/thumbs/".substr($fid, 0, 2)."/".$fid.".jpg";;
|
||||||
|
|
||||||
if (!is_dir(dirname($tfile))) { @mkdir(dirname($tfile)); dfm("mkdir ".dirname($tfile)); }
|
if (!is_dir(dirname($tfile))) { @mkdir(dirname($tfile),0777,true); dfm("mkdir ".dirname($tfile)); }
|
||||||
|
|
||||||
if (in_array($ext, $p['t_skip'])) {
|
if (empty($p['t_b'][$ext])) {
|
||||||
// file extension is in the skip list
|
// file extension is in the skip list
|
||||||
$estring .= " ->t_skip";
|
$estring .= " ->t_skip";
|
||||||
dfm("file extension is in the skip list");
|
dfm("skipping ds_store");
|
||||||
goto icons;
|
goto icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,9 +125,10 @@ if ($p['thumbs']) {
|
|||||||
goto icons;
|
goto icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowid = @$dbp->query("SELECT rowid FROM thumbs WHERE fid='".$fid."'")->fetch()['rowid'];
|
|
||||||
|
|
||||||
// check for existing thumb generation attempt
|
// check for existing thumb generation attempt
|
||||||
|
$sql = "SELECT rowid FROM thumbs WHERE fid='".$fid."'";
|
||||||
|
dfm($sql);
|
||||||
|
$rowid = @$dbp->query($sql)->fetch()['rowid'];
|
||||||
|
|
||||||
if (!$rowid) {
|
if (!$rowid) {
|
||||||
// no prior attempt
|
// no prior attempt
|
||||||
@@ -113,7 +149,7 @@ if ($p['thumbs']) {
|
|||||||
// prior attempt
|
// prior attempt
|
||||||
dfm("a prior attempt at thumb generation was found for ".$fid);
|
dfm("a prior attempt at thumb generation was found for ".$fid);
|
||||||
|
|
||||||
$estring .= " ->skip";
|
$estring .= " ->pskip";
|
||||||
goto icons;
|
goto icons;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -121,60 +157,67 @@ if ($p['thumbs']) {
|
|||||||
$cmd['sips'] = $bin_sips." -s format jpeg -s formatOptions 80 --resampleHeightWidthMax ".$p['thumb_size']." ".$shellpath." --out ".$tfile; // add ?? "-d profile --deleteColorManagementProperties"
|
$cmd['sips'] = $bin_sips." -s format jpeg -s formatOptions 80 --resampleHeightWidthMax ".$p['thumb_size']." ".$shellpath." --out ".$tfile; // add ?? "-d profile --deleteColorManagementProperties"
|
||||||
$cmd['vips'] = $bin_vips." ".$shellpath." -o ".$tfile."[Q=90,optimize_coding] --size=".$p['thumb_size'];
|
$cmd['vips'] = $bin_vips." ".$shellpath." -o ".$tfile."[Q=90,optimize_coding] --size=".$p['thumb_size'];
|
||||||
|
|
||||||
//$cmd['sox'] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o - | ".$bin_convert." - -crop 800x515+58+30 -scale 515x515! +dither -colors 16 ".$tfile;
|
$cmd['sox'] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/4}') spectrogram -r -o - | ".$bin_convert." - -quality 85% ".$tfile;
|
||||||
$cmd['sox'] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o ".$tpfile."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($tpfile)." --out ".$tfile;
|
$cmd['ffmpeg'] = $bin_ffmpeg." -ss $(( $(".$bin_mediainfo." --Inform='Video;%Duration%' ".$shellpath." | cut -d'.' -f1) / 10000 )) -i ".$shellpath." -vframes 1 -filter:v scale='".$p['thumb_size'].":-1' -q:v 3 ".$tfile;
|
||||||
$cmd['ffmpeg'] = $bin_ffmpeg." -ss $(( $(".$bin_mediainfo." --Inform='Video;%Duration%' ".$shellpath." | cut -d'.' -f1) / 10000 )) -i ".$shellpath." -vframes 1 -filter:v scale='400:-1' -q:v 3 ".$tfile;
|
|
||||||
|
|
||||||
$cmd['ql-thumbnail'] = $bin_qlthumb." ".$shellpath." ".$tfile." public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8";
|
$cmd['ql-thumbnail'] = $bin_qlthumb." ".$shellpath." ".$tfile." public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8";
|
||||||
$cmd['qlmanage'] = $bin_qlmanage." -t -s ".$p['thumb_size']." -o ".dirname($tpfile)." ".$shellpath."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($tpfile)." --out ".$tfile;
|
$cmd['qlmanage'] = $bin_qlmanage." -t -s ".$p['thumb_size']." -o ".dirname($tpfile)." ".$shellpath."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($tpfile)." --out ".$tfile;
|
||||||
|
$cmd['qltool'] = $bin_qltool." dp ".$shellpath." ".$p['thumb_size']." ".$p['thumb_size']." | base64 --decode | ".$bin_convert." - -scale 50% ".$tfile;
|
||||||
|
|
||||||
if (in_array($ext, $p['t_files']['sips'])) {
|
switch ($p['thumb_mode']) {
|
||||||
$external_tool = "sips";
|
case 0: // most files
|
||||||
} elseif (in_array($ext, $p['t_files']['ffmpeg'])) {
|
if (!empty($p['t_b'][$extl])) {
|
||||||
$external_tool = "ffmpeg";
|
$priority = $p['t_b'][$extl];
|
||||||
} elseif (in_array($ext, $p['t_files']['sox'])) {
|
} else {
|
||||||
$external_tool = "sox";
|
$priority = $p['t_b']['*'];
|
||||||
} else {
|
}
|
||||||
$external_tool = null;
|
break;
|
||||||
|
case 1: // some files
|
||||||
|
if (!empty($p['t_b'][$extl]) && !in_array($p['t_b']['*'],$p['t_b'][$extl])) {
|
||||||
|
$priority = $p['t_b']['*'];
|
||||||
|
} else {
|
||||||
|
$priority = null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
dfm("external tool for ".$ext." = ".$external_tool);
|
dfm("thumb mode ".$p['thumb_mode']);
|
||||||
switch ($p['thumb_priority']) {
|
dfm("priority for ".$extl." is: ".print_r($priority,true));
|
||||||
// external tool priority
|
|
||||||
case 0: $priority = array($external_tool,"ql-thumbnail","qlmanage"); break;
|
|
||||||
// ql-thumbnail priority
|
|
||||||
case 1: $priority = array("ql-thumbnail","qlmanage",$external_tool); break;
|
|
||||||
// qlmanage priority
|
|
||||||
case 2: $priority = array("qlmanage","ql-thumbnail",$external_tool); break;
|
|
||||||
}
|
|
||||||
dfm("priority for ".$ext." is: ".print_r($priority,true));
|
|
||||||
|
|
||||||
$stmt->BindValue(":fid",$fid);
|
$stmt->BindValue(":fid",$fid);
|
||||||
$stmt->BindValue(":created",time());
|
$stmt->BindValue(":created",time());
|
||||||
|
|
||||||
if (!is_dir(dirname($dfile))) { @mkdir(dirname($dfile)); dfm("mkdir ".dirname($dfile)); }
|
if (!is_array($priority)) { $priority = array($priority); }
|
||||||
|
|
||||||
foreach ($priority as $tool) {
|
foreach ($priority as $tool) {
|
||||||
|
|
||||||
if (empty($cmd[$tool])) { break; }
|
if (empty($cmd[$tool])) { continue; }
|
||||||
|
|
||||||
shell_exec($cmd[$tool]." 2>&1");
|
|
||||||
dfm($cmd[$tool]);
|
dfm($cmd[$tool]);
|
||||||
|
shell_exec("( ".$cmd[$tool]." ) ".$redirect);
|
||||||
$estring .= " ->".$tool;
|
$estring .= " ->".$tool;
|
||||||
|
|
||||||
$checksize = @filesize($tfile);
|
$checksize = @filesize($tfile);
|
||||||
if ($checksize && !in_array($checksize,$discard)) {
|
if ($checksize) {
|
||||||
$estring .= " ->use";
|
if (in_array($checksize,$discard)) {
|
||||||
$stmt->BindValue(":tool",$tool);
|
$estring .= " ->bdiscard";
|
||||||
$stmt->BindValue(":relative_path",substr($dfile, strlen($bpath)));
|
dfm($checksize." is in the banned size array");
|
||||||
list($width, $height) = getimagesize($tfile);
|
} else {
|
||||||
$stmt->BindValue(":width",$width);
|
$estring .= " ->use";
|
||||||
$stmt->BindValue(":height",$height);
|
dfm ("generated ".$tfile." filesize is ".$checksize);
|
||||||
rename($tfile,$dfile);
|
$stmt->BindValue(":tool",$tool);
|
||||||
dfm("moving ".$tfile." to ".$dfile);
|
$stmt->BindValue(":relative_path",substr($dfile, strlen($bpath)));
|
||||||
break;
|
dfm("getimagesize on ".$tfile);
|
||||||
|
list($width, $height) = getimagesize($tfile);
|
||||||
|
$stmt->BindValue(":width",$width);
|
||||||
|
$stmt->BindValue(":height",$height);
|
||||||
|
if (!is_dir(dirname($dfile))) { @mkdir(dirname($dfile)); dfm("mkdir ".dirname($dfile)); }
|
||||||
|
rename($tfile,$dfile);
|
||||||
|
dfm("moving ".$tfile." to ".$dfile);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$estring .= " ->discard";
|
$estring .= " ->discard";
|
||||||
dfm("filesize ".$checksize." is in the banned size array (or is zero)");
|
dfm($tool." did not produce a file");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -188,111 +231,160 @@ if ($p['thumbs']) {
|
|||||||
// Icons //////////////////////////////////////////
|
// Icons //////////////////////////////////////////
|
||||||
|
|
||||||
icons:
|
icons:
|
||||||
if ($p['icons']) {
|
if ($p['icons'] && $ext != "DS_Store") {
|
||||||
|
|
||||||
dfm("ICONS",1);
|
dfm("ICONS",1);
|
||||||
|
|
||||||
$estring .= " ICONS";
|
$estring .= " ICONS";
|
||||||
|
|
||||||
if ($p['icon_tool'] == 0) {
|
if ($p['icon_mode'] != 0 && in_array($extl, $p['i_skip'])) {
|
||||||
$tool = "qltool";
|
|
||||||
} elseif ($p['icon_tool'] == 1) {
|
|
||||||
$tool = "qlmanage";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in_array($ext, $p['i_skip'])) {
|
|
||||||
// file extension is in the skip list
|
|
||||||
$estring .= " ->i_skip";
|
$estring .= " ->i_skip";
|
||||||
|
dfm("file extension is in the skip list");
|
||||||
goto meta;
|
goto meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tfile = $tmpdir."/".substr($fid,0,2)."/".$file.".png";
|
$tfile = $tmpdir."/icons/".substr($fid,0,2)."/".$fid.".png";
|
||||||
if (!is_dir(dirname($tfile))) { @mkdir(dirname($tfile)); }
|
if (!is_dir(dirname($tfile))) { @mkdir(dirname($tfile),0777,true); dfm("mkdir ".dirname($tfile)); }
|
||||||
// workaround for qlmanage naming convention
|
|
||||||
|
|
||||||
$rowid = @$dbp->query("SELECT rowid FROM icons WHERE fid='".$fid."'")->fetch()['rowid'];
|
// we can't check for files (faster) here because they are stored by md5_file hash
|
||||||
// check for existing icon generation attempt
|
$sql = "SELECT rowid FROM icons WHERE fid='".$fid."'";
|
||||||
|
dfm($sql);
|
||||||
|
$rowid = @$dbp->query($sql)->fetch()['rowid'];
|
||||||
|
|
||||||
if (!$rowid) {
|
if (!$rowid) {
|
||||||
// no prior attempt
|
|
||||||
|
|
||||||
|
dfm("no prior attempt was found");
|
||||||
$stmt = $dbp->prepare("INSERT INTO icons VALUES (:fid, :hash, :created, :relative_path, :tool)");
|
$stmt = $dbp->prepare("INSERT INTO icons VALUES (:fid, :hash, :created, :relative_path, :tool)");
|
||||||
$estring .= " ->generate";
|
|
||||||
|
|
||||||
} elseif ($rowid && $p['icons'] == 2) {
|
} elseif ($rowid && $p['icons'] == 2) {
|
||||||
// prior attempt but rebuild mode
|
|
||||||
|
|
||||||
|
dfm("a prior attempt was found but we are in rebuild mode");
|
||||||
$stmt = $dbp->prepare("UPDATE icons SET fid = :fid, hash = :hash, created = :created, relative_path = :relative_path, tool = :tool WHERE rowid = ".$rowid);
|
$stmt = $dbp->prepare("UPDATE icons SET fid = :fid, hash = :hash, created = :created, relative_path = :relative_path, tool = :tool WHERE rowid = ".$rowid);
|
||||||
$estring .= " ->rebuild";
|
$estring .= " ->rebuild";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// prior attempt
|
|
||||||
|
|
||||||
$estring .= " ->skip";
|
dfm("a prior attempt was found, skipping");
|
||||||
|
$estring .= " ->pskip";
|
||||||
goto meta;
|
goto meta;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->BindValue(":fid",$fid);
|
$cmd['flacicon'] = $bin_flacicon." ".$shellpath." ".$p['icon_size']." ".$tfile;
|
||||||
|
$cmd['ql-icon'] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." | ".$bin_pngquant." - -o ".$tfile;
|
||||||
|
$cmd['iff'] = $bin_iff." --input=".$shellpath." --width=".($p['icon_size']/2)." --height=".($p['icon_size']/2)." | ".$bin_pngquant." - -o ".$tfile;
|
||||||
|
$cmd['qltool'] = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode | ".$bin_convert." - -scale 50% - | ".$bin_pngquant." - -o ".$tfile;
|
||||||
|
|
||||||
if ($tool == "qltool") {
|
if ($p['icon_mode'] == 2) {
|
||||||
|
|
||||||
$cmd = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode > ".escapeshellarg($tfile);
|
dfm("icon mode 2, bypassing hash check");
|
||||||
|
$tool = "ql-icon";
|
||||||
|
shell_exec("( ".$cmd[$tool]." ) ".$redirect);
|
||||||
|
$stmt->BindValue(":tool",$tool);
|
||||||
|
dfm($cmd[$tool]);
|
||||||
|
$estring .= " ->".$tool;
|
||||||
|
|
||||||
} elseif ($tool == "qlmanage") {
|
$checksize = @filesize($tfile);
|
||||||
|
if ($checksize) {
|
||||||
// > code for custom qlgenerator bindings goes here <
|
dfm("generated ".$tfile." filesize is ".$checksize);
|
||||||
|
$dfile = $bpath."/icons/".substr($fid, 0, 2)."/".$fid.".png";
|
||||||
$cmd = $bin_qlmanage." -ti -s ".$p['icon_size']." -o ".dirname($tfile)." ".$shellpath;
|
|
||||||
//$cmd = $bin_qlmanage." -ti -f ".floor($p['icon_size']/128)." -o ".dirname($tfile)." ".$shellpath;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_exec($cmd);
|
|
||||||
|
|
||||||
if (@filesize($tfile)) {
|
|
||||||
|
|
||||||
$hash = md5_file($tfile);
|
|
||||||
$stmt->BindValue(":hash",$hash);
|
|
||||||
|
|
||||||
if ($row = @$dbp->query("SELECT * FROM icons WHERE hash='".$hash."'")->fetchAll()[0]) {
|
|
||||||
// check for another icon with the same hash
|
|
||||||
|
|
||||||
$stmt->BindValue(":created",$row['created']);
|
|
||||||
$stmt->BindValue(":relative_path",$row['relative_path']);
|
|
||||||
$stmt->BindValue(":tool",$row['tool']);
|
|
||||||
|
|
||||||
$estring .= " ->recycle";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$dfile = $bpath."/icons/".substr($hash, 0, 2)."/".$hash.".png";
|
|
||||||
if (!is_dir(dirname($dfile))) { @mkdir(dirname($dfile)); }
|
if (!is_dir(dirname($dfile))) { @mkdir(dirname($dfile)); }
|
||||||
|
rename($tfile,$dfile);
|
||||||
$estring .= " ->use";
|
dfm("moving ".$tfile." to ".$dfile);
|
||||||
|
|
||||||
if ($tool == "qltool") {
|
|
||||||
// qltool makes 2x icons for some reason
|
|
||||||
|
|
||||||
//shell_exec($bin_sips." -z ".$p['icon_size']." ".$p['icon_size']." ".$tfile." --out ".$dfile);
|
|
||||||
shell_exec($bin_convert." ".escapeshellarg($tfile)." -scale 50% -strip -define png:compression-level=9 ".$dfile);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//rename($tfile,$dfile);
|
|
||||||
shell_exec($bin_convert." ".escapeshellarg($tfile)." -strip -define png:compression-level=9 ".$dfile);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->BindValue(":created",time());
|
$stmt->BindValue(":created",time());
|
||||||
$stmt->BindValue(":relative_path",substr($dfile,strlen($bpath)));
|
$stmt->BindValue(":relative_path",substr($dfile,strlen($bpath)));
|
||||||
$stmt->BindValue(":tool",$tool);
|
$stmt->BindValue(":hash",null);
|
||||||
|
$estring .= " ->use";
|
||||||
|
} else {
|
||||||
|
$estring .= " ->discard";
|
||||||
|
dfm($tool." produced a bad file (size=".$checksize.")");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$estring .= " ->discard";
|
$gfind = array("[","]","{","}");
|
||||||
|
$greplace = array("\[","\]","\{","\}");
|
||||||
|
$globsafe = str_replace($gfind,$greplace,$pathname);
|
||||||
|
|
||||||
|
if ($btype == "dir") {
|
||||||
|
dfm($pathname." is a dir, proceeding with directory check");
|
||||||
|
$stmt->BindValue(":fid",$fid);
|
||||||
|
if ($ext || file_exists($pathname."/Icon\r")) {
|
||||||
|
dfm("Ext or custom icon found, processing ".$pathname." with iff");
|
||||||
|
$tools = array("iff");
|
||||||
|
} elseif (( glob($globsafe."/".globstring($p['album_files']),GLOB_BRACE) || glob($globsafe."/*/".globstring($p['album_files']),GLOB_BRACE)) && $test = glob($globsafe."/".globstring($p['cover_exts'],$p['cover_files']),GLOB_BRACE)) {
|
||||||
|
dfm("Album files and cover found, processing ".$pathname." with flacdiricon");
|
||||||
|
$cmd['flacdiricon'] = $bin_flacdiricon." ".$shellpath." ".$p['icon_size']." ".escapeshellarg(array_shift($test))." ".$tfile;
|
||||||
|
$tools = array("flacdiricon");
|
||||||
|
} else {
|
||||||
|
dfm("glob ".$pathname."/".globstring($p['album_files']));
|
||||||
|
dfm("glob ".$pathname."/".globstring($p['cover_exts'],$p['cover_files']));
|
||||||
|
dfm("Nothing found, skipping ".$pathname);
|
||||||
|
$tools = array();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$stmt->BindValue(":fid",$fid);
|
||||||
|
if (in_array($extl, $p['i_sox'])) {
|
||||||
|
$tools = array("flacicon","ql-icon","iff");
|
||||||
|
} else {
|
||||||
|
$tools = array("ql-icon","iff");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mytool = "";
|
||||||
|
foreach ($tools as $tool) {
|
||||||
|
if (!@filesize($tfile)) {
|
||||||
|
shell_exec("( ".$cmd[$tool]." ) ".$redirect);
|
||||||
|
dfm($cmd[$tool]);
|
||||||
|
$estring .= " ->".$tool;
|
||||||
|
$mytool = $tool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$checksize = @filesize($tfile);
|
||||||
|
if ($checksize) {
|
||||||
|
|
||||||
|
dfm ("generated ".$tfile." filesize is ".$checksize);
|
||||||
|
dfm("md5_file on ".$tfile);
|
||||||
|
$hash = md5_file($tfile);
|
||||||
|
$stmt->BindValue(":hash",$hash);
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM icons WHERE hash='".$hash."'";
|
||||||
|
dfm($sql);
|
||||||
|
$row = @$dbp->query($sql)->fetchAll()[0];
|
||||||
|
|
||||||
|
if ($row) {
|
||||||
|
|
||||||
|
dfm("found another record with the same hash");
|
||||||
|
$estring .= " ->recycle";
|
||||||
|
$stmt->BindValue(":created",$row['created']);
|
||||||
|
$stmt->BindValue(":relative_path",$row['relative_path']);
|
||||||
|
$stmt->BindValue(":tool",$row['tool']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
dfm("no existing hash record");
|
||||||
|
$dfile = $bpath."/icons/".substr($hash, 0, 2)."/".$hash.".png";
|
||||||
|
if (!is_dir(dirname($dfile))) { @mkdir(dirname($dfile)); }
|
||||||
|
rename($tfile,$dfile);
|
||||||
|
dfm("moving ".$tfile." to ".$dfile);
|
||||||
|
$stmt->BindValue(":created",time());
|
||||||
|
$stmt->BindValue(":relative_path",substr($dfile,strlen($bpath)));
|
||||||
|
$stmt->BindValue(":tool",$mytool);
|
||||||
|
$estring .= " ->use";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (empty($tools)) {
|
||||||
|
$estring .= " ->gskip";
|
||||||
|
} else {
|
||||||
|
$estring .= " ->discard";
|
||||||
|
}
|
||||||
|
dfm("tool = ".$mytool." produced a bad file (size=".$checksize.")");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,23 +397,27 @@ if ($p['icons']) {
|
|||||||
// Metadata //////////////////////////////////////////
|
// Metadata //////////////////////////////////////////
|
||||||
|
|
||||||
meta:
|
meta:
|
||||||
if ($p['meta']) {
|
if ($p['meta'] && $btype == "file" && $ext != "DS_Store") {
|
||||||
|
|
||||||
dfm("META",1);
|
dfm("META",1);
|
||||||
|
|
||||||
$estring .= " META";
|
$estring .= " META";
|
||||||
|
|
||||||
if (!in_array($ext, $p['e_files']) && !in_array($ext, $p['m_files'])) {
|
if (!in_array($extl, $p['e_files']) && !in_array($extl, $p['m_files'])) {
|
||||||
$estring .= " ->notmedia";
|
$estring .= " ->notmedia";
|
||||||
|
dfm("file extension ".$extl." is not a media file");
|
||||||
goto hashy;
|
goto hashy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($ext, $p['e_files'])) {
|
if (in_array($extl, $p['e_files'])) {
|
||||||
$check = @$dbp->query("SELECT EXISTS(SELECT 1 FROM exiftool WHERE fid='".$fid."')")->fetch();
|
$sql = "SELECT EXISTS(SELECT 1 FROM exiftool WHERE fid='".$fid."')";
|
||||||
if (!reset($check)) { // hacky but needed because we set FETCH_ASSOC
|
dfm($sql);
|
||||||
$arrstring = shell_exec($bin_exiftool." -php ".$shellpath);
|
$check = @$dbp->query($sql)->fetch();
|
||||||
// $rawexif = eval("return ".`$bin_exiftool -php $shellpath`);
|
if (!reset($check)) {
|
||||||
// do an addtl check below to prevent "PHP Parse error: syntax error, unexpected end of file, expecting ';'"
|
dfm("creating exiftool dump");
|
||||||
|
$cmd = $bin_exiftool." -php ".$shellpath;
|
||||||
|
dfm($cmd);
|
||||||
|
$arrstring = shell_exec($cmd);
|
||||||
if (substr($arrstring,0,5) == "Array") {
|
if (substr($arrstring,0,5) == "Array") {
|
||||||
$rawexif = eval("return ".$arrstring);
|
$rawexif = eval("return ".$arrstring);
|
||||||
$stmt = $dbp->prepare("INSERT INTO exiftool VALUES (:fid, :tags)");
|
$stmt = $dbp->prepare("INSERT INTO exiftool VALUES (:fid, :tags)");
|
||||||
@@ -332,21 +428,24 @@ if ($p['meta']) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$estring .= " ->e_found";
|
$estring .= " ->e_found";
|
||||||
|
dfm("existing exiftool dump found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($ext, $p['m_files'])) {
|
if (in_array($extl, $p['m_files'])) {
|
||||||
$check = @$dbp->query("SELECT EXISTS(SELECT 1 FROM mediainfo WHERE fid='".$fid."')")->fetch();
|
$sql = "SELECT EXISTS(SELECT 1 FROM mediainfo WHERE fid='".$fid."')";
|
||||||
|
dfm($sql);
|
||||||
|
$check = @$dbp->query($sql)->fetch();
|
||||||
if (!reset($check)) {
|
if (!reset($check)) {
|
||||||
|
dfm("creating mediainfo dump");
|
||||||
$stmt = $dbp->prepare("INSERT INTO mediainfo VALUES (:fid, :info)");
|
$stmt = $dbp->prepare("INSERT INTO mediainfo VALUES (:fid, :info)");
|
||||||
$stmt->BindValue(":fid",$fid);
|
$stmt->BindValue(":fid",$fid);
|
||||||
//$stmt->BindValue(":info",serialize(parseMediaInfo(shell_exec($bin_mediainfo." --Output=OLDXML ".$shellpath." 2>&1"))));
|
$stmt->BindValue(":info",shell_exec("( ".$bin_mediainfo." --Output=JSON ".$shellpath." ) ".$redirect));
|
||||||
//$stmt->BindValue(":info",shell_exec($bin_mediainfo." --Output=OLDXML ".$shellpath." 2>&1"));
|
|
||||||
$stmt->BindValue(":info",shell_exec($bin_mediainfo." --Output=JSON ".$shellpath." 2>&1"));
|
|
||||||
$sbatch[] = $stmt;
|
$sbatch[] = $stmt;
|
||||||
$estring .= " ->minfo";
|
$estring .= " ->minfo";
|
||||||
} else {
|
} else {
|
||||||
$estring .= " ->m_found";
|
$estring .= " ->m_found";
|
||||||
|
dfm("existing mediainfo dump found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,21 +454,27 @@ if ($p['meta']) {
|
|||||||
// Hash //////////////////////////////////////////
|
// Hash //////////////////////////////////////////
|
||||||
|
|
||||||
hashy:
|
hashy:
|
||||||
if ($p['hash']) {
|
if ($p['hash'] && $btype == "file" && $ext != ".DS_Store") {
|
||||||
|
|
||||||
dfm("HASH",1);
|
dfm("HASH",1);
|
||||||
|
|
||||||
$estring .= " HASH";
|
$estring .= " HASH";
|
||||||
|
|
||||||
$size = filesize($pathname);
|
$size = filesize($pathname);
|
||||||
|
dfm("file ".$pathname." is ".$size);
|
||||||
$limit = $p['hash_limit']*1000000000;
|
$limit = $p['hash_limit']*1000000000;
|
||||||
$check = @$dbp->query("SELECT EXISTS(SELECT 1 FROM md5 WHERE fid='".$fid."')")->fetch();
|
$sql = "SELECT EXISTS(SELECT 1 FROM md5 WHERE fid='".$fid."')";
|
||||||
|
dfm($sql);
|
||||||
|
$check = @$dbp->query($sql)->fetch();
|
||||||
if (reset($check)) {
|
if (reset($check)) {
|
||||||
$estring .= " ->exists";
|
$estring .= " ->exists";
|
||||||
|
dfm("hash already exists for ".$pathname);
|
||||||
} elseif ($p['hash_limit'] && ($size > $limit)) {
|
} elseif ($p['hash_limit'] && ($size > $limit)) {
|
||||||
$estring .= " ->too big";
|
$estring .= " ->too big";
|
||||||
|
dfm("file is too big to hash");
|
||||||
} else {
|
} else {
|
||||||
$estring .= " ->generating";
|
$estring .= " ->generating";
|
||||||
|
dfm("generating hash for ".$pathname);
|
||||||
$stmt = $dbp->prepare("INSERT INTO md5 VALUES (:fid, :hash)");
|
$stmt = $dbp->prepare("INSERT INTO md5 VALUES (:fid, :hash)");
|
||||||
$stmt->BindValue(":fid",$fid);
|
$stmt->BindValue(":fid",$fid);
|
||||||
$stmt->BindValue(":hash",md5_file($pathname));
|
$stmt->BindValue(":hash",md5_file($pathname));
|
||||||
@@ -383,7 +488,7 @@ if ($p['hash']) {
|
|||||||
// Contents //////////////////////////////////////////
|
// Contents //////////////////////////////////////////
|
||||||
|
|
||||||
contents:
|
contents:
|
||||||
if ($p['contents']) {
|
if ($p['contents'] && $btype == "file") {
|
||||||
|
|
||||||
dfm("CONTENTS",1);
|
dfm("CONTENTS",1);
|
||||||
|
|
||||||
@@ -391,18 +496,22 @@ if ($p['contents']) {
|
|||||||
|
|
||||||
$cpath = $bpath."/contents/".substr($fid, 0, 2);
|
$cpath = $bpath."/contents/".substr($fid, 0, 2);
|
||||||
$cfile = $cpath."/".$fid.".zip";
|
$cfile = $cpath."/".$fid.".zip";
|
||||||
if (in_array($ext, $p['c_files'])) {
|
if (in_array($extl, $p['c_files'])) {
|
||||||
if (!is_dir($cpath)) { mkdir($cpath); }
|
|
||||||
$max_size = $p['contents_limit'] * 1000;
|
$max_size = $p['contents_limit'] * 1000;
|
||||||
if ($ext == ".DS_Store") {
|
if ($ext == ".DS_Store") {
|
||||||
// store all DS_Store files no matter how big
|
// store all DS_Store files no matter how big
|
||||||
|
dfm("flagging ds_store file for inclusion");
|
||||||
$my_size = 1;
|
$my_size = 1;
|
||||||
} else {
|
} else {
|
||||||
$my_size = filesize($pathname);
|
$my_size = filesize($pathname);
|
||||||
|
dfm("file ".$pathname." is ".$my_size);
|
||||||
}
|
}
|
||||||
if (!file_exists($cfile) && $my_size < $max_size) {
|
if (!file_exists($cfile) && $my_size < $max_size) {
|
||||||
|
|
||||||
|
if (!is_dir($cpath)) { mkdir($cpath); dfm("mkdir ",$cpath); }
|
||||||
|
|
||||||
$estring .= " ->zip";
|
$estring .= " ->zip";
|
||||||
|
dfm("creating a zip archive of ".$pathname);
|
||||||
|
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
$zip->open($cfile, ZipArchive::CREATE);
|
$zip->open($cfile, ZipArchive::CREATE);
|
||||||
@@ -419,11 +528,61 @@ if ($p['contents']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spotlight //////////////////////////////////////////
|
||||||
|
|
||||||
|
if (@$argv[8]) {
|
||||||
|
|
||||||
|
dfm("SPOTLIGHT",1);
|
||||||
|
$estring .= " SPOTLIGHT";
|
||||||
|
|
||||||
|
$cmd = "mdls -plist - ".$shellpath." ".$redirect;
|
||||||
|
dfm($cmd);
|
||||||
|
$mdls = shell_exec($cmd);
|
||||||
|
|
||||||
|
if (substr_count(@$mdls,"\n") > 1) {
|
||||||
|
$spotlight = $parser->parseString(utf8_for_xml($mdls));
|
||||||
|
} else {
|
||||||
|
$spotlight = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $dbo->prepare("INSERT INTO mdls VALUES (:id,".implode(",",$ibuild).")");
|
||||||
|
$stmt->BindValue(":id",$bdone+1);
|
||||||
|
|
||||||
|
foreach ($mb as $key => $list) {
|
||||||
|
foreach ($list as $item) {
|
||||||
|
|
||||||
|
if (@$spotlight["kMDItem".$item]) {
|
||||||
|
$stmt->BindValue(":pid",$pid);
|
||||||
|
$stmt->BindValue(":spotlight",$mdls);
|
||||||
|
switch($key) {
|
||||||
|
case "i":
|
||||||
|
case "t":
|
||||||
|
$stmt->BindValue(":".$item,$spotlight["kMDItem".$item]);
|
||||||
|
break;
|
||||||
|
case "a":
|
||||||
|
$stmt->BindValue(":".$item,serialize($spotlight["kMDItem".$item]));
|
||||||
|
break;
|
||||||
|
case "d":
|
||||||
|
$stmt->BindValue(":".$item,strtotime($spotlight["kMDItem".$item]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$estring .= " ->db";
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Inserts //////////////////////////////////////////
|
// Inserts //////////////////////////////////////////
|
||||||
|
|
||||||
foreach ($sbatch as $stmt) { $stmt->execute(); }
|
dfm("SQL",1);
|
||||||
|
|
||||||
|
foreach ($sbatch as $stmt) { $stmt->execute(); dfm($stmt->queryString); }
|
||||||
|
|
||||||
dm($dm);
|
dm($dm);
|
||||||
echo msg($estring);
|
echo msg($estring,false);
|
||||||
|
echo "\n"."PROGRESS:".round(($bdone/$btotal)*100,2)."\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1 +1 @@
|
|||||||
a:20:{s:5:"bdest";s:0:"";s:10:"rsync_dest";s:0:"";s:10:"postflight";i:1;s:11:"readability";i:0;s:9:"stat_mode";i:1;s:4:"meta";i:1;s:6:"thumbs";i:1;s:10:"thumb_size";i:512;s:14:"thumb_priority";i:0;s:5:"icons";i:1;s:9:"icon_size";i:512;s:9:"icon_tool";i:0;s:4:"hash";i:1;s:10:"hash_limit";i:1;s:8:"contents";i:1;s:14:"contents_limit";i:50;s:9:"spotlight";i:1;s:7:"profile";i:1;s:8:"parallel";i:1;s:5:"debug";i:0;}
|
a:21:{s:5:"bdest";s:0:"";s:10:"rsync_dest";s:0:"";s:10:"postflight";i:1;s:11:"readability";i:0;s:9:"stat_mode";i:1;s:4:"meta";i:1;s:6:"thumbs";i:1;s:10:"thumb_size";i:512;s:10:"thumb_mode";i:0;s:5:"icons";i:1;s:9:"icon_size";i:256;s:9:"icon_mode";i:0;s:4:"hash";i:1;s:10:"hash_limit";i:1;s:8:"contents";i:1;s:14:"contents_limit";i:50;s:9:"spotlight";i:1;s:7:"profile";i:1;s:8:"parallel";i:1;s:5:"debug";i:0;s:5:"reuse";i:1;}
|
||||||
@@ -20,7 +20,7 @@ $dmg = $dest."/Polyfill.sparsebundle";
|
|||||||
if (file_exists($dmg)) {
|
if (file_exists($dmg)) {
|
||||||
exec("trash ".$dmg."; umount -f /Volumes/Polyfill");
|
exec("trash ".$dmg."; umount -f /Volumes/Polyfill");
|
||||||
}
|
}
|
||||||
exec("hdiutil create -size 100g -fs HFS+ -type SPARSEBUNDLE -volname Polyfill -attach ".$dmg);
|
exec("hdiutil create -size 1tb -fs HFS+ -type SPARSEBUNDLE -volname Polyfill -attach ".$dmg);
|
||||||
|
|
||||||
$base = "/Volumes/Polyfill";
|
$base = "/Volumes/Polyfill";
|
||||||
$sample_files = glob($sample."/*.*");
|
$sample_files = glob($sample."/*.*");
|
||||||
|
|||||||
146
web/rtc.php
@@ -4,7 +4,7 @@
|
|||||||
// Yuba RTC Browser
|
// Yuba RTC Browser
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$browser_version = "0.7.13.0";
|
$browser_version = "0.8.0.1";
|
||||||
|
|
||||||
require "togggle.php";
|
require "togggle.php";
|
||||||
require "lib/ref/ref.php";
|
require "lib/ref/ref.php";
|
||||||
@@ -12,7 +12,7 @@ require "lib/ref/ref.php";
|
|||||||
ref::config('expLvl', 1);
|
ref::config('expLvl', 1);
|
||||||
ref::config('validHtml', TRUE);
|
ref::config('validHtml', TRUE);
|
||||||
|
|
||||||
$db_dir = "data/debug";
|
$db_dir = "data/";
|
||||||
$icon_size = 96;
|
$icon_size = 96;
|
||||||
$pad = 40;
|
$pad = 40;
|
||||||
$border_tools = array("sips","sox","ffmpeg","ql-thumbnail");
|
$border_tools = array("sips","sox","ffmpeg","ql-thumbnail");
|
||||||
@@ -25,7 +25,7 @@ $hidefiles = array(".DS_Store");
|
|||||||
<meta charset='UTF-8'>
|
<meta charset='UTF-8'>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
html { font-family: Helvetica; word-wrap: break-all; word-break: break-all; }
|
html { font-family: Helvetica; word-wrap: break; word-break: break; }
|
||||||
|
|
||||||
table.outlined tbody > tr > td > div { outline: 1px solid purple; }
|
table.outlined tbody > tr > td > div { outline: 1px solid purple; }
|
||||||
table.outlined tbody > tr > td > div > div { outline: 1px solid orange; }
|
table.outlined tbody > tr > td > div > div { outline: 1px solid orange; }
|
||||||
@@ -61,7 +61,7 @@ div.iibox { display: table-cell;
|
|||||||
|
|
||||||
div.diibox { display: table-cell;
|
div.diibox { display: table-cell;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
background: url("/icons/directory.png");
|
background: url("/yicons/directory.png");
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: <?=$icon_size;?>px;
|
background-size: <?=$icon_size;?>px;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
@@ -105,8 +105,7 @@ img#thumb { padding: 6px;
|
|||||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
img#item { float: left; margin-right: 10px; width: 32px; height: 32px; }
|
img#item { float: left; margin-right: 10px; width: 32px; height: 32px; margin-bottom: 8px; }
|
||||||
img { margin-bottom: 8px; }
|
|
||||||
|
|
||||||
div.title { padding: 0px 10px 0px 10px; }
|
div.title { padding: 0px 10px 0px 10px; }
|
||||||
|
|
||||||
@@ -122,6 +121,8 @@ iframe { width: 425px; height: 550px; padding: 6px; border: 1px solid black; }
|
|||||||
|
|
||||||
div.dblist { display: none; }
|
div.dblist { display: none; }
|
||||||
|
|
||||||
|
.ui-slider-handle { outline: 0 none !important; }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script src="/lib/ref/ref.js"></script>
|
<script src="/lib/ref/ref.js"></script>
|
||||||
@@ -347,9 +348,9 @@ function mb_shortlabel($filename, $max = 40) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findicon($filename) {
|
function findicon($filename) {
|
||||||
$ext = pathinfo($filename)['extension'];
|
$ext = @pathinfo($filename)['extension'];
|
||||||
$good = "icons/null.png";
|
$good = "yicons/null.png";
|
||||||
foreach (glob("icons/*.png") as $file) {
|
foreach (glob("yicons/*.png") as $file) {
|
||||||
if (pathinfo($file)['filename'] == $ext) {
|
if (pathinfo($file)['filename'] == $ext) {
|
||||||
$good = $file;
|
$good = $file;
|
||||||
}
|
}
|
||||||
@@ -359,9 +360,9 @@ function findicon($filename) {
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$db_file = $_GET['db'];
|
$db_file = @$_GET['db'];
|
||||||
$pid = $_GET['pid'];
|
$pid = @$_GET['pid'];
|
||||||
$search = $_POST['query'];
|
$search = @$_POST['query'];
|
||||||
$parser = new plistParser();
|
$parser = new plistParser();
|
||||||
|
|
||||||
if ($db_file) {
|
if ($db_file) {
|
||||||
@@ -383,18 +384,18 @@ if ($db_file) {
|
|||||||
// Check for initial view
|
// Check for initial view
|
||||||
|
|
||||||
$view = $dbo->query("SELECT * FROM _skim")->fetch();
|
$view = $dbo->query("SELECT * FROM _skim")->fetch();
|
||||||
|
$myopts = $view['opts'] = unserialize($view['opts']);
|
||||||
|
|
||||||
if (!$pid) {
|
if (!$pid) {
|
||||||
$pid = $dbo->query("SELECT pid FROM family WHERE (rowid=2)")->fetch()['pid'];
|
$pid = $dbo->query("SELECT pid FROM family WHERE (rowid=2)")->fetch()['pid'];
|
||||||
// handle special strings
|
// handle special strings
|
||||||
$view['opts'] = unserialize($view['opts']);
|
|
||||||
if (is_serial($view['qlmanage'])) {
|
if (is_serial($view['qlmanage'])) {
|
||||||
$view['qlmanage'] = unserialize($view['qlmanage']);
|
$view['qlmanage'] = unserialize($view['qlmanage']);
|
||||||
} else {
|
} else {
|
||||||
$view['qlmanage'] = array($view['qlmanage']);
|
$view['qlmanage'] = array($view['qlmanage']);
|
||||||
}
|
}
|
||||||
$view['profile'] = array($view['profile']);
|
$view['profile'] = array($view['profile']);
|
||||||
if ($view['details']) {
|
if (@$view['details']) {
|
||||||
$view['details'] = unserialize($view['details']);
|
$view['details'] = unserialize($view['details']);
|
||||||
}
|
}
|
||||||
if (substr($view['disks'],0,5) == "<?xml") {
|
if (substr($view['disks'],0,5) == "<?xml") {
|
||||||
@@ -407,10 +408,10 @@ if ($db_file) {
|
|||||||
} else {
|
} else {
|
||||||
$view['diskutil'] = $view['diskutil'];
|
$view['diskutil'] = $view['diskutil'];
|
||||||
}
|
}
|
||||||
if ($view['vdisks']) {
|
if (@$view['vdisks']) {
|
||||||
$view['vdisks'] = $parser->parseString(utf8_for_xml($view['vdisks']));
|
$view['vdisks'] = $parser->parseString(utf8_for_xml($view['vdisks']));
|
||||||
}
|
}
|
||||||
if ($view['hdiutil']) {
|
if (@$view['hdiutil']) {
|
||||||
$view['hdiutil'] = $parser->parseString(utf8_for_xml($view['hdiutil']));
|
$view['hdiutil'] = $parser->parseString(utf8_for_xml($view['hdiutil']));
|
||||||
}
|
}
|
||||||
$view['Type'] = "dir";
|
$view['Type'] = "dir";
|
||||||
@@ -419,12 +420,14 @@ if ($db_file) {
|
|||||||
if (is_serial($view['stat'])) {
|
if (is_serial($view['stat'])) {
|
||||||
$view['stat'] = unserialize($view['stat']);
|
$view['stat'] = unserialize($view['stat']);
|
||||||
}
|
}
|
||||||
$dirmdls = $dbo->query("SELECT rowid, * FROM mdls WHERE (rowid='".$view['rowid']."')")->fetch();
|
if ($myopts['spotlight']) {
|
||||||
|
$dirmdls = $dbo->query("SELECT rowid, * FROM mdls WHERE (rowid='".$view['rowid']."')")->fetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
|
||||||
echo "<a href='?db='><img class='tiny' src='icons/home.png'>Home</a> <span class='arrow'>► </span>";
|
echo "<a href='?db='><img class='tiny' src='yicons/home.png'>Home</a> <span class='arrow'>► </span>";
|
||||||
$dbs = glob(pathinfo($_GET['db'],PATHINFO_DIRNAME)."/????-??-??_??-??-??.sqlite3");
|
$dbs = glob(pathinfo($_GET['db'],PATHINFO_DIRNAME)."/????-??-??_??-??-??.sqlite3");
|
||||||
rsort($dbs);
|
rsort($dbs);
|
||||||
echo "<select>";
|
echo "<select>";
|
||||||
@@ -440,19 +443,19 @@ if ($db_file) {
|
|||||||
|
|
||||||
// Breadcrumbs
|
// Breadcrumbs
|
||||||
|
|
||||||
$crumb = breadcrumbs($zpath,$view['Pathname']);
|
$crumb = breadcrumbs($zpath,@$view['Pathname']);
|
||||||
$xc = "";
|
$xc = "";
|
||||||
|
|
||||||
foreach ($crumb as $myparts) {
|
foreach ($crumb as $myparts) {
|
||||||
if ($myparts[0] === null) {
|
if ($myparts[0] === null) {
|
||||||
if ($view['Type'] == "dir") {
|
if ($view['Type'] == "dir") {
|
||||||
$myicon = "icons/directory.png";
|
$myicon = "yicons/directory.png";
|
||||||
} else {
|
} else {
|
||||||
$myicon = "icons/null.png";
|
$myicon = "yicons/null.png";
|
||||||
}
|
}
|
||||||
$xc .= "<img class='tiny' src='".$myicon."'>".$myparts[1];
|
$xc .= "<img class='tiny' src='".$myicon."'>".$myparts[1];
|
||||||
} else {
|
} else {
|
||||||
$xc .= "<a href='?db=".$db_file."&pid=".$myparts[0]."'><img class='tiny' src='icons/directory.png'>".$myparts[1]."</a> <span class='arrow'>►</span> ";
|
$xc .= "<a href='?db=".$db_file."&pid=".$myparts[0]."'><img class='tiny' src='yicons/directory.png'>".$myparts[1]."</a> <span class='arrow'>►</span> ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$search) { echo $xc; echo "<hr>"; }
|
if (!$search) { echo $xc; echo "<hr>"; }
|
||||||
@@ -474,7 +477,6 @@ if ($db_file) {
|
|||||||
// File view
|
// File view
|
||||||
|
|
||||||
$skim_version = $dbo->query("SELECT version FROM _skim")->fetch()['version'];
|
$skim_version = $dbo->query("SELECT version FROM _skim")->fetch()['version'];
|
||||||
$spotlight_status = $dbo->query("SELECT mdutil FROM _skim")->fetch()['mdutil'];
|
|
||||||
|
|
||||||
$row_a = $dbo->query("SELECT rowid, * FROM files WHERE (pid='".$pid."')")->fetch();
|
$row_a = $dbo->query("SELECT rowid, * FROM files WHERE (pid='".$pid."')")->fetch();
|
||||||
if (!$row_a) { // this file doesn't exist in this version of the db
|
if (!$row_a) { // this file doesn't exist in this version of the db
|
||||||
@@ -488,7 +490,7 @@ if ($db_file) {
|
|||||||
$row_a['stat'] = unserialize($row_a['stat']);
|
$row_a['stat'] = unserialize($row_a['stat']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strpos($spotlight_status,"disabled")) {
|
if ($myopts['spotlight']) {
|
||||||
|
|
||||||
$row_b = $dbo->query("SELECT * FROM mdls WHERE (rowid='".$row_a['rowid']."')")->fetch();
|
$row_b = $dbo->query("SELECT * FROM mdls WHERE (rowid='".$row_a['rowid']."')")->fetch();
|
||||||
$row_e = @$dbo->query("SELECT * FROM milk WHERE (rowid='".$row_a['rowid']."')")->fetch();
|
$row_e = @$dbo->query("SELECT * FROM milk WHERE (rowid='".$row_a['rowid']."')")->fetch();
|
||||||
@@ -531,7 +533,7 @@ if ($db_file) {
|
|||||||
}
|
}
|
||||||
$icon = "<img ".$border." src='".$realfile."' width='".$width."' height='".$height."' class='lazyload'>";
|
$icon = "<img ".$border." src='".$realfile."' width='".$width."' height='".$height."' class='lazyload'>";
|
||||||
} elseif ($row_a['Type'] == "dir") {
|
} elseif ($row_a['Type'] == "dir") {
|
||||||
$icon = "<img src='/icons/directory.png' width='512' height='512'>";
|
$icon = "<img src='/yicons/directory.png' width='512' height='512'>";
|
||||||
} else {
|
} else {
|
||||||
$icon = "<img src='".findicon($row_a['Filename'])."' width='512' height='512'>";
|
$icon = "<img src='".findicon($row_a['Filename'])."' width='512' height='512'>";
|
||||||
}
|
}
|
||||||
@@ -548,7 +550,7 @@ if ($db_file) {
|
|||||||
$qlm = unserialize($qlm);
|
$qlm = unserialize($qlm);
|
||||||
$mytype = @$qlm['plugins'][@$row_b['ContentType']];
|
$mytype = @$qlm['plugins'][@$row_b['ContentType']];
|
||||||
if (!empty($mytype)) {
|
if (!empty($mytype)) {
|
||||||
echo "<br><br>QLGenerator used = ".$mytype."<br><br>";
|
echo "<br><br>QLGenerator delegate = ".$mytype."<br><br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,16 +591,16 @@ if ($db_file) {
|
|||||||
|
|
||||||
// parse old version stat
|
// parse old version stat
|
||||||
preg_match('/^Access: ([^\r\n]*)/m', $row_a['stat'], $access);
|
preg_match('/^Access: ([^\r\n]*)/m', $row_a['stat'], $access);
|
||||||
$fileinfo['atime (stat)'] = date("F jS, Y h:i:s",strtotime($access[1]));
|
$fileinfo['atime (stat)'] = date("F jS, Y h:i:s",strtotime(@$access[1]));
|
||||||
preg_match('/^Modify: ([^\r\n]*)/m', $row_a['stat'], $modify);
|
preg_match('/^Modify: ([^\r\n]*)/m', $row_a['stat'], $modify);
|
||||||
$fileinfo['mtime (stat)'] = date("F jS, Y h:i:s",strtotime($modify[1]));
|
$fileinfo['mtime (stat)'] = date("F jS, Y h:i:s",strtotime(@$modify[1]));
|
||||||
preg_match('/^Change: ([^\r\n]*)/m', $row_a['stat'], $change);
|
preg_match('/^Change: ([^\r\n]*)/m', $row_a['stat'], $change);
|
||||||
$fileinfo['ctime (stat)'] = date("F jS, Y h:i:s",strtotime($change[1]));
|
$fileinfo['ctime (stat)'] = date("F jS, Y h:i:s",strtotime(@$change[1]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row_b['spotlight']) {
|
if (@$row_b['spotlight']) {
|
||||||
$row_b['spotlight'] = $parser->parseString(utf8_for_xml($row_b['spotlight']));
|
$row_b['spotlight'] = $parser->parseString(utf8_for_xml($row_b['spotlight']));
|
||||||
$fileinfo['added (mdls)'] = date("F jS, Y h:i:s",$row_b['DateAdded']);
|
$fileinfo['added (mdls)'] = date("F jS, Y h:i:s",$row_b['DateAdded']);
|
||||||
$fileinfo['mtime (mdls)'] = date("F jS, Y h:i:s",$row_b['ContentModificationDate']);
|
$fileinfo['mtime (mdls)'] = date("F jS, Y h:i:s",$row_b['ContentModificationDate']);
|
||||||
@@ -629,19 +631,19 @@ if ($db_file) {
|
|||||||
|
|
||||||
r($row_a);
|
r($row_a);
|
||||||
|
|
||||||
if ($row_b['spotlight']) {
|
if (@$row_b['spotlight']) {
|
||||||
r($row_b);
|
r($row_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</td><td valign='top'>";
|
echo "</td><td valign='top'>";
|
||||||
|
|
||||||
if ($row_c) {
|
if (@$row_c) {
|
||||||
r(unserialize($row_c['tags']));
|
r(unserialize($row_c['tags']));
|
||||||
}
|
}
|
||||||
|
|
||||||
ref::config('expLvl', 2);
|
ref::config('expLvl', 2);
|
||||||
|
|
||||||
if ($row_d) {
|
if (@$row_d) {
|
||||||
|
|
||||||
if (substr($row_d['info'],0,5) == "<?xml") {
|
if (substr($row_d['info'],0,5) == "<?xml") {
|
||||||
r(json_decode(json_encode(simplexml_load_string(utf8_encode($row_d['info']))))->File->track);
|
r(json_decode(json_encode(simplexml_load_string(utf8_encode($row_d['info']))))->File->track);
|
||||||
@@ -672,13 +674,22 @@ if ($db_file) {
|
|||||||
echo "<table class='dir'><tr><td valign='top'>";
|
echo "<table class='dir'><tr><td valign='top'>";
|
||||||
echo "<div class='container'>";
|
echo "<div class='container'>";
|
||||||
|
|
||||||
$spotlight_status = $dbo->query("SELECT mdutil FROM _skim")->fetch()['mdutil'];
|
if ($myopts['spotlight']) {
|
||||||
|
|
||||||
$sql = "SELECT mdls.*, files.*, milk.* FROM files ";
|
$sql = "SELECT mdls.*, files.*, milk.* FROM files ";
|
||||||
$sql .= "LEFT JOIN mdls ON (files.rowid = mdls.rowid) ";
|
$sql .= "LEFT JOIN mdls ON (files.rowid = mdls.rowid) ";
|
||||||
$sql .= "LEFT JOIN milk ON (files.rowid = milk.rowid) ";
|
$sql .= "LEFT JOIN milk ON (files.rowid = milk.rowid) ";
|
||||||
$sql .= "WHERE files.rowid IN (".implode(",",$children).") ";
|
$sql .= "WHERE files.rowid IN (".implode(",",$children).") ";
|
||||||
$sql .= "ORDER BY files.Filename COLLATE NOCASE";
|
$sql .= "ORDER BY files.Filename COLLATE NOCASE";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$sql = "SELECT files.*, milk.* FROM files ";
|
||||||
|
$sql .= "LEFT JOIN milk ON (files.rowid = milk.rowid) ";
|
||||||
|
$sql .= "WHERE files.rowid IN (".implode(",",$children).") ";
|
||||||
|
$sql .= "ORDER BY files.Filename COLLATE NOCASE";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$rows = $dbo->query($sql)->fetchAll();
|
$rows = $dbo->query($sql)->fetchAll();
|
||||||
|
|
||||||
@@ -692,25 +703,16 @@ if ($db_file) {
|
|||||||
|
|
||||||
echo "<div class='item'>";
|
echo "<div class='item'>";
|
||||||
|
|
||||||
if ($item['FSInvisible'] | substr($item['Filename'],0,1) == ".") {
|
if (@$item['FSInvisible'] | substr($item['Filename'],0,1) == ".") {
|
||||||
$visibility = "hidden";
|
$visibility = "hidden";
|
||||||
} else {
|
} else {
|
||||||
$visibility = "unhidden";
|
$visibility = "unhidden";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
if (@$item['icon_filename']) {
|
||||||
// hack to preview mixed icon/thumb view
|
$realfile = dirname($db_file).$item['icon_filename'];
|
||||||
$opts = unserialize($dbo->query("SELECT opts FROM _skim")->fetch()['opts']);
|
$icon = "<img class='lazyload' data-src='".$realfile."' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
||||||
$skipicon = array("jpg","png","JPG","jpeg","tif","tiff","DNG","dng","NEF");
|
} elseif (@$item['thumb_filename']) {
|
||||||
if($item['icon_filename'] && !in_array($item['Extension'],$skipicon)) {
|
|
||||||
$item['thumb_filename'] = $item['icon_filename'];
|
|
||||||
$item['thumb_width'] = $opts['thumb_size'];
|
|
||||||
$item['thumb_height'] = $opts['thumb_size'];
|
|
||||||
$item['thumb_tool'] = "qltool";
|
|
||||||
}
|
|
||||||
////////////////////////////////////////////////
|
|
||||||
|
|
||||||
if ($item['thumb_filename']) {
|
|
||||||
$aspect = $item['thumb_width']/$item['thumb_height'];
|
$aspect = $item['thumb_width']/$item['thumb_height'];
|
||||||
if ($aspect > 1) {
|
if ($aspect > 1) {
|
||||||
$width = $icon_size;
|
$width = $icon_size;
|
||||||
@@ -719,24 +721,10 @@ if ($db_file) {
|
|||||||
$width = $icon_size*$aspect;
|
$width = $icon_size*$aspect;
|
||||||
$height = $icon_size;
|
$height = $icon_size;
|
||||||
}
|
}
|
||||||
if ($item['Type'] == "dir") {
|
|
||||||
$width = $width/2;
|
|
||||||
$height = $height/2;
|
|
||||||
}
|
|
||||||
$realfile = dirname($db_file).$item['thumb_filename'];
|
$realfile = dirname($db_file).$item['thumb_filename'];
|
||||||
if (array_key_exists("thumb_tool",$item)) {
|
$icon = "<img id='thumb' class='lazyload' data-src='".$realfile."' width='".$width."' height='".$height."' data-width='".$width."' data-height='".$height."'>";
|
||||||
if (in_array($item['thumb_tool'], $border_tools) && $item['Type'] != "dir") {
|
|
||||||
// put a border around images that are not icons
|
|
||||||
$border = "id='thumb'";
|
|
||||||
} else {
|
|
||||||
$border = "";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$border = "id='thumb'";
|
|
||||||
}
|
|
||||||
$icon = "<img ".$border." class='lazyload' data-src='".$realfile."' width='".$width."' height='".$height."' data-width='".$width."' data-height='".$height."'>";
|
|
||||||
} elseif ($item['Type'] == "dir") {
|
} elseif ($item['Type'] == "dir") {
|
||||||
$icon = "<img src='/icons/directory.png' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
$icon = "<img src='/yicons/directory.png' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
||||||
} else {
|
} else {
|
||||||
$icon = "<img src='".findicon($item['Filename'])."' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
$icon = "<img src='".findicon($item['Filename'])."' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
||||||
}
|
}
|
||||||
@@ -755,7 +743,7 @@ if ($db_file) {
|
|||||||
|
|
||||||
echo "<div class='title'>";
|
echo "<div class='title'>";
|
||||||
|
|
||||||
if ($item['UserTags']) {
|
if (@$item['UserTags']) {
|
||||||
foreach (unserialize($item['UserTags']) as $tag) {
|
foreach (unserialize($item['UserTags']) as $tag) {
|
||||||
echo "<span class='tag ".$tag."'></span>";
|
echo "<span class='tag ".$tag."'></span>";
|
||||||
}
|
}
|
||||||
@@ -793,7 +781,7 @@ if ($db_file) {
|
|||||||
|
|
||||||
r($view);
|
r($view);
|
||||||
|
|
||||||
if ($dirmdls['spotlight']) {
|
if (@$dirmdls['spotlight']) {
|
||||||
$dirmdls['spotlight'] = $parser->parseString(utf8_for_xml($dirmdls['spotlight']));
|
$dirmdls['spotlight'] = $parser->parseString(utf8_for_xml($dirmdls['spotlight']));
|
||||||
r($dirmdls);
|
r($dirmdls);
|
||||||
}
|
}
|
||||||
@@ -849,10 +837,10 @@ if ($db_file) {
|
|||||||
|
|
||||||
echo "<a href='#' class='toggler'>toggle all</a>";
|
echo "<a href='#' class='toggler'>toggle all</a>";
|
||||||
|
|
||||||
$icons['Disk image'] = "/icons/dmg.png";
|
$icons['Disk image'] = "/yicons/dmg.png";
|
||||||
$icons['Folder'] = "/icons/directory.png";
|
$icons['Folder'] = "/yicons/directory.png";
|
||||||
$icons['External disk'] = "/icons/firewire.png";
|
$icons['External disk'] = "/yicons/firewire.png";
|
||||||
$icons['Startup disk'] = "/icons/internal.png";
|
$icons['Startup disk'] = "/yicons/internal.png";
|
||||||
|
|
||||||
$bundles = glob($db_dir."/*.bundle");
|
$bundles = glob($db_dir."/*.bundle");
|
||||||
|
|
||||||
@@ -866,7 +854,7 @@ if ($db_file) {
|
|||||||
|
|
||||||
foreach ($sorted_bundles as $row) {
|
foreach ($sorted_bundles as $row) {
|
||||||
foreach ($row as $bundle) {
|
foreach ($row as $bundle) {
|
||||||
echo "<div id='bundle'>";
|
echo "<div id='bundle'>";
|
||||||
$dbs = array_reverse(glob($bundle."/????-??-??_??-??-??.sqlite3"));
|
$dbs = array_reverse(glob($bundle."/????-??-??_??-??-??.sqlite3"));
|
||||||
if ($dbs[0]) {
|
if ($dbs[0]) {
|
||||||
$dbo = new PDO("sqlite:".$dbs[0]);
|
$dbo = new PDO("sqlite:".$dbs[0]);
|
||||||
@@ -880,6 +868,7 @@ if ($db_file) {
|
|||||||
foreach ($dbs as $db_file) {
|
foreach ($dbs as $db_file) {
|
||||||
$dbo = new PDO("sqlite:".$db_file);
|
$dbo = new PDO("sqlite:".$db_file);
|
||||||
$info = $dbo->query("SELECT * FROM _skim")->fetch();
|
$info = $dbo->query("SELECT * FROM _skim")->fetch();
|
||||||
|
$status = "";
|
||||||
if (strpos($info['status'],"completed") === 0) {
|
if (strpos($info['status'],"completed") === 0) {
|
||||||
$seconds = str_replace("completed_in_","",$info['status']);
|
$seconds = str_replace("completed_in_","",$info['status']);
|
||||||
$s = (int)$seconds;
|
$s = (int)$seconds;
|
||||||
@@ -887,13 +876,14 @@ if ($db_file) {
|
|||||||
echo "<div>";
|
echo "<div>";
|
||||||
} else {
|
} else {
|
||||||
echo "<div class='aborted'>";
|
echo "<div class='aborted'>";
|
||||||
|
$status = $info['status'];
|
||||||
}
|
}
|
||||||
echo "<a href='?db=".$db_file."'>".pathinfo($db_file)['filename']."</a> ";
|
echo "<a href='?db=".$db_file."'>".pathinfo($db_file)['filename']."</a> ";
|
||||||
echo $info['version'].", ";
|
echo $info['version'].", ";
|
||||||
echo number_format($info['passed_total'])." files, ";
|
echo number_format($info['passed_total'])." files, ";
|
||||||
if ($info['image_file']) { echo $info['image_file'].", "; }
|
if ($info['image_file']) { echo $info['image_file'].", "; }
|
||||||
echo $status;
|
echo $status;
|
||||||
if (strpos($info['mdutil'],"disabled")) { echo " (no spotlight)"; }
|
if (strpos($info['mdutil'],"disabled")) { echo " (volume has spotlight disabled)"; }
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
@@ -905,7 +895,7 @@ if ($db_file) {
|
|||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
echo "<hr><div id='exectime'>".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds</div>";
|
echo "<hr><div id='exectime'>".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds</div>";
|
||||||
echo "<div>Skim version = ".$skim_version.", RTC Browser Version = ".$browser_version."</div>";
|
echo "<div>Skim version = ".@$skim_version.", RTC Browser Version = ".$browser_version."</div>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 233 KiB After Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 295 KiB After Width: | Height: | Size: 295 KiB |
|
Before Width: | Height: | Size: 779 KiB After Width: | Height: | Size: 779 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 681 KiB After Width: | Height: | Size: 681 KiB |
|
Before Width: | Height: | Size: 477 KiB After Width: | Height: | Size: 477 KiB |
|
Before Width: | Height: | Size: 466 KiB After Width: | Height: | Size: 466 KiB |
|
Before Width: | Height: | Size: 820 KiB After Width: | Height: | Size: 820 KiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 519 KiB After Width: | Height: | Size: 519 KiB |
|
Before Width: | Height: | Size: 756 KiB After Width: | Height: | Size: 756 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 284 KiB After Width: | Height: | Size: 284 KiB |
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
|
Before Width: | Height: | Size: 716 KiB After Width: | Height: | Size: 716 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 304 KiB After Width: | Height: | Size: 304 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 232 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 517 KiB After Width: | Height: | Size: 517 KiB |
|
Before Width: | Height: | Size: 327 KiB After Width: | Height: | Size: 327 KiB |
|
Before Width: | Height: | Size: 588 KiB After Width: | Height: | Size: 588 KiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 521 KiB After Width: | Height: | Size: 521 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 335 KiB After Width: | Height: | Size: 335 KiB |
|
Before Width: | Height: | Size: 335 KiB After Width: | Height: | Size: 335 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 215 KiB |
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 742 KiB After Width: | Height: | Size: 742 KiB |
|
Before Width: | Height: | Size: 672 KiB After Width: | Height: | Size: 672 KiB |
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |