Skip to content

Commit

Permalink
watermark m3u8 dplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
maysrp committed Jan 3, 2019
1 parent 21bc1a8 commit 255738d
Show file tree
Hide file tree
Showing 26 changed files with 540 additions and 201 deletions.
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -197,16 +197,19 @@ cron_download.py
- 视频转码
- 工具下载
- 后台转码控制
- Dplayer播放器
- 水印添加
- 视频切片

未来计划:
1. ~~分享功能~~
2. ~~用户转码功能~~
3. 积分功能
4. 邀请功能
5. ~~工具下载~~
6. 水印添加
7. M3U8添加
8. 自动播放转码
6. ~~水印添加~~
7. ~~M3U8添加~~
8. ~~自动播放转码~~



93 changes: 92 additions & 1 deletion app/admin/controller/MagnetController.php
Expand Up @@ -118,7 +118,7 @@ public function show_all_videofile(){
$dir['dir']=ROOT_PATH . 'public/file';
session('dir',$dir);
$where['del']=0;
$info=Db::name('vf')->where($where)->paginate(50);
$info=Db::name('vf')->where($where)->order('vid','desc')->paginate(50);
$this->assign('list',$info);
return $this->fetch('show_all_videofile');
}
Expand Down Expand Up @@ -158,6 +158,97 @@ public function del_share(){
}
return $this->error('删除失败');
}
public function logo(){
$file = request()->file('logo');
if($file){
$info = $file->validate(['size'=>'1001024','ext'=>'png,jpg,gif'])->move(ROOT_PATH . 'public/file' . DS . 'logo');
if($info){
$save=ROOT_PATH . 'public/file' . DS .'logo'.DS.$info->getSaveName();
$update['mid']=1;
$update['logo']=$save;
Db::name('magnet_site')->update($update);
$re['status']=true;
$re['con']=img_static($save);
}else{
$re['status']=false;
}
}else{
$re['status']=false;
}
return json($re);
}
public function logo_p(){
$position=input('param.position/d');
$tobo=input('param.tobo/d');
$leri=input('param.leri/d');
$update['mid']=1;
$update['position']=$position;
$update['tobo']=$tobo;
$update['leri']=$leri;
if(Db::name('magnet_site')->update($update)){
$re['status']=true;
}else{
$re['status']=false;
}
return json($re);
}
public function ts_start(){
$ts=input('param.ts/d');
$where['mid']=1;
$update['ts']=$ts;
if(Db::name('magnet_site')->where($where)->update($update)){
$re['status']=true;
if($ts){
$re['con']='已经设置切片';
}else{
$re['con']='已经取消切片';
}
}else{
$re['status']=false;
$re['con']='error';
}
return json($re);
}
public function ts_time(){
$tstime=input('param.tstime/d');
$where['mid']=1;
$update['tstime']=$tstime>2?$tstime:2;
if(Db::name('magnet_site')->where($where)->update($update)){
$re['status']=true;
$re['con']='已经设置切片时长'.$update['tstime'].'秒';
}else{
$re['status']=false;
$re['con']='error';
}
return json($re);
}
public function logo_start(){
$water=input('param.water/d');
$where['mid']=1;
$info=Db::name('magnet_site')->where($where)->find();
if($water){
if(!is_file($info['logo'])){
$re['status']=false;
$re['con']='请先设置水印图片';
return json($re);
}
}
$update['water']=$water;
if(Db::name('magnet_site')->where($where)->update($update)){
$re['status']=true;
if($water){
$re['con']='已经设置水印';
}else{
$re['con']='已经取消水印';
}
}else{
$re['status']=false;
$re['con']='error';

}
return json($re);
}
//////////
public function aria2_force(){
$info=aria2();
$result=isset($info['result'])?$info['result']:false;
Expand Down
4 changes: 2 additions & 2 deletions app/portal/controller/ShareController.php
Expand Up @@ -43,8 +43,8 @@ public function url_dir(){
$dir['name']=$share['uname']?$share['uname']:$share['name'];
session('save_mid',$share['mid']);
session('dir',$dir);//MID
session('mid',$share['mid']);
redis_dir($dir['dir']);
redis_dir($dir['dir']);
session('mid',$share['mid']);
return $this->fetch('url');
}
}
Expand Down
1 change: 0 additions & 1 deletion app/user/controller/MagnetController.php
Expand Up @@ -108,7 +108,6 @@ public function open_dir(){
$this->redirect('/dir.php');
}
$this->error('不存在该目录');

}
public function share(){
$mid=input('param.mid/d');
Expand Down
16 changes: 0 additions & 16 deletions public/a.php

This file was deleted.

2 changes: 1 addition & 1 deletion public/dir.php
Expand Up @@ -114,7 +114,7 @@ function type($file){
}
}
function download($file){
$key=$_SESSION['think']['redis'];
$key=$_SESSION['think']['redis'];
$file=strstr($file,'/file/').'?key='.$key;
return "<a href=\"".$file."\" ><span class=\"glyphicon glyphicon-download-alt\"></span></a>";
}
Expand Down
13 changes: 11 additions & 2 deletions public/file.php
Expand Up @@ -13,26 +13,35 @@
}
}
function abs2($file){
var_dump($file);
$dir=dirname($file);
$filename=basename($file);
chdir($dir);
$abs_dir=getcwd();
// var_dump($abs_dir.'/'.$filename);
return $abs_dir.'/'.$filename;
}
session_start();
$filedir=isset($_SESSION['think']['dir']['dir'])?$_SESSION['think']['dir']['dir']:'';
$file=isset($_SESSION['think']['file'])?$_SESSION['think']['file']:'';
$listdir=isset($_SESSION['think']['listdir'])?$_SESSION['think']['listdir']:'';
$log=isset($_SESSION['think']['log'])?$_SESSION['think']['log']:'';
$sfile=isset($_SESSION['think']['sfile'])?$_SESSION['think']['sfile']:'';
if($filedir||$file||$sfile||$log){
if($filedir||$file||$sfile||$log||$listdir){
$f1=getcwd().'/file/'.$_GET['file'];
$o1=abs2($f1);
$o2=abs2($_SESSION['think']['dir']['dir']);
if(in_array('/file/'.$_GET['file'],$file)||in_array('/file/'.$_GET['file'],$sfile)||in_array('/file/'.$_GET['file'],$log)){
header("Content-Type: application/octet-stream");
header("X-Accel-Redirect: /afile/" . $_GET['file']);
}
//O1
// var_dump($listdir);
// var_dump(in_array($o1,$listdir));
if(in_array(dirname($o1),$listdir)){
var_dump($listdir);
header("Content-Type: application/octet-stream");
header("X-Accel-Redirect: /afile/" . $_GET['file']);
}
if(strpos($o1,$o2)!==FALSE){
header("Content-Type: application/octet-stream");
header("X-Accel-Redirect: /afile/" . $_GET['file']);
Expand Down
2 changes: 1 addition & 1 deletion public/file/download/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Download</title>
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
Expand Down
12 changes: 12 additions & 0 deletions public/file/index.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

</body>
</html>
2 changes: 1 addition & 1 deletion public/file/log/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Log</title>
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
Expand Down
12 changes: 12 additions & 0 deletions public/file/logo/index.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

</body>
</html>
12 changes: 12 additions & 0 deletions public/file/torrent/index.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

</body>
</html>
12 changes: 12 additions & 0 deletions public/file/ts/index.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

</body>
</html>
2 changes: 1 addition & 1 deletion public/file/video/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Video</title>
<title>None</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Expand Up @@ -10,7 +10,7 @@
// [ 入口文件 ]

// 调试模式开关
define("APP_DEBUG", true);
define("APP_DEBUG", false);

// 定义CMF根目录,可更改此目录
define('CMF_ROOT', __DIR__ . '/../');
Expand Down

1 comment on commit 255738d

@maysrp
Copy link
Owner Author

@maysrp maysrp commented on 255738d Jan 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

水印 和 m3u8切片 添加

Please sign in to comment.