- Add Gb to unit,

- Add lmb_news_json_ld() function,
- Now track video codec in video,
- Add multiple resulution support to video.
This commit is contained in:
2018-10-04 17:55:10 +02:00
parent dd233b73c0
commit cb5ae1985e

View File

@@ -1,13 +1,13 @@
<? <?
// $RCSfile: lmbrowse.php,v $ // $RCSfile: lmbrowse.php,v $
// $Revision: 1.19 $ // $Revision: 1.17 $
// $Name: $ // $Name: lmbrowse-1_6_0-1 $
// $Date: 2016/05/05 16:17:29 $ // $Date: 2016/03/21 16:07:30 $
// $Author: agibert $ // $Author: agibert $
/* /*
* LMBrowse - Langueur Monotone Browser * LMBrowse - Langueur Monotone Browser
* Copyright (C) 2012-2015 Arnaud G. GIBERT * Copyright (C) 2012-2018 Arnaud G. GIBERT
* mailto:arnaud@rx3.net * mailto:arnaud@rx3.net
* http://www.rx3.org/dvp/lmbrowse * http://www.rx3.org/dvp/lmbrowse
* *
@@ -42,7 +42,7 @@ $time_start = microtime_float();
include "lmbrowse_config.inc"; include "lmbrowse_config.inc";
$lmb_myname="LMBrowse"; $lmb_myname="LMBrowse";
$lmb_tag_tab=explode( " ", "\$Name: $"); $lmb_tag_tab=explode( " ", "\$Name: lmbrowse-1_6_0-1 $");
$lmb_tag_tab=explode( "-", $lmb_tag_tab[1]); $lmb_tag_tab=explode( "-", $lmb_tag_tab[1]);
$lmb_myver=strtr( "$lmb_tag_tab[1]-$lmb_tag_tab[2]", "_", "."); $lmb_myver=strtr( "$lmb_tag_tab[1]-$lmb_tag_tab[2]", "_", ".");
@@ -172,6 +172,7 @@ function lmb_cookies_load()
global $lmb_cookie_tab; global $lmb_cookie_tab;
lmb_cookie_load( "video_res", "1080p");
lmb_cookie_load( "jpsolution", "html, flash"); lmb_cookie_load( "jpsolution", "html, flash");
lmb_cookie_load( "admin", ""); lmb_cookie_load( "admin", "");
} }
@@ -268,7 +269,7 @@ function lmb_admin_update()
function lmb_size_convert( $size) function lmb_size_convert( $size)
{ {
$unit_tab = array( "b", "Kb", "Mb"); $unit_tab = array( "b", "Kb", "Mb", "Gb");
for( $i = 0; $size > 1024; $i++) for( $i = 0; $size > 1024; $i++)
@@ -981,6 +982,53 @@ function lmb_news_tab_get( )
/*--------------------------------------------------------------------------------------------------------------------*/
/* News JSON-LD */
/*--------------------------------------------------------------------------------------------------------------------*/
function lmb_news_json_ld( $news_tab)
{
global $lmb_url_post;
for( $i=0; $i < count($news_tab); $i++)
{
echo "<script type=\"application/ld+json\"> {
\"@context\": {
\"ical\": \"http://www.w3.org/2002/12/cal/ical#\",
\"xsd\": \"http://www.w3.org/2001/XMLSchema#\",
\"ical:dtstart\": {
\"@type\": \"xsd:dateTime\"
}
},
";
if( "{$news_tab[$i]["news"]}" == "")
{
echo " \"ical:summary\": \"{$news_tab[$i]["title"]}: {$news_tab[$i]["name"]}\",
\"ical:description\": \"{$news_tab[$i]["title"]}: {$news_tab[$i]["name"]}\",
\"ical:url\": \"{$news_tab[$i]["alink"]}\",
\"ical:attach\": \"{$news_tab[$i]["aimg"]}\",
";
}
else
{
echo " \"ical:summary\": \"{$news_tab[$i]["title"]}\",
\"ical:description\": \"{$news_tab[$i]["news"]}\",
\"ical:url\": \"http://www.langueur-monotone.com/\",
\"ical:attach\": \"http://www.langueur-monotone.com/skin/images/lm-logo2-96.png\",
";
}
echo " \"ical:dtstart\": \"{$news_tab[$i]["date"]}\"
}</script>
";
}
}
/*--------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------*/
/* News Tab */ /* News Tab */
/*--------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------*/
@@ -992,6 +1040,8 @@ function lmb_news_tab( $skin_path)
$news_tab = lmb_news_tab_get(); $news_tab = lmb_news_tab_get();
lmb_news_json_ld( $news_tab);
ob_start(); ob_start();
for( $i=0; $i < count($news_tab); $i++) for( $i=0; $i < count($news_tab); $i++)
@@ -2333,9 +2383,9 @@ function lmb_video_file_tab_get( $play_type, $play_id, $play_priority, $video_id
{ {
if( $mode == "MULTI") if( $mode == "MULTI")
{ {
$file_tab[$i]["url"] = "{$lmb_url_post}?page=download&amp;type={$play_type}&amp;id={$play_id}&amp;priority={$play_priority}&amp;dtype=video&amp;vformat={$video_format}"; $file_tab[$i]["url"] = "{$lmb_url_post}?page=download&amp;type={$play_type}&amp;id={$play_id}&amp;priority={$play_priority}&amp;dtype=video&amp;vformat={$video_format}.{$video_codec}";
$file_size = lmb_download_videos( $play_type, $play_id, $play_priority, $video_format, "SIZE"); $file_size = lmb_download_videos( $play_type, $play_id, $play_priority, "{$video_format}.{$video_codec}", "SIZE");
$size_tab = lmb_size_convert( $file_size); $size_tab = lmb_size_convert( $file_size);
} }
else else
@@ -2416,7 +2466,7 @@ function lmb_videolist( $play_type, $play_id, $play_priority, $skin_path)
ob_start(); ob_start();
$cmd="ls {$video_path}/* | sed -e 's/.*\.//' | grep -v \"png\" | sort -ru"; $cmd="ls {$video_path}/* | sed -e 's/.*\.//' | grep -v \"png\" | sort -u";
exec($cmd, $codec_tab); exec($cmd, $codec_tab);
if( count( $codec_tab) == 0 || ( file_exists( "{$video_path}/.hide" ) && ! lmb_admin_is())) if( count( $codec_tab) == 0 || ( file_exists( "{$video_path}/.hide" ) && ! lmb_admin_is()))
@@ -3490,6 +3540,7 @@ function lmb_track_video( $play_type, $play_id, $play_priority, $track_id, $trac
$video_res_cookie = "video_res"; $video_res_cookie = "video_res";
$prefix_url = "{$lmb_url_post}?cookie_id={$video_res_cookie}&cookie_value="; $prefix_url = "{$lmb_url_post}?cookie_id={$video_res_cookie}&cookie_value=";
$query_string = preg_replace( "/cookie_id={$video_res_cookie}&cookie_value=[^&]*&/", "", "{$_SERVER['QUERY_STRING']}"); $query_string = preg_replace( "/cookie_id={$video_res_cookie}&cookie_value=[^&]*&/", "", "{$_SERVER['QUERY_STRING']}");
$video_res_1440p_url = htmlentities( "{$prefix_url}1440p&{$query_string}");
$video_res_1080p_url = htmlentities( "{$prefix_url}1080p&{$query_string}"); $video_res_1080p_url = htmlentities( "{$prefix_url}1080p&{$query_string}");
$video_res_720p_url = htmlentities( "{$prefix_url}720p&{$query_string}"); $video_res_720p_url = htmlentities( "{$prefix_url}720p&{$query_string}");
$video_res_360p_url = htmlentities( "{$prefix_url}360p&{$query_string}"); $video_res_360p_url = htmlentities( "{$prefix_url}360p&{$query_string}");
@@ -3498,15 +3549,21 @@ function lmb_track_video( $play_type, $play_id, $play_priority, $track_id, $trac
$video_res_tab = array(); $video_res_tab = array();
if( "{$video_res}" == "")
{
$video_res = "1080p";
}
switch("{$video_res}") switch("{$video_res}")
{ {
case "1440p":
{
$video_res_1440p_class = "link-item-disabled";
$video_res_1080p_class = "link-item";
$video_res_720p_class = "link-item";
$video_res_360p_class = "link-item";
break;
}
case "1080p": case "1080p":
{ {
$video_res_1440p_class = "link-item";
$video_res_1080p_class = "link-item-disabled"; $video_res_1080p_class = "link-item-disabled";
$video_res_720p_class = "link-item"; $video_res_720p_class = "link-item";
$video_res_360p_class = "link-item"; $video_res_360p_class = "link-item";
@@ -3516,6 +3573,7 @@ function lmb_track_video( $play_type, $play_id, $play_priority, $track_id, $trac
case "720p": case "720p":
{ {
$video_res_1440p_class = "link-item";
$video_res_1080p_class = "link-item"; $video_res_1080p_class = "link-item";
$video_res_720p_class = "link-item-disabled"; $video_res_720p_class = "link-item-disabled";
$video_res_360p_class = "link-item"; $video_res_360p_class = "link-item";
@@ -3525,6 +3583,7 @@ function lmb_track_video( $play_type, $play_id, $play_priority, $track_id, $trac
case "360p": case "360p":
{ {
$video_res_1440p_class = "link-item";
$video_res_1080p_class = "link-item"; $video_res_1080p_class = "link-item";
$video_res_720p_class = "link-item"; $video_res_720p_class = "link-item";
$video_res_360p_class = "link-item-disabled"; $video_res_360p_class = "link-item-disabled";
@@ -3573,7 +3632,7 @@ Your browser does not support the video tag.
<tr style=\"background-color:#222222; height: 25px;\"> <tr style=\"background-color:#222222; height: 25px;\">
<td class=\"videos5\" style=\"width: 5px;\"></td> <td class=\"videos5\" style=\"width: 5px;\"></td>
<td style=\"horizontal-align: left; vertical-align: middle;\"> <td style=\"horizontal-align: left; vertical-align: middle;\">
<div style=\"font-size: 12px;\"><a rel=\"nofollow\" class=\"{$video_res_1080p_class}\" href=\"{$video_res_1080p_url}\">1080p</a>&nbsp;<a rel=\"nofollow\" class=\"{$video_res_720p_class}\" href=\"{$video_res_720p_url}\">720p</a>&nbsp;<a rel=\"nofollow\" class=\"{$video_res_360p_class}\" href=\"{$video_res_360p_url}\">360p</a></div> <div style=\"font-size: 12px;\"><a rel=\"nofollow\" class=\"{$video_res_1440p_class}\" href=\"{$video_res_1440p_url}\">1440p</a>&nbsp;<a rel=\"nofollow\" class=\"{$video_res_1080p_class}\" href=\"{$video_res_1080p_url}\">1080p</a>&nbsp;<a rel=\"nofollow\" class=\"{$video_res_720p_class}\" href=\"{$video_res_720p_url}\">720p</a>&nbsp;<a rel=\"nofollow\" class=\"{$video_res_360p_class}\" href=\"{$video_res_360p_url}\">360p</a></div>
</td> </td>
<td class=\"videos5\" style=\"width: 5px;\"></td> <td class=\"videos5\" style=\"width: 5px;\"></td>
</tr> </tr>
@@ -3883,7 +3942,7 @@ function lmb_download_covers( $play_type, $play_id, $play_priority, $cover_forma
function lmb_download_videos( $play_type, $play_id, $play_priority, $video_format, $mode) function lmb_download_videos( $play_type, $play_id, $play_priority, $video_format, $mode)
{ {
$play_dir = lmb_play_path_get( $play_type, $play_id, $play_priority); $play_dir = lmb_play_path_get( $play_type, $play_id, $play_priority);
$file_list = "videos/*-{$video_format}.mp4"; $file_list = "videos/*-{$video_format}";
return( lmb_download_file( $play_dir, $file_list, $mode, "{$play_id}-{$video_format}")); return( lmb_download_file( $play_dir, $file_list, $mode, "{$play_id}-{$video_format}"));
} }