アカウントの動画

このコミットが含まれているのは:
守矢諏訪子 2022-02-10 02:28:54 +09:00
コミット 7e11ac4375
5個のファイルの変更47行の追加13行の削除

ファイルの表示

@ -8,39 +8,59 @@ use App\Http\Controllers\Peertube\Common;
class Account extends Common {
private $common;
private $count;
public function __construct () {
$this->common = new Common;
$this->count = 25;
}
public function index ($id, $cat='video-channels') {
public function index ($id, $cat='video-channels', $page=0) {
$res = [
'page' => 'account',
'style' => 'account',
'cat' => $cat,
'paginate' => $page,
'pagetotal' => 500,
'userinfo' => $this->common->user,
];
$res['owner'] = $this->getOwner($id);
if (!empty($res['owner'])) $res['owner']->totalVideo = 0;
$res['channel'] = $this->getChannel($id);
$res['channel'] = $this->getChannel($id, $cat, ($page*$this->count), $this->count);
if (!empty($res['owner'])) {
foreach ($res['channel']->data as $k => $v) {
$res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
$res['owner']->totalVideo += $res['channel']->data[$k]->video->total;
if ($cat == 'video-channels') {
$stats = $this->ptapi('/api/v1/accounts/'.$id.'/videos?start=0&count=0&skipCount=false&nsfw=both');
$res['owner']->totalVideo = $stats->total;
foreach ($res['channel']->data as $k => $v) {
$res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
$res['owner']->followersCount += $v->followersCount;
}
}
else {
$stats = $this->ptapi('/api/v1/accounts/'.$id.'/video-channels?start=0&count=20');
$res['owner']->totalVideo = $res['channel']->total;
foreach ($stats->data as $k => $v) {
$res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
$res['owner']->followersCount += $v->followersCount;
}
}
}
return view('pages.peertube.a', ['res' => $res]);
return view('pages.peertube.a', ['res' => $res, 'cat' => $cat]);
}
function getOwner ($id) {
return $this->ptapi('/api/v1/accounts/'.$id);
}
function getChannel ($id) {
return $this->ptapi('/api/v1/accounts/'.$id.'/video-channels?start=0&count=20&sort=-updatedAt&withStats=false');
function getChannel ($id, $cat, $start, $count) {
if ($cat == 'video-channels') $count = 5;
$sort = $cat == 'video-channels' ? '-updatedAt&withStats=false' : '-publishedAt&skipCount=false&nsfw=both';
return $this->ptapi('/api/v1/accounts/'.$id.'/'.$cat.'?start='.$start.'&count='.$count.'&sort='.$sort);
}
function getVideo ($id) {
return $this->ptapi('/api/v1/video-channels/'.$id.'/videos?start=0&count=5&sort=-publishedAt&nsfw=both');
return $this->ptapi('/api/v1/video-channels/'.$id.'/videos?start=0&count=5&sort=-publishedAt&skipCount=false&nsfw=both');
}
}

ファイルの表示

@ -2,10 +2,10 @@
<my-list-overflow>
<div class="d-flex align-items-center text-nowrap w-100 list-overflow-parent">
<span id="pe_0" class="ng-star-inserted" style="visibility: inherit;">
<a class="title-page ng-star-inserted active" href="/a/{{ ptFullHandle($res['owner']) }}/video-channels">チャンネル</a>
<a class="title-page ng-star-inserted{{ $cat == 'video-channels' ? ' active' : '' }}" href="/a/{{ ptFullHandle($res['owner']) }}/video-channels">チャンネル</a>
</span>
<span id="pe_1" class="ng-star-inserted" style="visibility: inherit;">
<a class="title-page ng-star-inserted" href="/a/{{ ptFullHandle($res['owner']) }}/videos">動画</a>
<a class="title-page ng-star-inserted{{ $cat == 'videos' ? ' active' : '' }}" href="/a/{{ ptFullHandle($res['owner']) }}/videos">動画</a>
</span>
</div>
</my-list-overflow>

ファイルの表示

@ -0,0 +1,10 @@
<div class="margin-content">
<div class="videos">
@foreach ($res['channel']->data as $v)
@include('layout.component.common.videominature')
@endforeach
</div>
@include('layout.component.common.paginate', [
'root' => '/a/'.$res['owner']->name.($res['owner']->host != 'video.076.ne.jp' ? '@'.$res['owner']->host : '').'/'.$res['cat']
])
</div>

ファイルの表示

@ -6,7 +6,11 @@
<div class="root ng-star-inserted">
@include('layout.component.a.info')
@include('layout.component.a.links')
@include('layout.component.a.channels')
@if ($cat == 'videos')
@include('layout.component.a.videos')
@else
@include('layout.component.a.channels')
@endif
</div>
</div>
</div>

ファイルの表示

@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
Route::any('/', 'Peertube\Home@index');
Route::any('/home', 'Peertube\Home@index');
Route::any('/a/{id}/{cat?}', 'Peertube\Account@index');
Route::any('/a/{id}/{cat?}/{page?}', 'Peertube\Account@index');
Route::any('/c/{id}/{cat?}/{page?}', 'Peertube\Channel@index');
Route::any('/w/{id}', 'Peertube\Watch@index');