アカウントの動画
このコミットが含まれているのは:
コミット
7e11ac4375
|
@ -8,39 +8,59 @@ use App\Http\Controllers\Peertube\Common;
|
||||||
|
|
||||||
class Account extends Common {
|
class Account extends Common {
|
||||||
private $common;
|
private $common;
|
||||||
|
private $count;
|
||||||
|
|
||||||
public function __construct () {
|
public function __construct () {
|
||||||
$this->common = new Common;
|
$this->common = new Common;
|
||||||
|
$this->count = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index ($id, $cat='video-channels') {
|
public function index ($id, $cat='video-channels', $page=0) {
|
||||||
$res = [
|
$res = [
|
||||||
'page' => 'account',
|
'page' => 'account',
|
||||||
'style' => 'account',
|
'style' => 'account',
|
||||||
'cat' => $cat,
|
'cat' => $cat,
|
||||||
|
'paginate' => $page,
|
||||||
|
'pagetotal' => 500,
|
||||||
'userinfo' => $this->common->user,
|
'userinfo' => $this->common->user,
|
||||||
];
|
];
|
||||||
|
|
||||||
$res['owner'] = $this->getOwner($id);
|
$res['owner'] = $this->getOwner($id);
|
||||||
if (!empty($res['owner'])) $res['owner']->totalVideo = 0;
|
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'])) {
|
if (!empty($res['owner'])) {
|
||||||
foreach ($res['channel']->data as $k => $v) {
|
if ($cat == 'video-channels') {
|
||||||
$res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
|
$stats = $this->ptapi('/api/v1/accounts/'.$id.'/videos?start=0&count=0&skipCount=false&nsfw=both');
|
||||||
$res['owner']->totalVideo += $res['channel']->data[$k]->video->total;
|
$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) {
|
function getOwner ($id) {
|
||||||
return $this->ptapi('/api/v1/accounts/'.$id);
|
return $this->ptapi('/api/v1/accounts/'.$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannel ($id) {
|
function getChannel ($id, $cat, $start, $count) {
|
||||||
return $this->ptapi('/api/v1/accounts/'.$id.'/video-channels?start=0&count=20&sort=-updatedAt&withStats=false');
|
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) {
|
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>
|
<my-list-overflow>
|
||||||
<div class="d-flex align-items-center text-nowrap w-100 list-overflow-parent">
|
<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;">
|
<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>
|
||||||
<span id="pe_1" class="ng-star-inserted" style="visibility: inherit;">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</my-list-overflow>
|
</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">
|
<div class="root ng-star-inserted">
|
||||||
@include('layout.component.a.info')
|
@include('layout.component.a.info')
|
||||||
@include('layout.component.a.links')
|
@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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
|
||||||
Route::any('/', 'Peertube\Home@index');
|
Route::any('/', 'Peertube\Home@index');
|
||||||
Route::any('/home', '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('/c/{id}/{cat?}/{page?}', 'Peertube\Channel@index');
|
||||||
Route::any('/w/{id}', 'Peertube\Watch@index');
|
Route::any('/w/{id}', 'Peertube\Watch@index');
|
||||||
|
|
||||||
|
|
新しいイシューから参照