From e32e499c8f35e6321fac4d3f78662362c1e0c841 Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Fri, 9 Aug 2013 13:52:08 +0200 Subject: [PATCH] [add] thumb generation for preview of folder and video [add] option for active or not the cache [fix] change path of option.php --- bin/cronTask.sh.sample | 3 ++- images/noThumb.gif | Bin 0 -> 64 bytes inc/admin.php | 9 ++++++- inc/content.php | 18 ++++++++++--- inc/topMenu.php | 1 + index.php | 56 ++++++++++++++++++++++++++++++++++------- 6 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 images/noThumb.gif 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 0000000000000000000000000000000000000000..486cf56d57b4e6ee283d44e9473402a3cc02691e GIT binary patch literal 64 zcmZ?wbhEHbWMW`qXkcLY4+e_=1f7dg6H8K46v{J8G8EiBeFGR2f3h%gF)%XdFaQBa MIRg_@PcVZu0K?7^umAu6 literal 0 HcmV?d00001 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 '