From 82a037429289f906baf9d248e9a20bb3202803dd Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Mon, 23 Dec 2013 16:09:58 +0100 Subject: [PATCH] [add] streaming link (m3u, RSS) --- .gitignore | 1 + bin/cronTask.sh.sample | 4 +- images/IconsSources~ | 0 images/playlist.svg | 744 +++++++++++++++++++++++++++++++++++++++++ images/rss.svg | 338 +++++++++++++++++++ inc/content.php | 17 +- index.php | 57 +++- style.css | 44 ++- 8 files changed, 1191 insertions(+), 14 deletions(-) delete mode 100644 images/IconsSources~ create mode 100644 images/playlist.svg create mode 100644 images/rss.svg diff --git a/.gitignore b/.gitignore index 93f74dc..dce5c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ videos bin/cronTask.sh option.php pagecache +*~ diff --git a/bin/cronTask.sh.sample b/bin/cronTask.sh.sample index 3b59ccf..6fa8c48 100644 --- a/bin/cronTask.sh.sample +++ b/bin/cronTask.sh.sample @@ -19,7 +19,7 @@ do then 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" + /usr/local/bin/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" convert "$urlHash.jpg" -resize 260 "$urlHash.thumb.jpg" sleep 10 if [ ! -f $urlHash.*.part ] @@ -30,6 +30,6 @@ do fi done < $file fi + rm $pageCache*.html done -rm $pageCache*.html # -rc_lookahead 16 -g 360 -threads 3 diff --git a/images/IconsSources~ b/images/IconsSources~ deleted file mode 100644 index e69de29..0000000 diff --git a/images/playlist.svg b/images/playlist.svg new file mode 100644 index 0000000..aaf123e --- /dev/null +++ b/images/playlist.svg @@ -0,0 +1,744 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/rss.svg b/images/rss.svg new file mode 100644 index 0000000..f4a097b --- /dev/null +++ b/images/rss.svg @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inc/content.php b/inc/content.php index 1c19abd..ab3aba1 100644 --- a/inc/content.php +++ b/inc/content.php @@ -139,7 +139,7 @@ if (!empty($breadcrumb)) { } echo ''; if (isset($_SESSION['cutFile']) && !empty($_SESSION['cutFile'])) { - echo '
Paste : ',substr($fullListFile[$_SESSION['cutFile']]['title'], 0, 18),'... here
'; + echo '
Paste here', substr($fullListFile[$_SESSION['cutFile']]['title'], 0, 22), '...
'; } if (empty($listCurrentDir) && empty($listCurrentFile)) { if ($ci['ac'] === 'confDelDir' && isLog()) { @@ -172,6 +172,14 @@ if (!empty($listCurrentDir) && $ci['ac'] !== 'view') { } } if (!empty($listCurrentFile) && $ci['ac'] !== 'view') { + echo ' +
+ +
'; $listCurrentFile = sortFile($listCurrentFile, $fullListFile, $ci['sort']); foreach ($listCurrentFile as $key => $value) { $thumb = ''; @@ -223,7 +231,6 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { if ($_SESSION['log'] === true) { echo '
Cut this video - Paste this video Use this thumbnail for folder thumbnail Delete this video
'; @@ -252,7 +259,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { Url - ', $videoInfo['url'], ' + ', $videoInfo['url'], ' Duration @@ -263,13 +270,13 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) { ', $videoInfo['size'], ' 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/index.php b/index.php index c0eb4f3..fbbf67c 100644 --- a/index.php +++ b/index.php @@ -276,9 +276,9 @@ function n_print($data, $name = '') {
'; echo ' - ', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], ' + ', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], ' '; - echo '
', htmlentities(print_r($data, 1)), '
'; + echo '
',       htmlentities(print_r($data, 1)), '
'; echo '

