This commit is contained in:
2019-05-23 07:08:51 -07:00
parent 4f090db179
commit 242d213a45
7 changed files with 56 additions and 19 deletions

View File

@@ -4,7 +4,7 @@
// Yuba RTC Browser
/////////////////////////////////////////////////////////////////
$browser_version = "0.7.10.5";
$browser_version = "0.7.12";
require "togggle.php";
require "lib/ref/ref.php";
@@ -286,11 +286,22 @@ function breadcrumbs($zpath, $pathname) {
}
function shortlabel($filename, $max = 40) {
if (strlen($filename) > $max) {
$prefix = substr($filename, 0, floor($max*.66));
$suffix = substr($filename, -floor($max*.33));
$return = $prefix."...".$suffix;
} else {
$return = $filename;
}
return $return;
}
function mb_shortlabel($filename, $max = 40) {
if (mb_strlen($filename, mb_detect_encoding($filename)) > $max) {
// more work is needed to figure out what is going on with non EN chars
//echo "(-) ";
$prefix = mb_substr($filename, 0, floor($max*.66), mb_detect_encoding($filename));
$suffix = substr($filename, -floor($max*.33));
$suffix = mb_substr($filename, -floor($max*.33));
$return = $prefix."...".$suffix;
} else {
$return = $filename;
@@ -338,21 +349,20 @@ if ($db_file) {
$pid = $dbo->query("SELECT pid FROM family WHERE (rowid=2)")->fetch()['pid'];
// handle special strings
$view['opts'] = unserialize($view['opts']);
$view['qlmanage'] = "hidden"; //array($view['qlmanage']);
$view['profile'] = "hidden"; //array($view['profile']);
$view['qlmanage'] = array($view['qlmanage']);
$view['profile'] = array($view['profile']);
if ($view['details']) {
$view['details'] = unserialize($view['details']);
}
if (substr($view['disks'],0,5) == "<?xml") {
//$view['disks'] = $parser->parseString(utf8_for_xml($view['disks']));
$view['disks'] = "hidden";
$view['disks'] = $parser->parseString(utf8_for_xml($view['disks']));
} else {
$view['disks'] = "hidden";
$view['disks'] = $view['disks'];
}
if (substr($view['diskutil'],0,5) == "<?xml") {
$view['diskutil'] = $parser->parseString(utf8_for_xml($view['diskutil']));
} else {
$view['diskutil'] = "hidden";
$view['diskutil'] = $view['diskutil'];
}
if ($view['vdisks']) {
$view['vdisks'] = $parser->parseString(utf8_for_xml($view['vdisks']));
@@ -466,7 +476,17 @@ if ($db_file) {
$width = $row_a['thumb_width'];
$height = $row_a['thumb_height'];
$realfile = dirname($db_file).$row_a['thumb_filename'];
$icon = "<img id='thumb' src='".$realfile."' width='".$width."' height='".$height."' class='lazyload'>";
if (array_key_exists("thumb_tool",$row_a)) {
if ($row_a['thumb_tool'] == "sips" || $row_a['thumb_tool'] == "ffmpeg" || $row_a['thumb_tool'] == "ql-thumbnail") {
// put a border around images that are not icons
$border = "id='thumb'";
} else {
$border = "";
}
} else {
$border = "id='thumb'";
}
$icon = "<img ".$border." src='".$realfile."' width='".$width."' height='".$height."' class='lazyload'>";
} elseif ($row_a['Type'] == "dir") {
$icon = "<img src='/icons/directory.png' width='512' height='512'>";
} else {
@@ -562,8 +582,13 @@ if ($db_file) {
ref::config('expLvl', 2);
if ($row_d) {
r(json_decode(json_encode(simplexml_load_string(utf8_encode($row_d['info']))))->File->track);
}
if (substr($row_d['info'],0,5) == "<?xml") {
r(json_decode(json_encode(simplexml_load_string(utf8_encode($row_d['info']))))->File->track);
} else {
r(json_decode(utf8_encode($row_d['info']), true)['media']['track']);
}
}
echo "</td>";
@@ -627,7 +652,17 @@ if ($db_file) {
$height = $icon_size;
}
$realfile = dirname($db_file).$item['thumb_filename'];
$icon = "<img id='thumb' class='lazyload' data-src='".$realfile."' width='".$width."' height='".$height."' data-width='".$width."' data-height='".$height."'>";
if (array_key_exists("thumb_tool",$item)) {
if ($item['thumb_tool'] == "sips" || $item['thumb_tool'] == "ffmpeg" || $item['thumb_tool'] == "ql-thumbnail") {
// 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") {
$icon = "<img src='/icons/directory.png' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
} else {
@@ -646,7 +681,7 @@ if ($db_file) {
echo "&nbsp;";
}
echo htmlentities(shortlabel($item['Filename']));
echo htmlentities(mb_shortlabel($item['Filename']));
echo "</div>";
@@ -720,8 +755,7 @@ if ($db_file) {
foreach ($sorted_bundles as $key => $bundle) {
echo "<div id='bundle'>";
$dbs = array_reverse(glob($bundle."/*.sqlite3"));
array_shift($dbs);
$dbs = array_reverse(glob($bundle."/????-??-??_??-??-??.sqlite3"));
if ($dbs[0]) {
$dbo = new PDO("sqlite:".$dbs[0]);
$type = $dbo->query("SELECT type FROM _skim")->fetch()['type'];
@@ -736,7 +770,8 @@ if ($db_file) {
$info = $dbo->query("SELECT * FROM _skim")->fetch();
if (strpos($info['status'],"completed") === 0) {
$seconds = str_replace("completed_in_","",$info['status']);
$status = gmdate("H:i:s",$seconds);
$s = (int)$seconds;
$status = sprintf("%02d:%02d:%02d:%02d", $s/86400, $s/3600%24, $s/60%60, $s%60);
echo "<div>";
} else {
echo "<div class='aborted'>";