diff --git a/bin/cronTask.sh.sample b/bin/cronTask.sh.sample index d38d439..ed9822c 100644 --- a/bin/cronTask.sh.sample +++ b/bin/cronTask.sh.sample @@ -19,7 +19,8 @@ do while read urlHash url destination do youtube-dl -R 0 -c --write-thumbnail --write-info-json --recode-video webm --no-check-certificate -f 45/46/37/45/22/44/35/34/5 -o "$urlHash.%(ext)s" "$url" - sleep 5 + convert "$urlHash.jpg" -resize 260 "$urlHash.thumb.jpg" + sleep 10 if [ ! -f $urlHash.*.part ] then rm $file diff --git a/images/noThumb.gif b/images/noThumb.gif new file mode 100644 index 0000000..486cf56 Binary files /dev/null and b/images/noThumb.gif differ diff --git a/inc/admin.php b/inc/admin.php index ad3b534..318cc40 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -5,5 +5,12 @@ if (!isLog()) { require 'inc/topMenu.php'; if (!empty($ci['ac']) && $ci['ac'] === 'viewQueue' && $_SESSION['log'] === true) { $getQueue = getQueue(); - echo 'You have ',$getQueue,' video in download queue.'; + echo 'You have ', $getQueue, ' video in download queue.'; } +if (!empty($ci['ac']) && $ci['ac'] === 'clearCache' && $_SESSION['log'] === true) { + if (clearCache() === true) { + echo 'Cache are clear.'; + } else { + echo 'Error on delete cache.'; + } +} \ No newline at end of file diff --git a/inc/content.php b/inc/content.php index fc402f4..79014a3 100644 --- a/inc/content.php +++ b/inc/content.php @@ -162,10 +162,20 @@ if (!empty($listCurrentDir) && $ci['ac'] !== 'view') { if (!empty($listCurrentFile) && $ci['ac'] !== 'view') { $listCurrentFile = sortFile($listCurrentFile, $fullListFile, $ci['sort']); foreach ($listCurrentFile as $key => $value) { + $thumb = ''; if ($key == 'thumb') { continue; } - echo '', $path.$key, '', $value['title'], ''; + if (file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$path.$key.'.thumb.jpg')) { + $thumb = $path.$key.'.thumb.jpg'; + } + if (empty($thumb) && file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$path.$key.'.jpg')) { + $thumb = makeThumb($path, $key); + } + if (empty($thumb)) { + $thumb = 'images/noThumb.gif'; + } + echo '', $path.$key, '', $value['title'], ''; } } echo ''; @@ -226,20 +236,20 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { Url - ', $videoInfo['url'], ' + ', $videoInfo['url'], ' Duration ', $videoInfo['duration'], ' Publish date - ', date("d m Y", strtotime($videoInfo['uploadDate'])), ' + ', date("d m Y", strtotime($videoInfo['uploadDate'])), ' Via '; if (!empty($videoInfo['via'])) { - echo '', $videoInfo['via'], ''; + echo '', $videoInfo['via'], ''; } else { echo ''; } diff --git a/inc/topMenu.php b/inc/topMenu.php index 2c55800..f502fbe 100644 --- a/inc/topMenu.php +++ b/inc/topMenu.php @@ -5,6 +5,7 @@ echo '