'; @@ -457,6 +457,50 @@ function listVideo($breadcrumb) { return glob("*.webm"); } +function makePLaylist($breadcrumb) { + $allFile = glob($GLOBALS['config']['VIDEODIR'].'/'.$breadcrumb."/*.webm"); + $m3u = ''; + foreach ($allFile as $value) { + $m3u .= 'http://'.$_SERVER['HTTP_HOST'].'/'.$value."\n"; + } + header('Content-type: text/plain'); + header("Content-Type: application/force-download"); + header("Content-Disposition: Attachment; filename=playlist.m3u"); + echo $m3u; + exit(); +} + +function makeRss($breadcrumb, $fullListFile) { + $allFile = glob($GLOBALS['config']['VIDEODIR'].'/'.$breadcrumb."/*.webm"); + $rss = ' + + + SoViGall + Sat, 07 Sep 2002 00:00:01 GMT + http://'.$_SERVER['HTTP_HOST'].''; + foreach ($allFile as $value) { + $oriValues = $value; + $hash = substr(str_replace('.webm','',$oriValues),-10, 10); + $rss .= ' + + '.html_entity_decode($fullListFile[$hash]['title'], ENT_QUOTES, "UTF-8").' + + '.html_entity_decode($fullListFile[$hash]['desc'], ENT_QUOTES, "UTF-8").' + Origin => '.$fullListFile[$hash]['url'].' + + '.date("D, d M Y H:i:s", strtotime($fullListFile[$hash]['uploadDateSort'])).' + http://'.$_SERVER['HTTP_HOST'].'/'.$value.' + + '; + } + $rss .= ' + +'; + header('Content-type: application/rss+xml; charset=UTF-8'); + echo $rss; + exit(); +} + function parseVideoDescription($file, $fullInfo = false) { $value = json_decode(file_get_contents($file)); } @@ -490,9 +534,6 @@ function getVideoInfo($file, $dir, $fullListFile) { return $info; } -function editVideoDescription() { -} - function getThumbnail($path, $value) { if (file_exists(getcwd().'/'.$value.'/thumb.jpg')) { return $path.$value.'/thumb.jpg'; @@ -676,6 +717,12 @@ function clearCache() { } } +if (isset($ci['ac']) && !empty($ci['ac']) && $ci['ac'] === 'm3u') { + makePLaylist($ci['bc']); +} +if (isset($ci['ac']) && !empty($ci['ac']) && $ci['ac'] === 'rss') { + makeRss($ci['bc'], $fullListFile); +} if (!empty($ci['ac']) && $ci['ac'] === 'login' && !empty($ci['op']) && (int)$ci['op'] === 2) { verifToken($ci['token']); if (login($ci) === true) { diff --git a/style.css b/style.css index 0cfdc5f..9bf38f9 100644 --- a/style.css +++ b/style.css @@ -47,6 +47,11 @@ body { background-color: #141414; } +.topMenu a:hover { + background-color: #333; + box-shadow: 1px 1px #000; +} + #breadcrumb { margin: 1.2em 0; } @@ -82,9 +87,8 @@ body { } .paste { - height: 2em; margin: 0; - padding: 0.2em; + padding: 0; border: 2px solid #dfdfdf; border-radius: 0.2em; background-color: #262626; @@ -93,6 +97,14 @@ body { .paste a { text-decoration: none; + vertical-align: middle; + height: 2em; + line-height: 2em; +} + +.paste img { + height: 2em; + float: left; } .dir, .video { @@ -120,6 +132,34 @@ body { width: 270px; } +#listFile .export, #listFile .export ul { + text-align: right; + margin: 0; + padding: 0; +} + +#listFile .export li { + display: inline-block; + list-style: none; + margin: 0; + padding: 0; + vertical-align: middle; +} + +#listFile .export a { + width: auto; + height: 24px; + display: inline-block; + border: none; + border-radius: none; + text-decoration: none; + text-align: center; + position: relative; + vertical-align: top; + margin: 0; + padding: 0; +} + #sort { padding: 0 0 0 32px; position: fixed;