このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
LightPeer/app/Http/Controllers/Peertube/Channel.php

45 行
1.3 KiB
PHP

<?php
namespace App\Http\Controllers\Peertube;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Http\Controllers\Peertube\Common;
// use Illuminate\Support\Facades\Log;
class Channel extends Common {
private $common;
private $count;
public function __construct () {
$this->common = new Common;
$this->count = 25;
}
public function index ($id, $cat='videos', $page=0) {
$res = [
'page' => 'channel',
'style' => 'channel',
'cat' => $cat,
'paginate' => $page,
'pagetotal' => 500,
'userinfo' => $this->common->user,
];
$res['channel'] = $this->getChannel($id);
$res['video'] = $cat == 'video-playlists' ? $this->getPlaylist($id, ($page*$this->count), $this->count) : $this->getVideo($id, ($page*$this->count), $this->count);
$res['pagetotal'] = $res['video']->total;
return view('pages.peertube.c', ['res' => $res]);
}
function getChannel ($id) {
return $this->ptapi('/api/v1/video-channels/'.$id);
}
function getVideo ($id, $start, $count) {
return $this->ptapi('/api/v1/video-channels/'.$id.'/videos?start='.$start.'&count='.$count.'&sort=-publishedAt&skipCount=false&nsfw=both');
}
function getPlaylist ($id, $start, $count) {
return $this->ptapi('/api/v1/video-channels/'.$id.'/video-playlists?start='.$start.'&count='.$count);
}
}