You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

123 lines
19 KiB

<?php
namespace App\Console\Commands;
use App\BilibiliVideos;
use App\Services\CommonScrapeService;
use App\Services\FfmpegService;
use App\Services\FileService;
use App\Utils\FileUtils;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;
class CommonTest extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'common:test {path} {needDeleteAfterEncode=0} {needDeleteExistFiles=0}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// $arr1 = ["1000398462711009", "1000397316040213", "1000397154360946", "1000396023160142", "1000395772280868", "1000395770310607", "1000395764440447", "1000395749580620", "1000395737520585", "1000395728560369", "1000395665220010", "1000395182810260", "1000394432460475", "1000394082540135", "1000393949210659", "1000393948320985", "1000393888830044", "1000393887300041", "1000393885280607", "1000393871140899", "1000393874640278", "1000393855970088", "1000393851410761", "1000393851900113", "1000393224970230", "1000392769900267", "1000392752170065", "1000392399360563", "1000392336010495", "1000391730910775", "1000391657490475", "1000391640370731", "1000391642761007", "1000391642000760", "1000391635890577", "1000391534950041", "1000391634700625", "1000390226671010", "1000390217300827", "1000390196650608", "1000389960200187", "1000389892150216", "1000389873050304", "1000389860050560", "1000389066380090", "1000388971640050", "1000388604110777", "1000386518600752", "1000386387290405", "1000386350990489", "1000385646770495", "1000385647880305", "1000385599900591", "1000384981270190", "1000384610280911", "1000384278210040", "1000384277620018", "1000384247600248", "1000382954660496", "1000382532630959", "1000381279730287", "1000381023770185", "1000380679170566", "1000380672770752", "1000380605780918", "1000380540660479", "1000380533990236", "1000380334400447", "1000379619570140", "1000379614130566", "1000379614040540", "1000379215150342", "1000379091960012", "1000379074410600", "1000378356270974", "1000377413180060", "1000376937170982", "1000376930380927", "1000376796550520", "1000376729180951", "1000376495050278", "1000376488990545", "1000376424360895", "1000376418180325", "1000376355280244", "1000376331720057", "1000376319830884", "1000376289680850", "1000376272300030", "1000376268510358", "1000376264200636", "1000376257300865", "1000376246250787", "1000376254330018", "1000376249100938", "1000376241740589", "1000376243310981", "1000373103330115", "1000373091720141", "1000372327880350", "1000372308880571", "1000371971740555", "1000371974820428", "1000371689930846", "1000371579070071", "1000371563620745", "1000371554570402", "1000371481560879", "1000371475020722", "1000371466340092", "1000371453600533", "1000369063970626", "1000366941120287", "1000366794650511", "1000365341530899", "1000365306821015", "1000365256300575", "1000365228570858", "1000365040240113", "1000365012940938", "1000364956400772", "1000364956320093", "1000363533710154", "1000363307810125", "1000363070700309", "1000362170460175", "1000361917100540", "1000361906230502", "1000360007910474", "1000358747340754", "1000358712490262", "1000357888860566", "1000357425070691", "1000356422140612", "1000356302620386", "1000355737570354", "1000355147140013", "1000354832970013", "1000354400470672", "1000353260280322", "1000351325270526", "1000350815860700", "1000350813490531", "1000350587970769", "1000349348390725", "1000349022010513", "1000349014580575", "1000349013640320", "1000349012450116", "1000348857240827", "1000348818640454", "1000348611290804", "1000348585820675", "1000348588311008", "1000348584690761", "1000347836120187", "1000347617870576", "1000347398090398", "1000347392920992", "1000347387441022", "1000347002640251", "1000346990740282", "1000346413890381", "1000344947980340", "1000344617350545", "1000344188190025", "1000343800140622", "1000343586320054", "1000343478560283", "1000342755320256", "1000342101050886", "1000341761540534", "1000341745850267", "1000341707650664", "1000341649590430", "1000341581200218", "1000340897200429", "1000340225390161", "1000340210240271", "1000340185230923", "1000339820960457", "1000339820620635", "1000339657220642", "1000337908920684", "1000337755340334", "1000337585970778", "1000337573320409", "1000337312630389", "1000337122880852", "1000336602460156", "1000336437950786", "1000336413750819", "1000336355660485", "1000336343370928", "1000336336050974", "1000336166760797", "1000336165240704", "1000336124660853", "1000336092470065", "1000335536671014", "1000335496510188", "1000335499320977", "1000335492530115", "1000334072850532", "1000333783220684", "1000333520980286", "1000333516660727", "1000333427810435", "1000333052870950", "1000333048420924", "1000333042781017", "1000332771920138", "1000332664440816", "1000332653190685", "1000332650070198", "1000332632520675", "1000332616220167", "1000332477820676", "1000332423530625", "1000332336120670", "1000332222510402", "1000332061440784", "1000331975180152", "1000331937040339", "1000331919970321", "1000331897840036", "1000331168740913", "1000330966850836", "1000330828500784", "1000330802650358", "1000330747650108", "1000330723350451", "1000330607101003", "1000330571090106", "1000330563440837", "1000330441080975", "1000330356930957", "1000330131000467", "1000330028860845", "1000329681940301", "1000329660800951", "1000329434560308", "1000328857020065", "1000328748831004", "1000328725400248", "1000328716210870", "1000328714720971", "1000328686190947", "1000328098700915", "1000328098170730", "1000328087760350", "1000327998090127", "1000327763400924", "1000327615610312", "1000327608040816", "1000327453810946", "1000327427980817", "1000327414840120", "1000327407070970", "1000327388480390", "1000327377500428", "1000327365210430", "1000326955760600", "1000326375120864", "1000326216760306", "1000325928750643", "1000325910370888", "1000325745740781", "1000325746820920", "1000325740490009", "1000325727990867", "1000325727690141", "1000325611430403", "1000325610970357", "1000325596850453", "1000325428240341", "1000325172930127", "1000325150400309", "1000325139020730", "1000325135890788", "1000325055760878", "1000324930970035", "1000324920620346", "1000324858590867", "1000324847460664", "1000324806500388", "1000324795110865", "1000324778670927", "1000324774250007", "1000324764620285", "1000324764490086", "1000324758750153", "1000324758200042", "1000324757330842", "1000324742080778", "1000324193430875", "1000323972800352", "1000323935020891", "1000323930320707", "1000323929510070", "1000323929380269", "1000323019800989", "1000323012360777", "1000322709290450", "1000322356850841", "1000322116570089", "1000322117720057", "1000322037960204", "1000321977610883", "1000321957370404", "1000321757820686", "1000321752290496", "1000321745370508", "1000321357910480", "1000321340830008", "1000321105270820", "1000320741420901", "1000320729200334", "1000320037480149", "1000319981251017", "1000319981210441", "1000319599030866", "1000319589220819", "1000319575980604", "1000319569360703", "1000319549330298", "1000319529350747", "1000319423160242", "1000319306580056", "1000319172720472", "1000318965720531", "1000318839880424", "1000318833450317", "1000318738110263", "1000318680230168", "1000317948180361", "1000317873320642", "1000317774980950", "1000317346160658", "1000317185540243", "1000317171490612", "1000317173870624", "1000317172290373", "1000317080480791", "1000316974680096", "1000316899380256", "1000316866680714", "1000316497340862", "1000316070060650", "1000316029910058", "1000316008100945", "1000316012320482", "1000316004200271", "1000316003710486", "1000315998070788", "1000316001850467", "1000315997120100", "1000315994830218", "1000315559390978", "1000315557560742", "1000314011560407", "1000314012370436", "1000313900600214", "1000313848920798", "1000313820910583", "1000313765520910", "1000313653940800", "1000313645470777", "1000313312840115", "1000312804210130", "1000312804190130", "1000312756080480", "1000312677620482", "1000312644980847", "1000312537240130", "1000312529570990", "1000312501620040", "1000312317880890", "1000312176430762", "1000312168820522", "1000312149570004", "1000312152670606", "1000312139470607", "1000312131180297", "1000311806950954", "1000311733420586", "1000311526460136", "1000311396590979", "1000311396860732", "1000311387180790", "1000311386070687", "1000311385660769", "1000311205250538", "1000311202560165", "1000311047430594", "1000310846480244", "1000310699560253", "1000310465770313", "1000310455180503", "1000310454140525", "1000310450300556", "1000310444480098", "1000310287770046", "1000310219810246", "1000308853781000", "1000308774260863", "1000308741520705", "1000308701090931", "1000308699860426", "1000308673520628", "1000308662840613", "1000308603400259", "1000307552060092", "1000307189010337", "1000307138370342", "1000307072360525", "1000307057210066", "1000306987910164", "1000306986350443", "1000306979120002"];
// $arr2 = ["1000306979120002", "1000306986350443", "1000306987910164", "1000307057210066", "1000307138370342", "1000307189010337", "1000307552060092", "1000308662840613", "1000308673520628", "1000308699860426", "1000308701090931", "1000308741520705", "1000308774260863", "1000308853781000", "1000310450300556", "1000310455180503", "1000310465770313", "1000310699560253", "1000310846480244", "1000311047430594", "1000311202560165", "1000311205250538", "1000311386070687", "1000311387180790", "1000311396860732", "1000311396590979", "1000311733420586", "1000311806950954", "1000312131180297", "1000312152670606", "1000312149570004", "1000312168820522", "1000312176430762", "1000312501620040", "1000312529570990", "1000312537240130", "1000312644980847", "1000312756080480", "1000312804190130", "1000313312840115", "1000313645470777", "1000313765520910", "1000313820910583", "1000313848920798", "1000313900600214", "1000314012370436", "1000314011560407", "1000315557560742", "1000315559390978", "1000315997120100", "1000316001850467", "1000315998070788", "1000316003710486", "1000316004200271", "1000316012320482", "1000316029910058", "1000316497340862", "1000316866680714", "1000316899380256", "1000316974680096", "1000317080480791", "1000317172290373", "1000317173870624", "1000317171490612", "1000317185540243", "1000317346160658", "1000317774980950", "1000317873320642", "1000317948180361", "1000318680230168", "1000318833450317", "1000318839880424", "1000318965720531", "1000319172720472", "1000319306580056", "1000319423160242", "1000319529350747", "1000319549330298", "1000319569360703", "1000319575980604", "1000319589220819", "1000319599030866", "1000319981210441", "1000320729200334", "1000320741420901", "1000321105270820", "1000321340830008", "1000321745370508", "1000321752290496", "1000321757820686", "1000321957370404", "1000322037960204", "1000322117720057", "1000322356850841", "1000323012360777", "1000323019800989", "1000323929380269", "1000323929510070", "1000323930320707", "1000323935020891", "1000323972800352", "1000324742080778", "1000324757330842", "1000324758200042", "1000324758750153", "1000324764490086", "1000324764620285", "1000324774250007", "1000324778670927", "1000324795110865", "1000324806500388", "1000324858590867", "1000324930970035", "1000325055760878", "1000325139020730", "1000325172930127", "1000325596850453", "1000325610970357", "1000325727690141", "1000325727990867", "1000325740490009", "1000325746820920", "1000325745740781", "1000325910370888", "1000325928750643", "1000326216760306", "1000326375120864", "1000326955760600", "1000327365210430", "1000327377500428", "1000327388480390", "1000327407070970", "1000327414840120", "1000327427980817", "1000327453810946", "1000327608040816", "1000327615610312", "1000327763400924", "1000327998090127", "1000328087760350", "1000328098700915", "1000328686190947", "1000328716210870", "1000328725400248", "1000328748831004", "1000328857020065", "1000329434560308", "1000330028860845", "1000330131000467", "1000330356930957", "1000330441080975", "1000330563440837", "1000330607101003", "1000330747650108", "1000330802650358", "1000330828500784", "1000330966850836", "1000331168740913", "1000331897840036", "1000331937040339", "1000332061440784", "1000332222510402", "1000332477820676", "1000332616220167", "1000332632520675", "1000332650070198", "1000332653190685", "1000332664440816", "1000332771920138", "1000333042781017", "1000333048420924", "1000333052870950", "1000333427810435", "1000333516660727", "1000333520980286", "1000333783220684", "1000334072850532", "1000335492530115", "1000335499320977", "1000335496510188", "1000335536671014", "1000336092470065", "1000336124660853", "1000336165240704", "1000336336050974", "1000336343370928", "1000336413750819", "1000336437950786", "1000336602460156", "1000337122880852", "1000337312630389", "1000337585970778", "1000337908920684", "1000339657220642", "1000339820620635", "1000339820960457", "1000340185230923", "1000340210240271", "1000340225390161", "1000340897200429", "1000341581200218", "1000341649590430", "1000341707650664", "1000341745850267", "1000341761540534", "1000342101050886", "1000342755320256", "1000343478560283", "1000343586320054", "1000343800140622", "1000344617350545", "1000344947980340", "1000346413890381", "1000346990740282", "1000347002640251", "1000347387441022", "1000347392920992", "1000347398090398", "1000347617870576", "1000347836120187", "1000348584690761", "1000348588311008", "1000348585820675", "1000348611290804", "1000348818640454", "1000348857240827", "1000349012450116", "1000349013640320", "1000349014580575", "1000349022010513", "1000349348390725", "1000350587970769", "1000350813490531", "1000350815860700", "1000351325270526", "1000353260280322", "1000354832970013", "1000355737570354", "1000356302620386", "1000356422140612", "1000357425070691", "1000357888860566", "1000358712490262", "1000358747340754", "1000360007910474", "1000361906230502", "1000361917100540", "1000362170460175", "1000363070700309", "1000363307810125", "1000363533710154", "1000364956320093", "1000364956400772", "1000365012940938", "1000365040240113", "1000365228570858", "1000365256300575", "1000365306821015", "1000365341530899", "1000366794650511", "1000366941120287", "1000369063970626", "1000371453600533", "1000371466340092", "1000371475020722", "1000371481560879", "1000371554570402", "1000371563620745", "1000371579070071", "1000371689930846", "1000371974820428", "1000371971740555", "1000372308880571", "1000372327880350", "1000373091720141", "1000373103330115", "1000376243310981", "1000376241740589", "1000376249100938", "1000376254330018", "1000376246250787", "1000376257300865", "1000376264200636", "1000376268510358", "1000376272300030", "1000376289680850", "1000376319830884", "1000376355280244", "1000376418180325", "1000376488990545", "1000376495050278", "1000376729180951", "1000376796550520", "1000376930380927", "1000376937170982", "1000377413180060", "1000378356270974", "1000379074410600", "1000379091960012", "1000379215150342", "1000379614040540", "1000379614130566", "1000379619570140", "1000380533990236", "1000380540660479", "1000380605780918", "1000380672770752", "1000381023770185", "1000381279730287", "1000382532630959", "1000382954660496", "1000384247600248", "1000384277620018", "1000384278210040", "1000384610280911", "1000384981270190", "1000385599900591", "1000385647880305", "1000385646770495", "1000386350990489", "1000386387290405", "1000386518600752", "1000388604110777", "1000388971640050", "1000389066380090", "1000389860050560", "1000389892150216", "1000389960200187", "1000390217300827", "1000390226671010", "1000391534950041", "1000391635890577", "1000391642000760", "1000391642761007", "1000391640370731", "1000391657490475", "1000391730910775", "1000392336010495", "1000392399360563", "1000392752170065", "1000392769900267", "1000393224970230", "1000393851900113", "1000393851410761", "1000393855970088", "1000393874640278", "1000393871140899", "1000393885280607", "1000393887300041", "1000393888830044", "1000393948320985", "1000393949210659", "1000394082540135", "1000394432460475", "1000395182810260", "1000395665220010", "1000395728560369", "1000395737520585", "1000395749580620", "1000395770310607", "1000395772280868", "1000396023160142", "1000397154360946", "1000397316040213"];
// dump(json_encode(array_values(array_diff($arr1, $arr2))));exit;
// $fileService = new FileService();
// $fileService->compareLocalFilesAndGooglePhotoFiles();exit;
// echo App::environment();exit;
// $list = BilibiliVideos::where("created_at", ">", "2021-09-09 00:00:00")->get();
// dump($list[0]->getAttributes());exit;
date_default_timezone_set('PRC');
$path = $this->argument("path");
$service = new FfmpegService();
$needDeleteAfterEncode = $this->argument("needDeleteAfterEncode");
if (trim($needDeleteAfterEncode) == "1") {
$service->setNeedRemoveAfterEncode(true);
}
$needDeleteExistFiles = $this->argument("needDeleteExistFiles");
if (trim($needDeleteExistFiles) == "1") {
$service->setNeedRemoveExistFiles(true);
}
// $service->checkFileEncodeType();exit;
$service->processDir(trim($path));exit;
$cache = Cache::driver("redis");
$cache->tags(["aaa", "bbb"])->put("key1", "value1");
$cache->put("key2", "value2");
exit;
$this->testAnnie();exit;
$commonScrapeService = new CommonScrapeService();
$commonScrapeService->scrapeAlbum();exit;
dump(FileUtils::scanDuplicateDir("/Volumes/intel660p/image/xg/ycc"));exit;
$fileService = new FileService();
$fileService->segmentFiles("/Volumes/Samsung/weibo/old_image");
exit;
// Redis::set("hello", "123");
echo Redis::get("fullSet");
exit;
echo mb_strlen("霸气欣欣爷,内地画师,兼职推女神模特,毕业于广州美术学院国画系,自称广州沙画师彩绘师欣儿,一位猫咪爱好%E8");exit;
setlocale(LC_ALL,array('zh_CN.gbk','zh_CN.gb2312','zh_CN.gb18030'));
setlocale(LC_ALL, "zh_CN.UTF-8");
$p1 = pathinfo('D:\\atlas\\这是文件夹\\可爱胖胖是怎么变帅的#超能陆战队.mp4');
$p2 = pathinfo('D:\\atlas\\dirname\\sssss#ddddd.mp4');
print_r($p1);
print_r($p2);
//
}
public function testAnnie()
{
$result = shell_exec("annie -i av417536178");
echo $result;
preg_match_all("#\[(\d+)\]\s+-+\s+Quality:\s+[\S]+\s+720P#", $result, $match);
dump($match);
}
/**
* 重命名因 handbrake 编码后自动添加数字的文件
* @param $path
* @return bool
*/
public function renameHandBrakeRenamedFiles($path) {
$files = scandir($path);
foreach ($files as $file) {
if ($file == "." || $file == "..") {
continue;
}
preg_match_all("/(\s\d+)\.mp4/", $file, $matches);
if (array_key_exists(1, $matches) && array_key_exists(0, $matches[1])) {
$newFileName = str_replace($matches[0][0], ".mp4", $file);
rename($path . "/" . $file, $path . "/" . $newFileName);
// dump($path . "/" . $newFileName);
}
// dump($matches);
}
}
}