mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-12 08:26:44 +01:00
Adopt Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
This commit is contained in:
parent
a1522f3cd7
commit
263ea48c5b
390 changed files with 43866 additions and 44115 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -59,20 +59,19 @@ class AddTrackToPlaylistCommand extends CommandBase
|
||||||
// check if this track is already in the playlist
|
// check if this track is already in the playlist
|
||||||
$validator = Validator::make(
|
$validator = Validator::make(
|
||||||
['track_id' => $this->_track->id],
|
['track_id' => $this->_track->id],
|
||||||
['track_id' => "unique:playlist_track,track_id,null,id,playlist_id,{$this->_playlist->id}", ]
|
['track_id' => "unique:playlist_track,track_id,null,id,playlist_id,{$this->_playlist->id}"]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$songIndex = $this->_playlist->trackCount() + 1;
|
$songIndex = $this->_playlist->trackCount() + 1;
|
||||||
$this->_playlist->tracks()->attach($this->_track, ['position' => $songIndex]);
|
$this->_playlist->tracks()->attach($this->_track, ['position' => $songIndex]);
|
||||||
$this->_playlist->touch();
|
$this->_playlist->touch();
|
||||||
|
|
||||||
Playlist::where('id', $this->_playlist->id)->update([
|
Playlist::where('id', $this->_playlist->id)->update([
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$this->_playlist->id.')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$this->_playlist->id.')'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return CommandResponse::succeed(['message' => 'Track added!']);
|
return CommandResponse::succeed(['message' => 'Track added!']);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -37,7 +37,7 @@ class CommandResponse
|
||||||
|
|
||||||
public static function fail($validatorOrMessages, int $statusCode = 400)
|
public static function fail($validatorOrMessages, int $statusCode = 400)
|
||||||
{
|
{
|
||||||
$response = new CommandResponse();
|
$response = new self();
|
||||||
$response->_didFail = true;
|
$response->_didFail = true;
|
||||||
$response->_statusCode = $statusCode;
|
$response->_statusCode = $statusCode;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class CommandResponse
|
||||||
|
|
||||||
public static function succeed($response = null, int $statusCode = 200)
|
public static function succeed($response = null, int $statusCode = 200)
|
||||||
{
|
{
|
||||||
$cmdResponse = new CommandResponse();
|
$cmdResponse = new self();
|
||||||
$cmdResponse->_didFail = false;
|
$cmdResponse->_didFail = false;
|
||||||
$cmdResponse->_response = $response;
|
$cmdResponse->_response = $response;
|
||||||
$cmdResponse->_statusCode = $statusCode;
|
$cmdResponse->_statusCode = $statusCode;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Gate;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use Auth;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
|
use Gate;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreateAlbumCommand extends CommandBase
|
class CreateAlbumCommand extends CommandBase
|
||||||
|
@ -60,7 +60,7 @@ class CreateAlbumCommand extends CommandBase
|
||||||
'cover' => 'image|mimes:png|min_width:350|min_height:350',
|
'cover' => 'image|mimes:png|min_width:350|min_height:350',
|
||||||
'cover_id' => 'exists:images,id',
|
'cover_id' => 'exists:images,id',
|
||||||
'track_ids' => 'exists:tracks,id',
|
'track_ids' => 'exists:tracks,id',
|
||||||
'user_id' => 'exists:users,id'
|
'user_id' => 'exists:users,id',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($this->_input, $rules);
|
$validator = Validator::make($this->_input, $rules);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Gate;
|
|
||||||
use App\Models\Announcement;
|
use App\Models\Announcement;
|
||||||
|
use Gate;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreateAnnouncementCommand extends CommandBase
|
class CreateAnnouncementCommand extends CommandBase
|
||||||
|
@ -48,7 +48,6 @@ class CreateAnnouncementCommand extends CommandBase
|
||||||
*/
|
*/
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|max:50',
|
'name' => 'required|max:50',
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Notification;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Comment;
|
use App\Models\Comment;
|
||||||
use App\Models\Playlist;
|
use App\Models\Playlist;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Notification;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreateCommentCommand extends CommandBase
|
class CreateCommentCommand extends CommandBase
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Models\Genre;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Models\Genre;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreateGenreCommand extends CommandBase
|
class CreateGenreCommand extends CommandBase
|
||||||
|
@ -53,12 +53,12 @@ class CreateGenreCommand extends CommandBase
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|unique:genres,name,NULL,id,deleted_at,NULL|max:50',
|
'name' => 'required|unique:genres,name,NULL,id,deleted_at,NULL|max:50',
|
||||||
'slug' => 'required|unique:genres,slug,NULL,id,deleted_at,NULL'
|
'slug' => 'required|unique:genres,slug,NULL,id,deleted_at,NULL',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make([
|
$validator = Validator::make([
|
||||||
'name' => $this->_genreName,
|
'name' => $this->_genreName,
|
||||||
'slug' => $slug
|
'slug' => $slug,
|
||||||
], $rules);
|
], $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
@ -67,7 +67,7 @@ class CreateGenreCommand extends CommandBase
|
||||||
|
|
||||||
Genre::create([
|
Genre::create([
|
||||||
'name' => $this->_genreName,
|
'name' => $this->_genreName,
|
||||||
'slug' => $slug
|
'slug' => $slug,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return CommandResponse::succeed(['message' => 'Genre created!']);
|
return CommandResponse::succeed(['message' => 'Genre created!']);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Notification;
|
|
||||||
use App\Models\Playlist;
|
use App\Models\Playlist;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Notification;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreatePlaylistCommand extends CommandBase
|
class CreatePlaylistCommand extends CommandBase
|
||||||
|
@ -53,7 +53,7 @@ class CreatePlaylistCommand extends CommandBase
|
||||||
$rules = [
|
$rules = [
|
||||||
'title' => 'required|min:3|max:50',
|
'title' => 'required|min:3|max:50',
|
||||||
'is_public' => 'required',
|
'is_public' => 'required',
|
||||||
'is_pinned' => 'required'
|
'is_pinned' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($this->_input, $rules);
|
$validator = Validator::make($this->_input, $rules);
|
||||||
|
@ -84,7 +84,7 @@ class CreatePlaylistCommand extends CommandBase
|
||||||
'description' => $playlist->description,
|
'description' => $playlist->description,
|
||||||
'url' => $playlist->url,
|
'url' => $playlist->url,
|
||||||
'is_pinned' => $this->_input['is_pinned'] == 'true',
|
'is_pinned' => $this->_input['is_pinned'] == 'true',
|
||||||
'is_public' => $this->_input['is_public'] == 'true'
|
'is_public' => $this->_input['is_public'] == 'true',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Models\ShowSong;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Models\ShowSong;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreateShowSongCommand extends CommandBase
|
class CreateShowSongCommand extends CommandBase
|
||||||
|
@ -53,12 +53,12 @@ class CreateShowSongCommand extends CommandBase
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'title' => 'required|unique:show_songs,title,NULL,id,deleted_at,NULL|max:250',
|
'title' => 'required|unique:show_songs,title,NULL,id,deleted_at,NULL|max:250',
|
||||||
'slug' => 'required|unique:show_songs,slug,NULL,id,deleted_at,NULL'
|
'slug' => 'required|unique:show_songs,slug,NULL,id,deleted_at,NULL',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make([
|
$validator = Validator::make([
|
||||||
'title' => $this->_songName,
|
'title' => $this->_songName,
|
||||||
'slug' => $slug
|
'slug' => $slug,
|
||||||
], $rules);
|
], $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
@ -68,7 +68,7 @@ class CreateShowSongCommand extends CommandBase
|
||||||
ShowSong::create([
|
ShowSong::create([
|
||||||
'title' => $this->_songName,
|
'title' => $this->_songName,
|
||||||
'slug' => $slug,
|
'slug' => $slug,
|
||||||
'lyrics' => ''
|
'lyrics' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return CommandResponse::succeed(['message' => 'Song created!']);
|
return CommandResponse::succeed(['message' => 'Song created!']);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Gate;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Gate;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class CreateUserCommand extends CommandBase
|
class CreateUserCommand extends CommandBase
|
||||||
|
@ -72,7 +72,7 @@ class CreateUserCommand extends CommandBase
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail([
|
return CommandResponse::fail([
|
||||||
'message' => $validator->getMessageBag()->first(),
|
'message' => $validator->getMessageBag()->first(),
|
||||||
'user' => null
|
'user' => null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +81,12 @@ class CreateUserCommand extends CommandBase
|
||||||
if ($user->wasRecentlyCreated) {
|
if ($user->wasRecentlyCreated) {
|
||||||
return CommandResponse::succeed([
|
return CommandResponse::succeed([
|
||||||
'message' => 'New user successfully created!',
|
'message' => 'New user successfully created!',
|
||||||
'user' => User::mapPublicUserSummary($user)
|
'user' => User::mapPublicUserSummary($user),
|
||||||
], 201);
|
], 201);
|
||||||
} else {
|
} else {
|
||||||
return CommandResponse::fail([
|
return CommandResponse::fail([
|
||||||
'message' => 'A user with that username already exists.',
|
'message' => 'A user with that username already exists.',
|
||||||
'user' => User::mapPublicUserSummary($user)
|
'user' => User::mapPublicUserSummary($user),
|
||||||
], 409);
|
], 409);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Gate;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Gate;
|
||||||
|
|
||||||
class DeleteAlbumCommand extends CommandBase
|
class DeleteAlbumCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,17 +20,16 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\DeleteGenre;
|
||||||
|
use App\Models\Genre;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use App\Models\Genre;
|
|
||||||
use App\Jobs\DeleteGenre;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class DeleteGenreCommand extends CommandBase
|
class DeleteGenreCommand extends CommandBase
|
||||||
{
|
{
|
||||||
use DispatchesJobs;
|
use DispatchesJobs;
|
||||||
|
|
||||||
|
|
||||||
/** @var Genre */
|
/** @var Genre */
|
||||||
private $_genreToDelete;
|
private $_genreToDelete;
|
||||||
private $_destinationGenre;
|
private $_destinationGenre;
|
||||||
|
@ -67,7 +66,6 @@ class DeleteGenreCommand extends CommandBase
|
||||||
'destination_genre' => $this->_destinationGenre,
|
'destination_genre' => $this->_destinationGenre,
|
||||||
], $rules);
|
], $rules);
|
||||||
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,17 +20,16 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\DeleteShowSong;
|
||||||
|
use App\Models\ShowSong;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use App\Models\ShowSong;
|
|
||||||
use App\Jobs\DeleteShowSong;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class DeleteShowSongCommand extends CommandBase
|
class DeleteShowSongCommand extends CommandBase
|
||||||
{
|
{
|
||||||
use DispatchesJobs;
|
use DispatchesJobs;
|
||||||
|
|
||||||
|
|
||||||
/** @var ShowSong */
|
/** @var ShowSong */
|
||||||
private $_songToDelete;
|
private $_songToDelete;
|
||||||
private $_destinationSong;
|
private $_destinationSong;
|
||||||
|
@ -67,7 +66,6 @@ class DeleteShowSongCommand extends CommandBase
|
||||||
'destination_song' => $this->_destinationSong,
|
'destination_song' => $this->_destinationSong,
|
||||||
], $rules);
|
], $rules);
|
||||||
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Gate;
|
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
|
use Gate;
|
||||||
|
|
||||||
class DeleteTrackCommand extends CommandBase
|
class DeleteTrackCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -24,8 +24,8 @@ use App\Models\Album;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Gate;
|
|
||||||
use DB;
|
use DB;
|
||||||
|
use Gate;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class EditAlbumCommand extends CommandBase
|
class EditAlbumCommand extends CommandBase
|
||||||
|
@ -63,7 +63,7 @@ class EditAlbumCommand extends CommandBase
|
||||||
'title' => 'required|min:3|max:50',
|
'title' => 'required|min:3|max:50',
|
||||||
'cover' => 'image|mimes:png|min_width:350|min_height:350',
|
'cover' => 'image|mimes:png|min_width:350|min_height:350',
|
||||||
'cover_id' => 'exists:images,id',
|
'cover_id' => 'exists:images,id',
|
||||||
'username' => 'exists:users,username'
|
'username' => 'exists:users,username',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($this->_input, $rules);
|
$validator = Validator::make($this->_input, $rules);
|
||||||
|
@ -77,7 +77,7 @@ class EditAlbumCommand extends CommandBase
|
||||||
$trackDbCount = DB::table('tracks')->whereIn('id', $trackIds)->count();
|
$trackDbCount = DB::table('tracks')->whereIn('id', $trackIds)->count();
|
||||||
|
|
||||||
if ($trackDbCount != $trackIdsCount) {
|
if ($trackDbCount != $trackIdsCount) {
|
||||||
return CommandResponse::fail("Track IDs invalid");
|
return CommandResponse::fail('Track IDs invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_album->title = $this->_input['title'];
|
$this->_album->title = $this->_input['title'];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -57,7 +57,7 @@ class EditPlaylistCommand extends CommandBase
|
||||||
$rules = [
|
$rules = [
|
||||||
'title' => 'required|min:3|max:50',
|
'title' => 'required|min:3|max:50',
|
||||||
'is_public' => 'required',
|
'is_public' => 'required',
|
||||||
'is_pinned' => 'required'
|
'is_pinned' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($this->_input, $rules);
|
$validator = Validator::make($this->_input, $rules);
|
||||||
|
@ -89,7 +89,7 @@ class EditPlaylistCommand extends CommandBase
|
||||||
'description' => $this->_playlist->description,
|
'description' => $this->_playlist->description,
|
||||||
'url' => $this->_playlist->url,
|
'url' => $this->_playlist->url,
|
||||||
'is_pinned' => $this->_input['is_pinned'] == 'true',
|
'is_pinned' => $this->_input['is_pinned'] == 'true',
|
||||||
'is_public' => $this->_input['is_public'] == 'true'
|
'is_public' => $this->_input['is_public'] == 'true',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Gate;
|
|
||||||
use Notification;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
|
use App\Models\Playlist;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\TrackType;
|
use App\Models\TrackType;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Playlist;
|
|
||||||
use DB;
|
use DB;
|
||||||
|
use Gate;
|
||||||
|
use Notification;
|
||||||
|
|
||||||
class EditTrackCommand extends CommandBase
|
class EditTrackCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ class EditTrackCommand extends CommandBase
|
||||||
'title' => 'required|min:3|max:80',
|
'title' => 'required|min:3|max:80',
|
||||||
'released_at' => 'before:'.
|
'released_at' => 'before:'.
|
||||||
(date('Y-m-d', time() + (86400 * 2))).(
|
(date('Y-m-d', time() + (86400 * 2))).(
|
||||||
isset($this->_input['released_at']) && $this->_input['released_at'] != ""
|
isset($this->_input['released_at']) && $this->_input['released_at'] != ''
|
||||||
? '|date'
|
? '|date'
|
||||||
: ''),
|
: ''),
|
||||||
'license_id' => 'required|exists:licenses,id',
|
'license_id' => 'required|exists:licenses,id',
|
||||||
|
@ -76,7 +76,7 @@ class EditTrackCommand extends CommandBase
|
||||||
'track_type_id' => 'required|exists:track_types,id|not_in:'.TrackType::UNCLASSIFIED_TRACK,
|
'track_type_id' => 'required|exists:track_types,id|not_in:'.TrackType::UNCLASSIFIED_TRACK,
|
||||||
'cover_id' => 'exists:images,id',
|
'cover_id' => 'exists:images,id',
|
||||||
'album_id' => 'exists:albums,id',
|
'album_id' => 'exists:albums,id',
|
||||||
'username' => 'exists:users,username'
|
'username' => 'exists:users,username',
|
||||||
];
|
];
|
||||||
|
|
||||||
if (isset($this->_input['track_type_id']) && $this->_input['track_type_id'] == TrackType::OFFICIAL_TRACK_REMIX) {
|
if (isset($this->_input['track_type_id']) && $this->_input['track_type_id'] == TrackType::OFFICIAL_TRACK_REMIX) {
|
||||||
|
@ -92,7 +92,7 @@ class EditTrackCommand extends CommandBase
|
||||||
|
|
||||||
$track = $this->_track;
|
$track = $this->_track;
|
||||||
$track->title = $this->_input['title'];
|
$track->title = $this->_input['title'];
|
||||||
$track->released_at = isset($this->_input['released_at']) && $this->_input['released_at'] != "" ? strtotime($this->_input['released_at']) : null;
|
$track->released_at = isset($this->_input['released_at']) && $this->_input['released_at'] != '' ? strtotime($this->_input['released_at']) : null;
|
||||||
$track->description = isset($this->_input['description']) ? $this->_input['description'] : '';
|
$track->description = isset($this->_input['description']) ? $this->_input['description'] : '';
|
||||||
$track->lyrics = isset($this->_input['lyrics']) ? $this->_input['lyrics'] : '';
|
$track->lyrics = isset($this->_input['lyrics']) ? $this->_input['lyrics'] : '';
|
||||||
$track->license_id = $this->_input['license_id'];
|
$track->license_id = $this->_input['license_id'];
|
||||||
|
@ -163,16 +163,16 @@ class EditTrackCommand extends CommandBase
|
||||||
$track->save();
|
$track->save();
|
||||||
|
|
||||||
User::whereId($this->_track->user_id)->update([
|
User::whereId($this->_track->user_id)->update([
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE deleted_at IS NULL AND published_at IS NOT NULL AND user_id = ' . $this->_track->user_id . ')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE deleted_at IS NULL AND published_at IS NOT NULL AND user_id = '.$this->_track->user_id.')'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($oldid != null) {
|
if ($oldid != null) {
|
||||||
User::whereId($oldid)->update([
|
User::whereId($oldid)->update([
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE deleted_at IS NULL AND published_at IS NOT NULL AND user_id = ' . $oldid . ')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE deleted_at IS NULL AND published_at IS NOT NULL AND user_id = '.$oldid.')'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->_input['hwc_submit']) && new \DateTime() < new \DateTime("2016-12-20 23:59:59")) {
|
if (isset($this->_input['hwc_submit']) && new \DateTime() < new \DateTime('2016-12-20 23:59:59')) {
|
||||||
$playlist = Playlist::where('user_id', 22549)->first();
|
$playlist = Playlist::where('user_id', 22549)->first();
|
||||||
|
|
||||||
if ($this->_input['hwc_submit'] == 'true') {
|
if ($this->_input['hwc_submit'] == 'true') {
|
||||||
|
@ -182,7 +182,7 @@ class EditTrackCommand extends CommandBase
|
||||||
$playlist->touch();
|
$playlist->touch();
|
||||||
|
|
||||||
Playlist::where('id', $playlist->id)->update([
|
Playlist::where('id', $playlist->id)->update([
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -190,11 +190,12 @@ class EditTrackCommand extends CommandBase
|
||||||
$playlist->tracks()->detach($track);
|
$playlist->tracks()->detach($track);
|
||||||
|
|
||||||
Playlist::whereId($playlist->id)->update([
|
Playlist::whereId($playlist->id)->update([
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResponse::succeed(['real_cover_url' => $track->getCoverUrl(Image::NORMAL)]);
|
return CommandResponse::succeed(['real_cover_url' => $track->getCoverUrl(Image::NORMAL)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ class EditTrackCommand extends CommandBase
|
||||||
}
|
}
|
||||||
|
|
||||||
Album::whereId($album->id)->update([
|
Album::whereId($album->id)->update([
|
||||||
'track_count' => DB::table('tracks')->where('album_id', '=', $album->id)->count()
|
'track_count' => DB::table('tracks')->where('album_id', '=', $album->id)->count(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +231,7 @@ class EditTrackCommand extends CommandBase
|
||||||
$track->save();
|
$track->save();
|
||||||
|
|
||||||
$album->update([
|
$album->update([
|
||||||
'track_count' => DB::table('tracks')->where('album_id', '=', $album->id)->count()
|
'track_count' => DB::table('tracks')->where('album_id', '=', $album->id)->count(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,23 +20,21 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Exceptions\InvalidEncodeOptionsException;
|
||||||
|
use App\Jobs\EncodeTrackFile;
|
||||||
|
use App\Models\Track;
|
||||||
|
use App\Models\TrackFile;
|
||||||
use AudioCache;
|
use AudioCache;
|
||||||
use FFmpegMovie;
|
use FFmpegMovie;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Exceptions\InvalidEncodeOptionsException;
|
|
||||||
use App\Jobs\EncodeTrackFile;
|
|
||||||
use App\Models\Track;
|
|
||||||
use App\Models\TrackFile;
|
|
||||||
use SplFileInfo;
|
use SplFileInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This command is the "second phase" of the upload process - once metadata has
|
* This command is the "second phase" of the upload process - once metadata has
|
||||||
* been parsed and the track object is created, this generates the track's
|
* been parsed and the track object is created, this generates the track's
|
||||||
* corresponding TrackFile objects and ensures that all of them have been encoded.
|
* corresponding TrackFile objects and ensures that all of them have been encoded.
|
||||||
*
|
|
||||||
* @package App\Commands
|
|
||||||
*/
|
*/
|
||||||
class GenerateTrackFilesCommand extends CommandBase
|
class GenerateTrackFilesCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
@ -53,7 +51,7 @@ class GenerateTrackFilesCommand extends CommandBase
|
||||||
'flac',
|
'flac',
|
||||||
'pcm',
|
'pcm',
|
||||||
'adpcm',
|
'adpcm',
|
||||||
'alac'
|
'alac',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(Track $track, SplFileInfo $sourceFile, bool $autoPublish = false, bool $isForUpload = false, bool $isReplacingTrack = false, int $version = 1)
|
public function __construct(Track $track, SplFileInfo $sourceFile, bool $autoPublish = false, bool $isForUpload = false, bool $isReplacingTrack = false, int $version = 1)
|
||||||
|
@ -90,6 +88,7 @@ class GenerateTrackFilesCommand extends CommandBase
|
||||||
$masterFormat = 'OGG Vorbis';
|
$masterFormat = 'OGG Vorbis';
|
||||||
} else {
|
} else {
|
||||||
$this->track->delete();
|
$this->track->delete();
|
||||||
|
|
||||||
return CommandResponse::fail(['track' => "The track does not contain audio in a known lossy format. The format read from the file is: {$codecString}"]);
|
return CommandResponse::fail(['track' => "The track does not contain audio in a known lossy format. The format read from the file is: {$codecString}"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +108,6 @@ class GenerateTrackFilesCommand extends CommandBase
|
||||||
File::copy($source, $trackFile->getFile());
|
File::copy($source, $trackFile->getFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$trackFiles = [];
|
$trackFiles = [];
|
||||||
|
|
||||||
foreach (Track::$Formats as $name => $format) {
|
foreach (Track::$Formats as $name => $format) {
|
||||||
|
@ -161,6 +159,7 @@ class GenerateTrackFilesCommand extends CommandBase
|
||||||
} else {
|
} else {
|
||||||
$this->track->delete();
|
$this->track->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResponse::fail(['track' => [$e->getMessage()]]);
|
return CommandResponse::fail(['track' => [$e->getMessage()]]);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -176,6 +175,7 @@ class GenerateTrackFilesCommand extends CommandBase
|
||||||
// This ensures that any updates to the track record, like from parsed
|
// This ensures that any updates to the track record, like from parsed
|
||||||
// tags, are reflected in the command's response.
|
// tags, are reflected in the command's response.
|
||||||
$this->track = $this->track->fresh();
|
$this->track = $this->track->fresh();
|
||||||
|
|
||||||
return CommandResponse::succeed([
|
return CommandResponse::succeed([
|
||||||
'id' => $this->track->id,
|
'id' => $this->track->id,
|
||||||
'name' => $this->track->name,
|
'name' => $this->track->name,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,6 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use DB;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Comment;
|
use App\Models\Comment;
|
||||||
use App\Models\EmailSubscription;
|
use App\Models\EmailSubscription;
|
||||||
|
@ -35,6 +33,8 @@ use App\Models\ResourceLogItem;
|
||||||
use App\Models\ResourceUser;
|
use App\Models\ResourceUser;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use DB;
|
||||||
|
|
||||||
class MergeAccountsCommand extends CommandBase
|
class MergeAccountsCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,18 +20,18 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Config;
|
|
||||||
use getID3;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Genre;
|
use App\Models\Genre;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use AudioCache;
|
|
||||||
use File;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use App\Models\TrackType;
|
use App\Models\TrackType;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use AudioCache;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Config;
|
||||||
|
use File;
|
||||||
|
use getID3;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
list($parsedTags, $rawTags) = $this->parseOriginalTags($this->fileToParse, $this->track->user, $audio->getAudioCodec());
|
list($parsedTags, $rawTags) = $this->parseOriginalTags($this->fileToParse, $this->track->user, $audio->getAudioCodec());
|
||||||
$this->track->original_tags = ['parsed_tags' => $parsedTags, 'raw_tags' => $rawTags];
|
$this->track->original_tags = ['parsed_tags' => $parsedTags, 'raw_tags' => $rawTags];
|
||||||
|
|
||||||
|
|
||||||
if ($this->input['cover'] !== null) {
|
if ($this->input['cover'] !== null) {
|
||||||
$this->track->cover_id = Image::upload($this->input['cover'], $this->track->user_id)->id;
|
$this->track->cover_id = Image::upload($this->input['cover'], $this->track->user_id)->id;
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,11 +99,12 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
$this->track = $this->unsetNullVariables($this->track);
|
$this->track = $this->unsetNullVariables($this->track);
|
||||||
|
|
||||||
$this->track->save();
|
$this->track->save();
|
||||||
|
|
||||||
return CommandResponse::succeed();
|
return CommandResponse::succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a value is null, remove it! Helps prevent weird SQL errors
|
* If a value is null, remove it! Helps prevent weird SQL errors.
|
||||||
*
|
*
|
||||||
* @param Track
|
* @param Track
|
||||||
* @return Track
|
* @return Track
|
||||||
|
@ -138,7 +138,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
|
|
||||||
return Genre::create([
|
return Genre::create([
|
||||||
'name' => $genreName,
|
'name' => $genreName,
|
||||||
'slug' => Str::slug($genreName)
|
'slug' => Str::slug($genreName),
|
||||||
])->id;
|
])->id;
|
||||||
} else {
|
} else {
|
||||||
// Exists in db, has it been deleted?
|
// Exists in db, has it been deleted?
|
||||||
|
@ -150,6 +150,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
// instead of creating a new one
|
// instead of creating a new one
|
||||||
|
|
||||||
$existingGenre->restore();
|
$existingGenre->restore();
|
||||||
|
|
||||||
return $existingGenre->id;
|
return $existingGenre->id;
|
||||||
} else {
|
} else {
|
||||||
// It's fine, just return the ID
|
// It's fine, just return the ID
|
||||||
|
@ -166,7 +167,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
*
|
*
|
||||||
* @param int $artistId
|
* @param int $artistId
|
||||||
* @param string|null $albumName
|
* @param string|null $albumName
|
||||||
* @param integer|null $coverId
|
* @param int|null $coverId
|
||||||
* @return int|null
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
protected function getAlbumId(int $artistId, $albumName, $coverId = null)
|
protected function getAlbumId(int $artistId, $albumName, $coverId = null)
|
||||||
|
@ -174,7 +175,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
if (null !== $albumName) {
|
if (null !== $albumName) {
|
||||||
$album = Album::firstOrNew([
|
$album = Album::firstOrNew([
|
||||||
'user_id' => $artistId,
|
'user_id' => $artistId,
|
||||||
'title' => $albumName
|
'title' => $albumName,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (null === $album->id) {
|
if (null === $album->id) {
|
||||||
|
@ -249,7 +250,6 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
$parsedTags['is_vocal'] = $parsedTags['lyrics'] !== null;
|
$parsedTags['is_vocal'] = $parsedTags['lyrics'] !== null;
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
// Determine the genre.
|
// Determine the genre.
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -294,7 +294,6 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
|
|
||||||
$parsedTags['cover_id'] = $coverId;
|
$parsedTags['cover_id'] = $coverId;
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
// Is this part of an album?
|
// Is this part of an album?
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -307,11 +306,9 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
|
|
||||||
$parsedTags['album_id'] = $albumId;
|
$parsedTags['album_id'] = $albumId;
|
||||||
|
|
||||||
|
|
||||||
return [$parsedTags, $rawTags];
|
return [$parsedTags, $rawTags];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $rawTags
|
* @param array $rawTags
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -326,7 +323,6 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
$tags = [];
|
$tags = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$comment = null;
|
$comment = null;
|
||||||
|
|
||||||
if (isset($tags['comment'])) {
|
if (isset($tags['comment'])) {
|
||||||
|
@ -361,7 +357,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
'comments' => $comment,
|
'comments' => $comment,
|
||||||
'lyrics' => isset($tags['unsynchronised_lyric']) ? $tags['unsynchronised_lyric'][0] : null,
|
'lyrics' => isset($tags['unsynchronised_lyric']) ? $tags['unsynchronised_lyric'][0] : null,
|
||||||
],
|
],
|
||||||
$tags
|
$tags,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +401,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
||||||
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
||||||
],
|
],
|
||||||
$tags
|
$tags,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +437,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
||||||
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
||||||
],
|
],
|
||||||
$tags
|
$tags,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +470,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
// YYYY-MM
|
// YYYY-MM
|
||||||
case 7:
|
case 7:
|
||||||
try {
|
try {
|
||||||
return Carbon::createFromFormat('Y m', str_replace("-", " ", $dateString))
|
return Carbon::createFromFormat('Y m', str_replace('-', ' ', $dateString))
|
||||||
->day(1);
|
->day(1);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -483,7 +479,7 @@ class ParseTrackTagsCommand extends CommandBase
|
||||||
// YYYY-MM-DD
|
// YYYY-MM-DD
|
||||||
case 10:
|
case 10:
|
||||||
try {
|
try {
|
||||||
return Carbon::createFromFormat('Y m d', str_replace("-", " ", $dateString));
|
return Carbon::createFromFormat('Y m d', str_replace('-', ' ', $dateString));
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -54,7 +54,7 @@ class RemoveTrackFromPlaylistCommand extends CommandBase
|
||||||
{
|
{
|
||||||
$this->_playlist->tracks()->detach($this->_track);
|
$this->_playlist->tracks()->detach($this->_track);
|
||||||
Playlist::whereId($this->_playlist->id)->update([
|
Playlist::whereId($this->_playlist->id)->update([
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$this->_playlist->id.')')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$this->_playlist->id.')'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return CommandResponse::succeed(['message' => 'Track removed!']);
|
return CommandResponse::succeed(['message' => 'Track removed!']);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\UpdateTagsForRenamedGenre;
|
||||||
|
use App\Models\Genre;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Jobs\UpdateTagsForRenamedGenre;
|
|
||||||
use App\Models\Genre;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class RenameGenreCommand extends CommandBase
|
class RenameGenreCommand extends CommandBase
|
||||||
|
@ -59,15 +59,14 @@ class RenameGenreCommand extends CommandBase
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|unique:genres,name,'.$this->_genre->id.',id,deleted_at,NULL|max:50',
|
'name' => 'required|unique:genres,name,'.$this->_genre->id.',id,deleted_at,NULL|max:50',
|
||||||
'slug' => 'required|unique:genres,slug,'.$this->_genre->id.',id,deleted_at,NULL'
|
'slug' => 'required|unique:genres,slug,'.$this->_genre->id.',id,deleted_at,NULL',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make([
|
$validator = Validator::make([
|
||||||
'name' => $this->_newName,
|
'name' => $this->_newName,
|
||||||
'slug' => $slug
|
'slug' => $slug,
|
||||||
], $rules);
|
], $rules);
|
||||||
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\UpdateTagsForRenamedShowSong;
|
||||||
|
use App\Models\ShowSong;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Jobs\UpdateTagsForRenamedShowSong;
|
|
||||||
use App\Models\ShowSong;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class RenameShowSongCommand extends CommandBase
|
class RenameShowSongCommand extends CommandBase
|
||||||
|
@ -59,15 +59,14 @@ class RenameShowSongCommand extends CommandBase
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'title' => 'required|unique:show_songs,title,'.$this->_song->id.',id|max:250',
|
'title' => 'required|unique:show_songs,title,'.$this->_song->id.',id|max:250',
|
||||||
'slug' => 'required|unique:show_songs,slug,'.$this->_song->id.',id'
|
'slug' => 'required|unique:show_songs,slug,'.$this->_song->id.',id',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make([
|
$validator = Validator::make([
|
||||||
'title' => $this->_newName,
|
'title' => $this->_newName,
|
||||||
'slug' => $slug
|
'slug' => $slug,
|
||||||
], $rules);
|
], $rules);
|
||||||
|
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use DB;
|
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use DB;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class SaveAccountSettingsCommand extends CommandBase
|
||||||
'unique:users,slug,'.$this->_user->id,
|
'unique:users,slug,'.$this->_user->id,
|
||||||
'min:'.config('ponyfm.user_slug_minimum_length'),
|
'min:'.config('ponyfm.user_slug_minimum_length'),
|
||||||
'regex:/^[a-z\d-]+$/',
|
'regex:/^[a-z\d-]+$/',
|
||||||
'is_not_reserved_slug'
|
'is_not_reserved_slug',
|
||||||
],
|
],
|
||||||
'notifications.*.activity_type' => 'required|exists:activity_types,activity_type',
|
'notifications.*.activity_type' => 'required|exists:activity_types,activity_type',
|
||||||
'notifications.*.receive_emails' => 'present|boolean',
|
'notifications.*.receive_emails' => 'present|boolean',
|
||||||
|
@ -77,14 +77,13 @@ class SaveAccountSettingsCommand extends CommandBase
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make($this->_input, $rules, [
|
$validator = Validator::make($this->_input, $rules, [
|
||||||
'slug.regex' => 'Slugs can only contain numbers, lowercase letters, and dashes.'
|
'slug.regex' => 'Slugs can only contain numbers, lowercase letters, and dashes.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->_user->bio = $this->_input['bio'];
|
$this->_user->bio = $this->_input['bio'];
|
||||||
$this->_user->display_name = $this->_input['display_name'];
|
$this->_user->display_name = $this->_input['display_name'];
|
||||||
$this->_user->slug = $this->_input['slug'];
|
$this->_user->slug = $this->_input['slug'];
|
||||||
|
@ -112,13 +111,11 @@ class SaveAccountSettingsCommand extends CommandBase
|
||||||
// Sync email subscriptions
|
// Sync email subscriptions
|
||||||
$emailSubscriptions = $this->_user->emailSubscriptions->keyBy('activity_type');
|
$emailSubscriptions = $this->_user->emailSubscriptions->keyBy('activity_type');
|
||||||
foreach ($this->_input['notifications'] as $notificationSetting) {
|
foreach ($this->_input['notifications'] as $notificationSetting) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$notificationSetting['receive_emails'] &&
|
$notificationSetting['receive_emails'] &&
|
||||||
! $emailSubscriptions->offsetExists($notificationSetting['activity_type'])
|
! $emailSubscriptions->offsetExists($notificationSetting['activity_type'])
|
||||||
) {
|
) {
|
||||||
$this->_user->emailSubscriptions()->create(['activity_type' => $notificationSetting['activity_type']]);
|
$this->_user->emailSubscriptions()->create(['activity_type' => $notificationSetting['activity_type']]);
|
||||||
|
|
||||||
} elseif (
|
} elseif (
|
||||||
! $notificationSetting['receive_emails'] &&
|
! $notificationSetting['receive_emails'] &&
|
||||||
$emailSubscriptions->offsetExists($notificationSetting['activity_type'])
|
$emailSubscriptions->offsetExists($notificationSetting['activity_type'])
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
use Notification;
|
|
||||||
use App\Contracts\Favouritable;
|
use App\Contracts\Favouritable;
|
||||||
use App\Models\Favourite;
|
|
||||||
use App\Models\Track;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
|
use App\Models\Favourite;
|
||||||
use App\Models\Playlist;
|
use App\Models\Playlist;
|
||||||
use App\Models\ResourceUser;
|
use App\Models\ResourceUser;
|
||||||
|
use App\Models\Track;
|
||||||
use Auth;
|
use Auth;
|
||||||
use DB;
|
use DB;
|
||||||
|
use Notification;
|
||||||
|
|
||||||
class ToggleFavouriteCommand extends CommandBase
|
class ToggleFavouriteCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
@ -98,14 +98,13 @@ class ToggleFavouriteCommand extends CommandBase
|
||||||
// for the same resource at the same time, the cached values will still be correct with this method.
|
// for the same resource at the same time, the cached values will still be correct with this method.
|
||||||
|
|
||||||
DB::table($resourceTable)->whereId($this->_resourceId)->update([
|
DB::table($resourceTable)->whereId($this->_resourceId)->update([
|
||||||
'favourite_count' =>
|
'favourite_count' => DB::raw('(
|
||||||
DB::raw('(
|
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(id)
|
COUNT(id)
|
||||||
FROM
|
FROM
|
||||||
favourites
|
favourites
|
||||||
WHERE '.
|
WHERE '.
|
||||||
$typeId.' = '.$this->_resourceId.')')
|
$typeId.' = '.$this->_resourceId.')'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return CommandResponse::succeed(['is_favourited' => $isFavourited]);
|
return CommandResponse::succeed(['is_favourited' => $isFavourited]);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,14 +20,14 @@
|
||||||
|
|
||||||
namespace App\Commands;
|
namespace App\Commands;
|
||||||
|
|
||||||
|
use App\Models\Track;
|
||||||
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Config;
|
use Config;
|
||||||
use Gate;
|
use Gate;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use App\Models\Track;
|
|
||||||
use App\Models\User;
|
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
||||||
class UploadTrackCommand extends CommandBase
|
class UploadTrackCommand extends CommandBase
|
||||||
|
@ -115,6 +115,7 @@ class UploadTrackCommand extends CommandBase
|
||||||
$this->_track->version_upload_status = Track::STATUS_ERROR;
|
$this->_track->version_upload_status = Track::STATUS_ERROR;
|
||||||
$this->_track->update();
|
$this->_track->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResponse::fail(['track' => ['You must upload an audio file!']]);
|
return CommandResponse::fail(['track' => ['You must upload an audio file!']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +153,7 @@ class UploadTrackCommand extends CommandBase
|
||||||
}
|
}
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'track' =>
|
'track' => 'required|'
|
||||||
'required|'
|
|
||||||
.($this->_allowLossy
|
.($this->_allowLossy
|
||||||
? 'audio_format:flac,alac,pcm,adpcm,aac,mp3,vorbis|'
|
? 'audio_format:flac,alac,pcm,adpcm,aac,mp3,vorbis|'
|
||||||
: 'audio_format:flac,alac,pcm,adpcm|')
|
: 'audio_format:flac,alac,pcm,adpcm|')
|
||||||
|
@ -176,7 +176,7 @@ class UploadTrackCommand extends CommandBase
|
||||||
'is_explicit' => 'boolean',
|
'is_explicit' => 'boolean',
|
||||||
'is_downloadable' => 'boolean',
|
'is_downloadable' => 'boolean',
|
||||||
'is_listed' => 'boolean',
|
'is_listed' => 'boolean',
|
||||||
'metadata' => 'json'
|
'metadata' => 'json',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$validator = \Validator::make($input, $rules);
|
$validator = \Validator::make($input, $rules);
|
||||||
|
@ -188,6 +188,7 @@ class UploadTrackCommand extends CommandBase
|
||||||
} else {
|
} else {
|
||||||
$this->_track->delete();
|
$this->_track->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandResponse::fail($validator);
|
return CommandResponse::fail($validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,11 +216,13 @@ class UploadTrackCommand extends CommandBase
|
||||||
$this->_track->version_upload_status = Track::STATUS_ERROR;
|
$this->_track->version_upload_status = Track::STATUS_ERROR;
|
||||||
$this->_track->update();
|
$this->_track->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$generateTrackFiles = new GenerateTrackFilesCommand($this->_track, $trackFile, $autoPublish, true, $this->_isReplacingTrack, $this->_version);
|
$generateTrackFiles = new GenerateTrackFilesCommand($this->_track, $trackFile, $autoPublish, true, $this->_isReplacingTrack, $this->_version);
|
||||||
|
|
||||||
return $generateTrackFiles->execute();
|
return $generateTrackFiles->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -40,7 +40,6 @@ class BootstrapLocalEnvironment extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -53,7 +53,6 @@ class ClassifyMLPMA extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -74,7 +73,7 @@ class ClassifyMLPMA extends Command
|
||||||
|
|
||||||
$this->comment('Importing tracks...');
|
$this->comment('Importing tracks...');
|
||||||
|
|
||||||
$totalTracks = sizeof($tracks);
|
$totalTracks = count($tracks);
|
||||||
|
|
||||||
$fileToStartAt = (int) $this->option('startAt') - 1;
|
$fileToStartAt = (int) $this->option('startAt') - 1;
|
||||||
$this->comment("Skipping $fileToStartAt files...".PHP_EOL);
|
$this->comment("Skipping $fileToStartAt files...".PHP_EOL);
|
||||||
|
@ -88,7 +87,6 @@ class ClassifyMLPMA extends Command
|
||||||
|
|
||||||
$parsedTags = json_decode($track->parsed_tags, true);
|
$parsedTags = json_decode($track->parsed_tags, true);
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
// Original, show song remix, fan song remix, show audio remix, or ponified song?
|
// Original, show song remix, fan song remix, show audio remix, or ponified song?
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -103,7 +101,6 @@ class ClassifyMLPMA extends Command
|
||||||
")
|
")
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
// If it has "Ingram" in the name, it's definitely an official song remix.
|
// If it has "Ingram" in the name, it's definitely an official song remix.
|
||||||
if (Str::contains(Str::lower($track->filename), 'ingram')) {
|
if (Str::contains(Str::lower($track->filename), 'ingram')) {
|
||||||
$this->info('This is an official song remix!');
|
$this->info('This is an official song remix!');
|
||||||
|
@ -115,7 +112,6 @@ class ClassifyMLPMA extends Command
|
||||||
$parsedTags
|
$parsedTags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// If it has "remix" in the name, it's definitely a remix.
|
// If it has "remix" in the name, it's definitely a remix.
|
||||||
} else {
|
} else {
|
||||||
if (Str::contains(Str::lower($sanitizedTrackTitle), 'remix')) {
|
if (Str::contains(Str::lower($sanitizedTrackTitle), 'remix')) {
|
||||||
|
@ -139,7 +135,6 @@ class ClassifyMLPMA extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
// Attach the data and publish the track!
|
// Attach the data and publish the track!
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -150,7 +145,7 @@ class ClassifyMLPMA extends Command
|
||||||
$track->published_at = $parsedTags['released_at'];
|
$track->published_at = $parsedTags['released_at'];
|
||||||
$track->save();
|
$track->save();
|
||||||
|
|
||||||
if (sizeof($linkedSongIds) > 0) {
|
if (count($linkedSongIds) > 0) {
|
||||||
$track->showSongs()->sync($linkedSongIds);
|
$track->showSongs()->sync($linkedSongIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,24 +162,22 @@ class ClassifyMLPMA extends Command
|
||||||
* @param bool|false $isRemixOfOfficialTrack
|
* @param bool|false $isRemixOfOfficialTrack
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function classifyTrack($filename, $officialSongs, $isRemixOfOfficialTrack = false, $tags)
|
protected function classifyTrack($filename, $officialSongs, $isRemixOfOfficialTrack, $tags)
|
||||||
{
|
{
|
||||||
$trackTypeId = null;
|
$trackTypeId = null;
|
||||||
$linkedSongIds = [];
|
$linkedSongIds = [];
|
||||||
|
|
||||||
|
|
||||||
foreach ($officialSongs as $song) {
|
foreach ($officialSongs as $song) {
|
||||||
$this->comment('=> Matched official song: ['.$song->id.'] '.$song->title);
|
$this->comment('=> Matched official song: ['.$song->id.'] '.$song->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($isRemixOfOfficialTrack && count($officialSongs) === 1) {
|
||||||
if ($isRemixOfOfficialTrack && sizeof($officialSongs) === 1) {
|
|
||||||
$linkedSongIds = [$officialSongs[0]->id];
|
$linkedSongIds = [$officialSongs[0]->id];
|
||||||
} else {
|
} else {
|
||||||
if ($isRemixOfOfficialTrack && sizeof($officialSongs) > 1) {
|
if ($isRemixOfOfficialTrack && count($officialSongs) > 1) {
|
||||||
$this->question('Multiple official songs matched! Please enter the ID of the correct one.');
|
$this->question('Multiple official songs matched! Please enter the ID of the correct one.');
|
||||||
} else {
|
} else {
|
||||||
if (sizeof($officialSongs) > 0) {
|
if (count($officialSongs) > 0) {
|
||||||
$this->question('This looks like a remix of an official song!');
|
$this->question('This looks like a remix of an official song!');
|
||||||
$this->question('Press "r" if the match above is right!');
|
$this->question('Press "r" if the match above is right!');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Kelvin Zhang
|
* Copyright (C) 2015 Kelvin Zhang.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\TrackFile;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\TrackFile;
|
|
||||||
|
|
||||||
class ClearTrackCache extends Command
|
class ClearTrackCache extends Command
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,6 @@ class ClearTrackCache extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\Image;
|
||||||
use Config;
|
use Config;
|
||||||
use DB;
|
use DB;
|
||||||
use File;
|
use File;
|
||||||
use getID3;
|
use getID3;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\Image;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
class FixMLPMAImages extends Command
|
class FixMLPMAImages extends Command
|
||||||
|
@ -47,7 +47,6 @@ class FixMLPMAImages extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -56,7 +55,6 @@ class FixMLPMAImages extends Command
|
||||||
|
|
||||||
protected $currentFile;
|
protected $currentFile;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File extensions to ignore when importing the archive.
|
* File extensions to ignore when importing the archive.
|
||||||
*
|
*
|
||||||
|
@ -69,7 +67,7 @@ class FixMLPMAImages extends Command
|
||||||
'txt',
|
'txt',
|
||||||
'rtf',
|
'rtf',
|
||||||
'wma',
|
'wma',
|
||||||
'wmv'
|
'wmv',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,17 +82,16 @@ class FixMLPMAImages extends Command
|
||||||
|
|
||||||
$this->comment('Enumerating MLP Music Archive source files...');
|
$this->comment('Enumerating MLP Music Archive source files...');
|
||||||
$files = File::allFiles($mlpmaPath);
|
$files = File::allFiles($mlpmaPath);
|
||||||
$this->info(sizeof($files).' files found!');
|
$this->info(count($files).' files found!');
|
||||||
|
|
||||||
$this->comment('Importing tracks...');
|
$this->comment('Importing tracks...');
|
||||||
$totalFiles = sizeof($files);
|
$totalFiles = count($files);
|
||||||
$fileToStartAt = (int) $this->option('startAt') - 1;
|
$fileToStartAt = (int) $this->option('startAt') - 1;
|
||||||
|
|
||||||
$this->comment("Skipping $fileToStartAt files...".PHP_EOL);
|
$this->comment("Skipping $fileToStartAt files...".PHP_EOL);
|
||||||
$files = array_slice($files, $fileToStartAt);
|
$files = array_slice($files, $fileToStartAt);
|
||||||
$this->currentFile = $fileToStartAt;
|
$this->currentFile = $fileToStartAt;
|
||||||
|
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$this->currentFile++;
|
$this->currentFile++;
|
||||||
|
|
||||||
|
@ -110,7 +107,6 @@ class FixMLPMAImages extends Command
|
||||||
->first();
|
->first();
|
||||||
$artistId = $importedTrack->user_id;
|
$artistId = $importedTrack->user_id;
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
// Extract the original tags.
|
// Extract the original tags.
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -119,7 +115,6 @@ class FixMLPMAImages extends Command
|
||||||
// all tags read by getID3, including the cover art
|
// all tags read by getID3, including the cover art
|
||||||
$allTags = $getId3->analyze($file->getPathname());
|
$allTags = $getId3->analyze($file->getPathname());
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
// Extract the cover art, if any exists.
|
// Extract the cover art, if any exists.
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
|
|
@ -2,21 +2,21 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Commands\UploadTrackCommand;
|
||||||
|
use App\Models\Album;
|
||||||
|
use App\Models\Genre;
|
||||||
|
use App\Models\Image;
|
||||||
|
use App\Models\Track;
|
||||||
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Config;
|
use Config;
|
||||||
use DB;
|
use DB;
|
||||||
use File;
|
use File;
|
||||||
use Input;
|
|
||||||
use getID3;
|
use getID3;
|
||||||
use App\Models\Image;
|
|
||||||
use App\Models\Track;
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\Genre;
|
|
||||||
use App\Models\Album;
|
|
||||||
use App\Commands\UploadTrackCommand;
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Input;
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
class ImportEQBeats extends Command
|
class ImportEQBeats extends Command
|
||||||
|
@ -94,7 +94,7 @@ class ImportEQBeats extends Command
|
||||||
|
|
||||||
$UNKNOWN_GENRE = Genre::firstOrCreate([
|
$UNKNOWN_GENRE = Genre::firstOrCreate([
|
||||||
'name' => 'Unknown',
|
'name' => 'Unknown',
|
||||||
'slug' => 'unknown'
|
'slug' => 'unknown',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -102,15 +102,15 @@ class ImportEQBeats extends Command
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
$this->comment('Enumerating files...');
|
$this->comment('Enumerating files...');
|
||||||
$files = File::allFiles($archivePath);
|
$files = File::allFiles($archivePath);
|
||||||
$this->info(sizeof($files) . ' files found!');
|
$this->info(count($files).' files found!');
|
||||||
|
|
||||||
$this->comment('Enumerating artists...');
|
$this->comment('Enumerating artists...');
|
||||||
$artists = File::directories($archivePath);
|
$artists = File::directories($archivePath);
|
||||||
$this->info(sizeof($artists) . ' artists found!');
|
$this->info(count($artists).' artists found!');
|
||||||
|
|
||||||
$this->comment('Importing tracks...');
|
$this->comment('Importing tracks...');
|
||||||
|
|
||||||
$totalFiles = sizeof($files);
|
$totalFiles = count($files);
|
||||||
|
|
||||||
$fileToStartAt = (int) $this->option('startAt') - 1;
|
$fileToStartAt = (int) $this->option('startAt') - 1;
|
||||||
$this->comment("Skipping $fileToStartAt files...".PHP_EOL);
|
$this->comment("Skipping $fileToStartAt files...".PHP_EOL);
|
||||||
|
@ -183,11 +183,9 @@ class ImportEQBeats extends Command
|
||||||
|
|
||||||
if ($taggedYear !== null && $modifiedDate->year === $taggedYear) {
|
if ($taggedYear !== null && $modifiedDate->year === $taggedYear) {
|
||||||
$releasedAt = $modifiedDate;
|
$releasedAt = $modifiedDate;
|
||||||
|
|
||||||
} elseif ($taggedYear !== null && $modifiedDate->year !== $taggedYear) {
|
} elseif ($taggedYear !== null && $modifiedDate->year !== $taggedYear) {
|
||||||
$this->warn('Release years don\'t match! Using the tagged year...');
|
$this->warn('Release years don\'t match! Using the tagged year...');
|
||||||
$releasedAt = Carbon::create($taggedYear);
|
$releasedAt = Carbon::create($taggedYear);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// $taggedYear is null
|
// $taggedYear is null
|
||||||
$this->warn('This track isn\'t tagged with its release year! Using the track\'s last modified date...');
|
$this->warn('This track isn\'t tagged with its release year! Using the track\'s last modified date...');
|
||||||
|
@ -215,7 +213,6 @@ class ImportEQBeats extends Command
|
||||||
$genre->restore();
|
$genre->restore();
|
||||||
}
|
}
|
||||||
$genreId = $genre->id;
|
$genreId = $genre->id;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$genre = new Genre();
|
$genre = new Genre();
|
||||||
$genre->name = $genreName;
|
$genre->name = $genreName;
|
||||||
|
@ -224,7 +221,6 @@ class ImportEQBeats extends Command
|
||||||
$genreId = $genre->id;
|
$genreId = $genre->id;
|
||||||
$this->comment('Created a new genre!');
|
$this->comment('Created a new genre!');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$genreId = $UNKNOWN_GENRE->id; // "Unknown" genre ID
|
$genreId = $UNKNOWN_GENRE->id; // "Unknown" genre ID
|
||||||
}
|
}
|
||||||
|
@ -236,7 +232,7 @@ class ImportEQBeats extends Command
|
||||||
$artist = User::where('display_name', '=', $artist_name)->first();
|
$artist = User::where('display_name', '=', $artist_name)->first();
|
||||||
$artistId = null;
|
$artistId = null;
|
||||||
|
|
||||||
$this->comment("Checking for duplicates");
|
$this->comment('Checking for duplicates');
|
||||||
|
|
||||||
if ($artist) {
|
if ($artist) {
|
||||||
$artistId = $artist->id;
|
$artistId = $artist->id;
|
||||||
|
@ -254,7 +250,7 @@ class ImportEQBeats extends Command
|
||||||
$importFormat = $this->getFormat($file->getExtension());
|
$importFormat = $this->getFormat($file->getExtension());
|
||||||
if ($importFormat == null) {
|
if ($importFormat == null) {
|
||||||
// No idea what this is, skip file
|
// No idea what this is, skip file
|
||||||
$this->comment(sprintf("Not an audio file (%s), skipping...", $importFormat));
|
$this->comment(sprintf('Not an audio file (%s), skipping...', $importFormat));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,9 +278,8 @@ class ImportEQBeats extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->comment("Found existing file");
|
$this->comment('Found existing file');
|
||||||
|
|
||||||
// Found a matching format, are they the same?
|
// Found a matching format, are they the same?
|
||||||
// Before we check it, see if it came from MLPMA
|
// Before we check it, see if it came from MLPMA
|
||||||
|
@ -307,8 +302,8 @@ class ImportEQBeats extends Command
|
||||||
$importHash = array_key_exists('md5_data_source', $sourceWithMd5) ? $sourceWithMd5['md5_data_source'] : $sourceWithMd5['md5_data'];
|
$importHash = array_key_exists('md5_data_source', $sourceWithMd5) ? $sourceWithMd5['md5_data_source'] : $sourceWithMd5['md5_data'];
|
||||||
$targetHash = array_key_exists('md5_data_source', $existingFileTags) ? $existingFileTags['md5_data_source'] : $existingFileTags['md5_data'];
|
$targetHash = array_key_exists('md5_data_source', $existingFileTags) ? $existingFileTags['md5_data_source'] : $existingFileTags['md5_data'];
|
||||||
|
|
||||||
$this->info("Archive hash: " . $importHash);
|
$this->info('Archive hash: '.$importHash);
|
||||||
$this->info("Pony.fm hash: " . $targetHash);
|
$this->info('Pony.fm hash: '.$targetHash);
|
||||||
|
|
||||||
if ($importHash == $targetHash) {
|
if ($importHash == $targetHash) {
|
||||||
// Audio is identical, no need to reupload
|
// Audio is identical, no need to reupload
|
||||||
|
@ -319,16 +314,18 @@ class ImportEQBeats extends Command
|
||||||
if (strlen($existingTrack->description) < strlen($parsedTags['comments'])) {
|
if (strlen($existingTrack->description) < strlen($parsedTags['comments'])) {
|
||||||
$existingTrack->description = $parsedTags['comments'];
|
$existingTrack->description = $parsedTags['comments'];
|
||||||
$changedMetadata = true;
|
$changedMetadata = true;
|
||||||
$this->comment("Updated description");
|
$this->comment('Updated description');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($existingTrack->lyrics) < strlen($parsedTags['lyrics'])) {
|
if (strlen($existingTrack->lyrics) < strlen($parsedTags['lyrics'])) {
|
||||||
$existingTrack->lyrics = $parsedTags['lyrics'];
|
$existingTrack->lyrics = $parsedTags['lyrics'];
|
||||||
$changedMetadata = true;
|
$changedMetadata = true;
|
||||||
$this->comment("Updated lyrics");
|
$this->comment('Updated lyrics');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($changedMetadata) $existingTrack->save();
|
if ($changedMetadata) {
|
||||||
|
$existingTrack->save();
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -340,7 +337,7 @@ class ImportEQBeats extends Command
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->comment("Not replacing, user uploaded");
|
$this->comment('Not replacing, user uploaded');
|
||||||
|
|
||||||
// We can update the metadata though
|
// We can update the metadata though
|
||||||
$changedMetadata = false;
|
$changedMetadata = false;
|
||||||
|
@ -348,21 +345,23 @@ class ImportEQBeats extends Command
|
||||||
if (strlen($existingTrack->description) < strlen($parsedTags['comments'])) {
|
if (strlen($existingTrack->description) < strlen($parsedTags['comments'])) {
|
||||||
$existingTrack->description = $parsedTags['comments'];
|
$existingTrack->description = $parsedTags['comments'];
|
||||||
$changedMetadata = true;
|
$changedMetadata = true;
|
||||||
$this->comment("Updated description");
|
$this->comment('Updated description');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($existingTrack->lyrics) < strlen($parsedTags['lyrics'])) {
|
if (strlen($existingTrack->lyrics) < strlen($parsedTags['lyrics'])) {
|
||||||
$existingTrack->lyrics = $parsedTags['lyrics'];
|
$existingTrack->lyrics = $parsedTags['lyrics'];
|
||||||
$changedMetadata = true;
|
$changedMetadata = true;
|
||||||
$this->comment("Updated lyrics");
|
$this->comment('Updated lyrics');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($changedMetadata) $existingTrack->save();
|
if ($changedMetadata) {
|
||||||
|
$existingTrack->save();
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->comment("No duplicates");
|
$this->comment('No duplicates');
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -443,7 +442,7 @@ class ImportEQBeats extends Command
|
||||||
$album->title = $albumName;
|
$album->title = $albumName;
|
||||||
$album->user_id = $artist->id;
|
$album->user_id = $artist->id;
|
||||||
$album->cover_id = $coverId;
|
$album->cover_id = $coverId;
|
||||||
$album->description = "";
|
$album->description = '';
|
||||||
|
|
||||||
$album->save();
|
$album->save();
|
||||||
}
|
}
|
||||||
|
@ -479,8 +478,8 @@ class ImportEQBeats extends Command
|
||||||
$track->is_downloadable = true;
|
$track->is_downloadable = true;
|
||||||
$track->is_vocal = $isVocal;
|
$track->is_vocal = $isVocal;
|
||||||
$track->license_id = 2;
|
$track->license_id = 2;
|
||||||
$track->description = "";
|
$track->description = '';
|
||||||
$track->lyrics = "";
|
$track->lyrics = '';
|
||||||
|
|
||||||
if (! is_null($parsedTags['comments'])) {
|
if (! is_null($parsedTags['comments'])) {
|
||||||
$track->description = $parsedTags['comments'];
|
$track->description = $parsedTags['comments'];
|
||||||
|
@ -501,7 +500,7 @@ class ImportEQBeats extends Command
|
||||||
->insert([
|
->insert([
|
||||||
'track_id' => $result->getResponse()['id'],
|
'track_id' => $result->getResponse()['id'],
|
||||||
'path' => $file->getRelativePath(),
|
'path' => $file->getRelativePath(),
|
||||||
'filename' => iconv("UTF-8", "ISO-8859-1//TRANSLIT", $file->getFilename()),
|
'filename' => iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $file->getFilename()),
|
||||||
'extension' => $file->getExtension(),
|
'extension' => $file->getExtension(),
|
||||||
'imported_at' => Carbon::now(),
|
'imported_at' => Carbon::now(),
|
||||||
'parsed_tags' => json_encode($parsedTags),
|
'parsed_tags' => json_encode($parsedTags),
|
||||||
|
@ -513,13 +512,16 @@ class ImportEQBeats extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function hashAudio($filepath) {
|
protected function hashAudio($filepath)
|
||||||
|
{
|
||||||
$hash = hash_file('crc32b', $filepath);
|
$hash = hash_file('crc32b', $filepath);
|
||||||
$array = unpack('N', pack('H*', $hash));
|
$array = unpack('N', pack('H*', $hash));
|
||||||
|
|
||||||
return $array[1];
|
return $array[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFormat($extension) {
|
protected function getFormat($extension)
|
||||||
|
{
|
||||||
foreach (Track::$Formats as $name => $format) {
|
foreach (Track::$Formats as $name => $format) {
|
||||||
if ($format['extension'] == $extension) {
|
if ($format['extension'] == $extension) {
|
||||||
return $name;
|
return $name;
|
||||||
|
@ -565,7 +567,6 @@ class ImportEQBeats extends Command
|
||||||
$rawTags = [];
|
$rawTags = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return [$parsedTags, $rawTags];
|
return [$parsedTags, $rawTags];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,7 +624,7 @@ class ImportEQBeats extends Command
|
||||||
'comments' => $comment,
|
'comments' => $comment,
|
||||||
'lyrics' => isset($tags['unsynchronised_lyric']) ? $tags['unsynchronised_lyric'][0] : null,
|
'lyrics' => isset($tags['unsynchronised_lyric']) ? $tags['unsynchronised_lyric'][0] : null,
|
||||||
],
|
],
|
||||||
$tags
|
$tags,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +668,7 @@ class ImportEQBeats extends Command
|
||||||
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
||||||
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
||||||
],
|
],
|
||||||
$tags
|
$tags,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,7 +704,7 @@ class ImportEQBeats extends Command
|
||||||
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
'comments' => isset($tags['comments']) ? $tags['comments'][0] : null,
|
||||||
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
'lyrics' => isset($tags['lyrics']) ? $tags['lyrics'][0] : null,
|
||||||
],
|
],
|
||||||
$tags
|
$tags,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,7 +737,7 @@ class ImportEQBeats extends Command
|
||||||
// YYYY-MM
|
// YYYY-MM
|
||||||
case 7:
|
case 7:
|
||||||
try {
|
try {
|
||||||
return Carbon::createFromFormat('Y m', str_replace("-", " ", $dateString))
|
return Carbon::createFromFormat('Y m', str_replace('-', ' ', $dateString))
|
||||||
->day(1);
|
->day(1);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -745,7 +746,7 @@ class ImportEQBeats extends Command
|
||||||
// YYYY-MM-DD
|
// YYYY-MM-DD
|
||||||
case 10:
|
case 10:
|
||||||
try {
|
try {
|
||||||
return Carbon::createFromFormat('Y m d', str_replace("-", " ", $dateString));
|
return Carbon::createFromFormat('Y m d', str_replace('-', ' ', $dateString));
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +763,8 @@ class ImportEQBeats extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function replaceTrack($toBeUploaded, $targetTrack, $artist, $mime) {
|
protected function replaceTrack($toBeUploaded, $targetTrack, $artist, $mime)
|
||||||
|
{
|
||||||
Auth::loginUsingId($artist->id);
|
Auth::loginUsingId($artist->id);
|
||||||
|
|
||||||
$trackFile = new UploadedFile($toBeUploaded->getPathname(), $toBeUploaded->getFilename(), $mime, null, null, true);
|
$trackFile = new UploadedFile($toBeUploaded->getPathname(), $toBeUploaded->getFilename(), $mime, null, null, true);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,6 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use DB;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use App\Commands\MergeAccountsCommand;
|
use App\Commands\MergeAccountsCommand;
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Comment;
|
use App\Models\Comment;
|
||||||
|
@ -36,6 +32,10 @@ use App\Models\ResourceLogItem;
|
||||||
use App\Models\ResourceUser;
|
use App\Models\ResourceUser;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use DB;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class MergeAccounts extends Command
|
class MergeAccounts extends Command
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,6 @@ class MergeAccounts extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -81,9 +80,10 @@ class MergeAccounts extends Command
|
||||||
if (null !== $sourceAccount->getAccessToken()) {
|
if (null !== $sourceAccount->getAccessToken()) {
|
||||||
$this->warn("WARNING: The source account (ID {$sourceAccountId}) is linked to a Poniverse account! Normally, the destination account should be the one that's linked to a Poniverse account as that's the one that the artist will be logging into.");
|
$this->warn("WARNING: The source account (ID {$sourceAccountId}) is linked to a Poniverse account! Normally, the destination account should be the one that's linked to a Poniverse account as that's the one that the artist will be logging into.");
|
||||||
$this->line('');
|
$this->line('');
|
||||||
$this->warn("If you continue with this merge, the Poniverse account linked to the source Pony.fm account will no longer be able to log into Pony.fm.");
|
$this->warn('If you continue with this merge, the Poniverse account linked to the source Pony.fm account will no longer be able to log into Pony.fm.');
|
||||||
if (! $this->confirm('Continue merging this set of source and destination accounts?')) {
|
if (! $this->confirm('Continue merging this set of source and destination accounts?')) {
|
||||||
$this->error('Merge aborted.');
|
$this->error('Merge aborted.');
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,7 @@ class MergeAccounts extends Command
|
||||||
$this->warn("This is normal if you're merging two archived profiles but not if you're helping an artist claim their profile.");
|
$this->warn("This is normal if you're merging two archived profiles but not if you're helping an artist claim their profile.");
|
||||||
if (! $this->confirm('Continue merging this set of source and destination accounts?')) {
|
if (! $this->confirm('Continue merging this set of source and destination accounts?')) {
|
||||||
$this->error('Merge aborted.');
|
$this->error('Merge aborted.');
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +102,7 @@ class MergeAccounts extends Command
|
||||||
|
|
||||||
$command = new MergeAccountsCommand($sourceAccount, $destinationAccount);
|
$command = new MergeAccountsCommand($sourceAccount, $destinationAccount);
|
||||||
$command->execute();
|
$command->execute();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -45,7 +45,6 @@ class MigrateOldData extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -94,7 +93,7 @@ class MigrateOldData extends Command
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'uses_gravatar' => $user->uses_gravatar,
|
'uses_gravatar' => $user->uses_gravatar,
|
||||||
'gravatar' => $user->gravatar,
|
'gravatar' => $user->gravatar,
|
||||||
'avatar_id' => null
|
'avatar_id' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$coverId = null;
|
$coverId = null;
|
||||||
|
@ -119,7 +118,7 @@ class MigrateOldData extends Command
|
||||||
DB::table('genres')->insert([
|
DB::table('genres')->insert([
|
||||||
'id' => $genre->id,
|
'id' => $genre->id,
|
||||||
'name' => $genre->title,
|
'name' => $genre->title,
|
||||||
'slug' => $genre->slug
|
'slug' => $genre->slug,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +138,7 @@ class MigrateOldData extends Command
|
||||||
'id' => $playlist->id,
|
'id' => $playlist->id,
|
||||||
'user_id' => $playlist->user_id,
|
'user_id' => $playlist->user_id,
|
||||||
'view_count' => 0,
|
'view_count' => 0,
|
||||||
'download_count' => 0
|
'download_count' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($logViews as $logItem) {
|
foreach ($logViews as $logItem) {
|
||||||
|
@ -164,7 +163,7 @@ class MigrateOldData extends Command
|
||||||
'album_id' => $logItem->album_id,
|
'album_id' => $logItem->album_id,
|
||||||
'created_at' => $logItem->created_at,
|
'created_at' => $logItem->created_at,
|
||||||
'ip_address' => $logItem->ip_address,
|
'ip_address' => $logItem->ip_address,
|
||||||
'track_format_id' => $logItem->track_file_format_id - 1
|
'track_format_id' => $logItem->track_file_format_id - 1,
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Could insert log item for album '.$playlist->id.' because '.$e->getMessage());
|
$this->error('Could insert log item for album '.$playlist->id.' because '.$e->getMessage());
|
||||||
|
@ -219,7 +218,7 @@ class MigrateOldData extends Command
|
||||||
'duration' => $track->duration,
|
'duration' => $track->duration,
|
||||||
'view_count' => 0,
|
'view_count' => 0,
|
||||||
'play_count' => 0,
|
'play_count' => 0,
|
||||||
'download_count' => 0
|
'download_count' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($trackLogViews as $logItem) {
|
foreach ($trackLogViews as $logItem) {
|
||||||
|
@ -229,7 +228,7 @@ class MigrateOldData extends Command
|
||||||
'log_type' => ResourceLogItem::VIEW,
|
'log_type' => ResourceLogItem::VIEW,
|
||||||
'track_id' => $logItem->track_id,
|
'track_id' => $logItem->track_id,
|
||||||
'created_at' => $logItem->created_at,
|
'created_at' => $logItem->created_at,
|
||||||
'ip_address' => $logItem->ip_address
|
'ip_address' => $logItem->ip_address,
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Could insert log item for track '.$track->id.' because '.$e->getMessage());
|
$this->error('Could insert log item for track '.$track->id.' because '.$e->getMessage());
|
||||||
|
@ -243,7 +242,7 @@ class MigrateOldData extends Command
|
||||||
'log_type' => ResourceLogItem::PLAY,
|
'log_type' => ResourceLogItem::PLAY,
|
||||||
'track_id' => $logItem->track_id,
|
'track_id' => $logItem->track_id,
|
||||||
'created_at' => $logItem->created_at,
|
'created_at' => $logItem->created_at,
|
||||||
'ip_address' => $logItem->ip_address
|
'ip_address' => $logItem->ip_address,
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Could insert log item for track '.$track->id.' because '.$e->getMessage());
|
$this->error('Could insert log item for track '.$track->id.' because '.$e->getMessage());
|
||||||
|
@ -258,7 +257,7 @@ class MigrateOldData extends Command
|
||||||
'track_id' => $logItem->track_id,
|
'track_id' => $logItem->track_id,
|
||||||
'created_at' => $logItem->created_at,
|
'created_at' => $logItem->created_at,
|
||||||
'ip_address' => $logItem->ip_address,
|
'ip_address' => $logItem->ip_address,
|
||||||
'track_format_id' => $logItem->track_file_format_id - 1
|
'track_format_id' => $logItem->track_file_format_id - 1,
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Could insert log item for track '.$track->id.' because '.$e->getMessage());
|
$this->error('Could insert log item for track '.$track->id.' because '.$e->getMessage());
|
||||||
|
@ -272,7 +271,7 @@ class MigrateOldData extends Command
|
||||||
DB::table('show_song_track')->insert([
|
DB::table('show_song_track')->insert([
|
||||||
'id' => $song->id,
|
'id' => $song->id,
|
||||||
'show_song_id' => $song->song_id,
|
'show_song_id' => $song->song_id,
|
||||||
'track_id' => $song->track_id
|
'track_id' => $song->track_id,
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Could insert show track item for '.$song->track_id.' because '.$e->getMessage());
|
$this->error('Could insert show track item for '.$song->track_id.' because '.$e->getMessage());
|
||||||
|
@ -321,7 +320,7 @@ class MigrateOldData extends Command
|
||||||
'playlist_id' => $logItem->playlist_id,
|
'playlist_id' => $logItem->playlist_id,
|
||||||
'created_at' => $logItem->created_at,
|
'created_at' => $logItem->created_at,
|
||||||
'ip_address' => $logItem->ip_address,
|
'ip_address' => $logItem->ip_address,
|
||||||
'track_format_id' => $logItem->track_file_format_id - 1
|
'track_format_id' => $logItem->track_file_format_id - 1,
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error('Could insert log item for playlist '.$playlist->id.' because '.$e->getMessage());
|
$this->error('Could insert log item for playlist '.$playlist->id.' because '.$e->getMessage());
|
||||||
|
@ -338,7 +337,7 @@ class MigrateOldData extends Command
|
||||||
'updated_at' => $playlistTrack->updated_at,
|
'updated_at' => $playlistTrack->updated_at,
|
||||||
'position' => $playlistTrack->position,
|
'position' => $playlistTrack->position,
|
||||||
'playlist_id' => $playlistTrack->playlist_id,
|
'playlist_id' => $playlistTrack->playlist_id,
|
||||||
'track_id' => $playlistTrack->track_id
|
'track_id' => $playlistTrack->track_id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +355,7 @@ class MigrateOldData extends Command
|
||||||
'track_id' => $comment->track_id,
|
'track_id' => $comment->track_id,
|
||||||
'album_id' => $comment->album_id,
|
'album_id' => $comment->album_id,
|
||||||
'playlist_id' => $comment->playlist_id,
|
'playlist_id' => $comment->playlist_id,
|
||||||
'profile_id' => $comment->profile_id
|
'profile_id' => $comment->profile_id,
|
||||||
]);
|
]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->error('Could not sync comment '.$comment->id.' because '.$e->getMessage());
|
$this->error('Could not sync comment '.$comment->id.' because '.$e->getMessage());
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\ClientException;
|
use GuzzleHttp\Exception\ClientException;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use GuzzleHttp\Client;
|
|
||||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||||
|
|
||||||
class PoniverseApiSetup extends Command
|
class PoniverseApiSetup extends Command
|
||||||
|
@ -43,7 +43,6 @@ class PoniverseApiSetup extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -74,7 +73,7 @@ class PoniverseApiSetup extends Command
|
||||||
$response = $client->post('api-credentials', [
|
$response = $client->post('api-credentials', [
|
||||||
'headers' => ['accept' => 'application/json'],
|
'headers' => ['accept' => 'application/json'],
|
||||||
'auth' => [$username, $password],
|
'auth' => [$username, $password],
|
||||||
'query' => ['app' => 'Pony.fm']
|
'query' => ['app' => 'Pony.fm'],
|
||||||
]);
|
]);
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
if ($e->getResponse()->getStatusCode() === 401) {
|
if ($e->getResponse()->getStatusCode() === 401) {
|
||||||
|
@ -97,7 +96,6 @@ class PoniverseApiSetup extends Command
|
||||||
$this->info('Client ID and secret set!');
|
$this->info('Client ID and secret set!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function setEnvironmentVariable($key, $oldValue, $newValue)
|
protected function setEnvironmentVariable($key, $oldValue, $newValue)
|
||||||
{
|
{
|
||||||
$path = base_path('.env');
|
$path = base_path('.env');
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
class RebuildArtists extends Command
|
class RebuildArtists extends Command
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,6 @@ class RebuildArtists extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Kelvin Zhang
|
* Copyright (C) 2015 Kelvin Zhang.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\TrackFile;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\TrackFile;
|
|
||||||
|
|
||||||
class RebuildFilesizes extends Command
|
class RebuildFilesizes extends Command
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,6 @@ class RebuildFilesizes extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -65,12 +64,10 @@ class RebuildFilesizes extends Command
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
TrackFile::chunk(200, function ($trackFiles) {
|
TrackFile::chunk(200, function ($trackFiles) {
|
||||||
|
|
||||||
$this->info('========== Start Chunk ==========');
|
$this->info('========== Start Chunk ==========');
|
||||||
|
|
||||||
foreach ($trackFiles as $trackFile) {
|
foreach ($trackFiles as $trackFile) {
|
||||||
/** @var TrackFile $trackFile */
|
/** @var TrackFile $trackFile */
|
||||||
|
|
||||||
if (File::exists($trackFile->getFile())) {
|
if (File::exists($trackFile->getFile())) {
|
||||||
$size = $trackFile->updateFilesize();
|
$size = $trackFile->updateFilesize();
|
||||||
$this->info('ID '.$trackFile->id.' processed - '.$size.' bytes');
|
$this->info('ID '.$trackFile->id.' processed - '.$size.' bytes');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2017 Isaac Avram
|
* Copyright (C) 2017 Isaac Avram.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||||
use Symfony\Component\HttpFoundation\File\File;
|
use Symfony\Component\HttpFoundation\File\File;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class RebuildImages extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$this->info("Regenerating Images");
|
$this->info('Regenerating Images');
|
||||||
$progressBar = $this->output->createProgressBar(Image::count());
|
$progressBar = $this->output->createProgressBar(Image::count());
|
||||||
|
|
||||||
Image::chunk(1000, function ($images) use ($progressBar) {
|
Image::chunk(1000, function ($images) use ($progressBar) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Playlist;
|
use App\Models\Playlist;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
|
||||||
class RebuildSearchIndex extends Command
|
class RebuildSearchIndex extends Command
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,6 @@ class RebuildSearchIndex extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -65,7 +64,7 @@ class RebuildSearchIndex extends Command
|
||||||
$totalUsers = User::count();
|
$totalUsers = User::count();
|
||||||
|
|
||||||
$trackProgress = $this->output->createProgressBar($totalTracks);
|
$trackProgress = $this->output->createProgressBar($totalTracks);
|
||||||
$this->info("Processing tracks...");
|
$this->info('Processing tracks...');
|
||||||
Track::withTrashed()->chunk(200, function (Collection $tracks) use ($trackProgress) {
|
Track::withTrashed()->chunk(200, function (Collection $tracks) use ($trackProgress) {
|
||||||
foreach ($tracks as $track) {
|
foreach ($tracks as $track) {
|
||||||
/** @var Track $track */
|
/** @var Track $track */
|
||||||
|
@ -76,9 +75,8 @@ class RebuildSearchIndex extends Command
|
||||||
$trackProgress->finish();
|
$trackProgress->finish();
|
||||||
$this->line('');
|
$this->line('');
|
||||||
|
|
||||||
|
|
||||||
$albumProgress = $this->output->createProgressBar($totalAlbums);
|
$albumProgress = $this->output->createProgressBar($totalAlbums);
|
||||||
$this->info("Processing albums...");
|
$this->info('Processing albums...');
|
||||||
Album::withTrashed()->chunk(200, function (Collection $albums) use ($albumProgress) {
|
Album::withTrashed()->chunk(200, function (Collection $albums) use ($albumProgress) {
|
||||||
foreach ($albums as $album) {
|
foreach ($albums as $album) {
|
||||||
/** @var Album $album */
|
/** @var Album $album */
|
||||||
|
@ -89,9 +87,8 @@ class RebuildSearchIndex extends Command
|
||||||
$albumProgress->finish();
|
$albumProgress->finish();
|
||||||
$this->line('');
|
$this->line('');
|
||||||
|
|
||||||
|
|
||||||
$playlistProgress = $this->output->createProgressBar($totalPlaylists);
|
$playlistProgress = $this->output->createProgressBar($totalPlaylists);
|
||||||
$this->info("Processing playlists...");
|
$this->info('Processing playlists...');
|
||||||
Playlist::withTrashed()->chunk(200, function (Collection $playlists) use ($playlistProgress) {
|
Playlist::withTrashed()->chunk(200, function (Collection $playlists) use ($playlistProgress) {
|
||||||
foreach ($playlists as $playlist) {
|
foreach ($playlists as $playlist) {
|
||||||
/** @var Playlist $playlist */
|
/** @var Playlist $playlist */
|
||||||
|
@ -102,9 +99,8 @@ class RebuildSearchIndex extends Command
|
||||||
$playlistProgress->finish();
|
$playlistProgress->finish();
|
||||||
$this->line('');
|
$this->line('');
|
||||||
|
|
||||||
|
|
||||||
$userProgress = $this->output->createProgressBar($totalUsers);
|
$userProgress = $this->output->createProgressBar($totalUsers);
|
||||||
$this->info("Processing users...");
|
$this->info('Processing users...');
|
||||||
User::chunk(200, function (Collection $users) use ($userProgress) {
|
User::chunk(200, function (Collection $users) use ($userProgress) {
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -42,7 +42,6 @@ class RebuildTags extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -63,7 +62,7 @@ class RebuildTags extends Command
|
||||||
$tracks = Track::whereNotNull('published_at')->withTrashed()->orderBy('id', 'asc')->get();
|
$tracks = Track::whereNotNull('published_at')->withTrashed()->orderBy('id', 'asc')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$numberOfTracks = sizeof($tracks);
|
$numberOfTracks = count($tracks);
|
||||||
|
|
||||||
$this->info("Updating tags for ${numberOfTracks} tracks...");
|
$this->info("Updating tags for ${numberOfTracks} tracks...");
|
||||||
$bar = $this->output->createProgressBar($numberOfTracks);
|
$bar = $this->output->createProgressBar($numberOfTracks);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use App\Commands\GenerateTrackFilesCommand;
|
use App\Commands\GenerateTrackFilesCommand;
|
||||||
use App\Jobs\EncodeTrackFile;
|
use App\Jobs\EncodeTrackFile;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
|
||||||
class RebuildTrack extends Command
|
class RebuildTrack extends Command
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,6 @@ class RebuildTrack extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -78,7 +77,7 @@ class RebuildTrack extends Command
|
||||||
// The GenerateTrackFiles command will re-encode all TrackFiles.
|
// The GenerateTrackFiles command will re-encode all TrackFiles.
|
||||||
|
|
||||||
if ($result->didFail()) {
|
if ($result->didFail()) {
|
||||||
$this->error("Something went wrong!");
|
$this->error('Something went wrong!');
|
||||||
print_r($result->getMessages());
|
print_r($result->getMessages());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +94,7 @@ class RebuildTrack extends Command
|
||||||
|
|
||||||
private function printTrackInfo(Track $track)
|
private function printTrackInfo(Track $track)
|
||||||
{
|
{
|
||||||
$this->comment("Track info:");
|
$this->comment('Track info:');
|
||||||
$this->comment(" Title: {$track->title}");
|
$this->comment(" Title: {$track->title}");
|
||||||
$this->comment(" Uploaded at: {$track->created_at}");
|
$this->comment(" Uploaded at: {$track->created_at}");
|
||||||
$this->comment(" Artist: {$track->user->display_name} [User ID: {$track->user_id}]");
|
$this->comment(" Artist: {$track->user->display_name} [User ID: {$track->user_id}]");
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Kelvin Zhang
|
* Copyright (C) 2015 Kelvin Zhang.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,16 +20,15 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use File;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use App\Jobs\EncodeTrackFile;
|
use App\Jobs\EncodeTrackFile;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\TrackFile;
|
use App\Models\TrackFile;
|
||||||
|
use File;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
|
||||||
class RebuildTrackCache extends Command
|
class RebuildTrackCache extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
use DispatchesJobs;
|
use DispatchesJobs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +48,6 @@ class RebuildTrackCache extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -172,7 +170,6 @@ class RebuildTrackCache extends Command
|
||||||
$this->output->newLine(1);
|
$this->output->newLine(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$this->info('Format(s) set from cacheable to non-cacheable: '.implode(' ', array_unique($formats)));
|
$this->info('Format(s) set from cacheable to non-cacheable: '.implode(' ', array_unique($formats)));
|
||||||
$this->info($trackFileCount.' cacheable track files set to non-cacheable.');
|
$this->info($trackFileCount.' cacheable track files set to non-cacheable.');
|
||||||
|
|
||||||
|
@ -209,7 +206,6 @@ class RebuildTrackCache extends Command
|
||||||
$this->output->newLine(1);
|
$this->output->newLine(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$this->info(sprintf('%d track files deleted out of %d track files. Continuing.', $count, $trackFileCount));
|
$this->info(sprintf('%d track files deleted out of %d track files. Continuing.', $count, $trackFileCount));
|
||||||
|
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
|
@ -248,7 +244,6 @@ class RebuildTrackCache extends Command
|
||||||
$this->output->newLine(1);
|
$this->output->newLine(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$this->info($count.' track files encoded.');
|
$this->info($count.' track files encoded.');
|
||||||
$this->output->newLine(1);
|
$this->output->newLine(1);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -42,7 +42,6 @@ class RefreshCache extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -62,17 +61,17 @@ class RefreshCache extends Command
|
||||||
|
|
||||||
DB::table('albums')->update([
|
DB::table('albums')->update([
|
||||||
'comment_count' => DB::raw('(SELECT COUNT(id) FROM comments WHERE comments.album_id = albums.id AND deleted_at IS NULL)'),
|
'comment_count' => DB::raw('(SELECT COUNT(id) FROM comments WHERE comments.album_id = albums.id AND deleted_at IS NULL)'),
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE album_id = albums.id)')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE album_id = albums.id)'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
DB::table('playlists')->update([
|
DB::table('playlists')->update([
|
||||||
'comment_count' => DB::raw('(SELECT COUNT(id) FROM comments WHERE comments.playlist_id = playlists.id AND deleted_at IS NULL)'),
|
'comment_count' => DB::raw('(SELECT COUNT(id) FROM comments WHERE comments.playlist_id = playlists.id AND deleted_at IS NULL)'),
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = playlists.id)')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = playlists.id)'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
DB::table('users')->update([
|
DB::table('users')->update([
|
||||||
'comment_count' => DB::raw('(SELECT COUNT(id) FROM comments WHERE comments.profile_id = users.id AND deleted_at IS NULL)'),
|
'comment_count' => DB::raw('(SELECT COUNT(id) FROM comments WHERE comments.profile_id = users.id AND deleted_at IS NULL)'),
|
||||||
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE deleted_at IS NULL AND published_at IS NOT NULL AND user_id = users.id)')
|
'track_count' => DB::raw('(SELECT COUNT(id) FROM tracks WHERE deleted_at IS NULL AND published_at IS NOT NULL AND user_id = users.id)'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$users = DB::table('users')->get();
|
$users = DB::table('users')->get();
|
||||||
|
@ -80,7 +79,7 @@ class RefreshCache extends Command
|
||||||
$resources = [
|
$resources = [
|
||||||
'album' => [],
|
'album' => [],
|
||||||
'playlist' => [],
|
'playlist' => [],
|
||||||
'track' => []
|
'track' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
|
@ -235,7 +234,7 @@ class RefreshCache extends Command
|
||||||
'view_count' => 0,
|
'view_count' => 0,
|
||||||
'play_count' => 0,
|
'play_count' => 0,
|
||||||
'download_count' => 0,
|
'download_count' => 0,
|
||||||
'user_id' => $userId
|
'user_id' => $userId,
|
||||||
];
|
];
|
||||||
|
|
||||||
$item[$type.'_id'] = $id;
|
$item[$type.'_id'] = $id;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use League\OAuth2\Client\Token\AccessToken;
|
use League\OAuth2\Client\Token\AccessToken;
|
||||||
use Poniverse\Lib\Client;
|
use Poniverse\Lib\Client;
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class SyncPoniverseAccounts extends Command
|
class SyncPoniverseAccounts extends Command
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Kelvin Zhang
|
* Copyright (C) 2016 Kelvin Zhang.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\TrackFile;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\TrackFile;
|
|
||||||
|
|
||||||
class VersionFiles extends Command
|
class VersionFiles extends Command
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,6 @@ class VersionFiles extends Command
|
||||||
|
|
||||||
if ($this->option('force') || $this->confirm('Are you sure you want to rename all unversioned track files? [y|N]', false)) {
|
if ($this->option('force') || $this->confirm('Are you sure you want to rename all unversioned track files? [y|N]', false)) {
|
||||||
TrackFile::chunk(200, function ($trackFiles) {
|
TrackFile::chunk(200, function ($trackFiles) {
|
||||||
|
|
||||||
$this->info('========== Start Chunk ==========');
|
$this->info('========== Start Chunk ==========');
|
||||||
|
|
||||||
foreach ($trackFiles as $trackFile) {
|
foreach ($trackFiles as $trackFile) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -25,8 +25,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
/**
|
/**
|
||||||
* This interface is used for type safety when referring to entities that
|
* This interface is used for type safety when referring to entities that
|
||||||
* are capable of accepting comments.
|
* are capable of accepting comments.
|
||||||
*
|
|
||||||
* @package App\Contracts
|
|
||||||
*/
|
*/
|
||||||
interface Commentable extends GeneratesNotifications
|
interface Commentable extends GeneratesNotifications
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -25,8 +25,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
/**
|
/**
|
||||||
* This interface is used for type safety when referring to entities that
|
* This interface is used for type safety when referring to entities that
|
||||||
* are capable of being favourited.
|
* are capable of being favourited.
|
||||||
*
|
|
||||||
* @package App\Contracts
|
|
||||||
*/
|
*/
|
||||||
interface Favouritable extends GeneratesNotifications
|
interface Favouritable extends GeneratesNotifications
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,14 +20,12 @@
|
||||||
|
|
||||||
namespace App\Contracts;
|
namespace App\Contracts;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used for type safety when referring to entities that can be
|
* This interface is used for type safety when referring to entities that can be
|
||||||
* the "target resource" of a notification (ie. what the notification is about).
|
* the "target resource" of a notification (ie. what the notification is about).
|
||||||
*
|
|
||||||
* @package App\Contracts
|
|
||||||
*/
|
*/
|
||||||
interface GeneratesNotifications
|
interface GeneratesNotifications
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -26,12 +26,7 @@ use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface NotificationHandler
|
* Interface NotificationHandler.
|
||||||
* @package App\Contracts
|
|
||||||
*
|
|
||||||
* Each method in this interface represents a type of notification. To add a new
|
|
||||||
* type of notification, add a method for it to this interface and every class
|
|
||||||
* that implements it. Your IDE should be able to help with this.
|
|
||||||
*/
|
*/
|
||||||
interface NotificationHandler
|
interface NotificationHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -36,5 +36,6 @@ interface Searchable
|
||||||
public function shouldBeIndexed():bool;
|
public function shouldBeIndexed():bool;
|
||||||
|
|
||||||
public function updateElasticsearchEntry();
|
public function updateElasticsearchEntry();
|
||||||
|
|
||||||
public function updateElasticsearchEntrySynchronously();
|
public function updateElasticsearchEntrySynchronously();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
|
||||||
use GrahamCampbell\Exceptions\ExceptionHandler;
|
use GrahamCampbell\Exceptions\ExceptionHandler;
|
||||||
|
use Illuminate\Auth\AuthenticationException;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,6 @@ class Handler extends ExceptionHandler
|
||||||
'password_confirmation',
|
'password_confirmation',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report or log an exception.
|
* Report or log an exception.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -23,7 +23,7 @@ namespace App\Exceptions;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TrackFileNotFoundException
|
* Class TrackFileNotFoundException.
|
||||||
*
|
*
|
||||||
* This exception is used to indicate that the requested `TrackFile` object
|
* This exception is used to indicate that the requested `TrackFile` object
|
||||||
* does not exist. This is useful when dealing with albums or playlists that
|
* does not exist. This is useful when dealing with albums or playlists that
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\AlbumDownloader;
|
|
||||||
use App;
|
use App;
|
||||||
|
use App\AlbumDownloader;
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\ResourceLogItem;
|
use App\Models\ResourceLogItem;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -41,7 +41,7 @@ class TracksController extends Controller
|
||||||
|
|
||||||
$json = [
|
$json = [
|
||||||
'total_tracks' => $tracks->count(),
|
'total_tracks' => $tracks->count(),
|
||||||
'tracks' => $tracks->toArray()
|
'tracks' => $tracks->toArray(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return Response::json($json, 200);
|
return Response::json($json, 200);
|
||||||
|
@ -53,7 +53,7 @@ class TracksController extends Controller
|
||||||
|
|
||||||
$json = [
|
$json = [
|
||||||
'total_tracks' => $tracks->count(),
|
'total_tracks' => $tracks->count(),
|
||||||
'tracks' => $tracks->toArray()
|
'tracks' => $tracks->toArray(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return Response::json($json, 200);
|
return Response::json($json, 200);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015-2017 Feld0
|
* Copyright (C) 2015-2017 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -44,16 +44,16 @@ class TracksController extends ApiControllerBase
|
||||||
'status_url' => action('Api\V1\TracksController@getUploadStatus', ['id' => $commandData['id']]),
|
'status_url' => action('Api\V1\TracksController@getUploadStatus', ['id' => $commandData['id']]),
|
||||||
'track_url' => action('TracksController@getTrack', ['id' => $commandData['id'], 'slug' => $commandData['slug']]),
|
'track_url' => action('TracksController@getTrack', ['id' => $commandData['id'], 'slug' => $commandData['slug']]),
|
||||||
'message' => $commandData['autoPublish']
|
'message' => $commandData['autoPublish']
|
||||||
? "This track has been accepted for processing! Poll the status_url to know when it has been published. It will be published at the track_url."
|
? 'This track has been accepted for processing! Poll the status_url to know when it has been published. It will be published at the track_url.'
|
||||||
: "This track has been accepted for processing! Poll the status_url to know when it's ready to publish. It will be published at the track_url.",
|
: "This track has been accepted for processing! Poll the status_url to know when it's ready to publish. It will be published at the track_url.",
|
||||||
];
|
];
|
||||||
|
|
||||||
$response->setData($data);
|
$response->setData($data);
|
||||||
$response->setStatusCode(202);
|
$response->setStatusCode(202);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getUploadStatus($trackId)
|
public function getUploadStatus($trackId)
|
||||||
{
|
{
|
||||||
$track = Track::findOrFail($trackId);
|
$track = Track::findOrFail($trackId);
|
||||||
|
@ -67,7 +67,7 @@ class TracksController extends ApiControllerBase
|
||||||
? 'Processing complete! The track is live at the track_url. The artist can edit the track by visiting its edit_url.'
|
? 'Processing complete! The track is live at the track_url. The artist can edit the track by visiting its edit_url.'
|
||||||
: 'Processing complete! The artist must publish the track by visiting its edit_url.',
|
: 'Processing complete! The artist must publish the track by visiting its edit_url.',
|
||||||
'edit_url' => action('ContentController@getTracks', ['id' => $trackId]),
|
'edit_url' => action('ContentController@getTracks', ['id' => $trackId]),
|
||||||
'track_url' => $track->url
|
'track_url' => $track->url,
|
||||||
], 201);
|
], 201);
|
||||||
} else {
|
} else {
|
||||||
// something went wrong
|
// something went wrong
|
||||||
|
@ -83,7 +83,8 @@ class TracksController extends ApiControllerBase
|
||||||
* @param int $id track ID
|
* @param int $id track ID
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getTrackDetails($id) {
|
public function getTrackDetails($id)
|
||||||
|
{
|
||||||
/** @var Track|null $track */
|
/** @var Track|null $track */
|
||||||
$track = Track
|
$track = Track
|
||||||
::with('user', 'album', 'user.avatar', 'cover', 'genre')
|
::with('user', 'album', 'user.avatar', 'cover', 'genre')
|
||||||
|
@ -126,7 +127,8 @@ class TracksController extends ApiControllerBase
|
||||||
* @param bool $includeComments if true, includes the track's comments in the serialization
|
* @param bool $includeComments if true, includes the track's comments in the serialization
|
||||||
* @return array serialized track
|
* @return array serialized track
|
||||||
*/
|
*/
|
||||||
private static function trackToJson(Track $track, bool $includeComments, bool $includeStreamUrl) {
|
private static function trackToJson(Track $track, bool $includeComments, bool $includeStreamUrl)
|
||||||
|
{
|
||||||
$trackResponse = [
|
$trackResponse = [
|
||||||
'id' => $track->id,
|
'id' => $track->id,
|
||||||
'title' => $track->title,
|
'title' => $track->title,
|
||||||
|
@ -139,41 +141,41 @@ class TracksController extends ApiControllerBase
|
||||||
'avatars' => [
|
'avatars' => [
|
||||||
'thumbnail' => $track->user->getAvatarUrl(Image::THUMBNAIL),
|
'thumbnail' => $track->user->getAvatarUrl(Image::THUMBNAIL),
|
||||||
'small' => $track->user->getAvatarUrl(Image::SMALL),
|
'small' => $track->user->getAvatarUrl(Image::SMALL),
|
||||||
'normal' => $track->user->getAvatarUrl(Image::NORMAL)
|
'normal' => $track->user->getAvatarUrl(Image::NORMAL),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'stats' => [
|
'stats' => [
|
||||||
'views' => $track->view_count,
|
'views' => $track->view_count,
|
||||||
'plays' => $track->play_count,
|
'plays' => $track->play_count,
|
||||||
'downloads' => $track->download_count,
|
'downloads' => $track->download_count,
|
||||||
'comments' => $track->comment_count,
|
'comments' => $track->comment_count,
|
||||||
'favourites' => $track->favourite_count
|
'favourites' => $track->favourite_count,
|
||||||
],
|
],
|
||||||
'url' => $track->url,
|
'url' => $track->url,
|
||||||
'is_vocal' => !!$track->is_vocal,
|
'is_vocal' => (bool) $track->is_vocal,
|
||||||
'is_explicit' => !!$track->is_explicit,
|
'is_explicit' => (bool) $track->is_explicit,
|
||||||
'is_downloadable' => !!$track->is_downloadable,
|
'is_downloadable' => (bool) $track->is_downloadable,
|
||||||
'published_at' => $track->published_at,
|
'published_at' => $track->published_at,
|
||||||
'duration' => $track->duration,
|
'duration' => $track->duration,
|
||||||
'genre' => $track->genre != null
|
'genre' => $track->genre != null
|
||||||
?
|
?
|
||||||
[
|
[
|
||||||
'id' => $track->genre->id,
|
'id' => $track->genre->id,
|
||||||
'name' => $track->genre->name
|
'name' => $track->genre->name,
|
||||||
] : null,
|
] : null,
|
||||||
'type' => [
|
'type' => [
|
||||||
'id' => $track->trackType->id,
|
'id' => $track->trackType->id,
|
||||||
'name' => $track->trackType->title
|
'name' => $track->trackType->title,
|
||||||
],
|
],
|
||||||
'covers' => [
|
'covers' => [
|
||||||
'thumbnail' => $track->getCoverUrl(Image::THUMBNAIL),
|
'thumbnail' => $track->getCoverUrl(Image::THUMBNAIL),
|
||||||
'small' => $track->getCoverUrl(Image::SMALL),
|
'small' => $track->getCoverUrl(Image::SMALL),
|
||||||
'normal' => $track->getCoverUrl(Image::NORMAL)
|
'normal' => $track->getCoverUrl(Image::NORMAL),
|
||||||
],
|
],
|
||||||
|
|
||||||
// As of 2017-10-28, this should be expected to produce
|
// As of 2017-10-28, this should be expected to produce
|
||||||
// "direct_upload", "mlpma", "ponify", or "eqbeats" for all tracks.
|
// "direct_upload", "mlpma", "ponify", or "eqbeats" for all tracks.
|
||||||
'source' => $track->source
|
'source' => $track->source,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($includeComments) {
|
if ($includeComments) {
|
||||||
|
@ -191,8 +193,8 @@ class TracksController extends ApiControllerBase
|
||||||
'normal' => $comment->user->getAvatarUrl(Image::NORMAL),
|
'normal' => $comment->user->getAvatarUrl(Image::NORMAL),
|
||||||
'thumbnail' => $comment->user->getAvatarUrl(Image::THUMBNAIL),
|
'thumbnail' => $comment->user->getAvatarUrl(Image::THUMBNAIL),
|
||||||
'small' => $comment->user->getAvatarUrl(Image::SMALL),
|
'small' => $comment->user->getAvatarUrl(Image::SMALL),
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +206,7 @@ class TracksController extends ApiControllerBase
|
||||||
'mp3' => [
|
'mp3' => [
|
||||||
'url' => $track->getStreamUrl('MP3', session('api_client_id')),
|
'url' => $track->getStreamUrl('MP3', session('api_client_id')),
|
||||||
'mime_type' => Track::$Formats['MP3']['mime_type'],
|
'mime_type' => Track::$Formats['MP3']['mime_type'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
|
||||||
use App\Commands\SaveAccountSettingsCommand;
|
use App\Commands\SaveAccountSettingsCommand;
|
||||||
use App\Models\User;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use Gate;
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Gate;
|
||||||
use Request;
|
use Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
|
@ -36,11 +36,12 @@ class AccountController extends ApiControllerBase
|
||||||
$this->authorize('edit', $user);
|
$this->authorize('edit', $user);
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'user' => $user->toArray()
|
'user' => $user->toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCurrentUser() {
|
public function getCurrentUser()
|
||||||
|
{
|
||||||
$current_user = Auth::user();
|
$current_user = Auth::user();
|
||||||
|
|
||||||
if ($current_user != null) {
|
if ($current_user != null) {
|
||||||
|
@ -58,9 +59,9 @@ class AccountController extends ApiControllerBase
|
||||||
'is_archived' => $user->is_archived,
|
'is_archived' => $user->is_archived,
|
||||||
'avatars' => [
|
'avatars' => [
|
||||||
'small' => $user->getAvatarUrl(Image::SMALL),
|
'small' => $user->getAvatarUrl(Image::SMALL),
|
||||||
'normal' => $user->getAvatarUrl(Image::NORMAL)
|
'normal' => $user->getAvatarUrl(Image::NORMAL),
|
||||||
],
|
],
|
||||||
'created_at' => $user->created_at
|
'created_at' => $user->created_at,
|
||||||
], 200);
|
], 200);
|
||||||
} else {
|
} else {
|
||||||
return Response::json(['error' => 'You are not logged in'], 404);
|
return Response::json(['error' => 'You are not logged in'], 404);
|
||||||
|
@ -88,7 +89,6 @@ class AccountController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'id' => $user->id,
|
'id' => $user->id,
|
||||||
'bio' => $user->bio,
|
'bio' => $user->bio,
|
||||||
|
@ -100,7 +100,7 @@ class AccountController extends ApiControllerBase
|
||||||
'avatar_url' => ! $user->uses_gravatar ? $user->getAvatarUrl() : null,
|
'avatar_url' => ! $user->uses_gravatar ? $user->getAvatarUrl() : null,
|
||||||
'uses_gravatar' => $user->uses_gravatar == 1,
|
'uses_gravatar' => $user->uses_gravatar == 1,
|
||||||
'notification_email' => $user->email,
|
'notification_email' => $user->email,
|
||||||
'notifications' => $user->getNotificationSettings()
|
'notifications' => $user->getNotificationSettings(),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,20 +20,20 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use App\Models\Album;
|
|
||||||
use App\Commands\CreateAlbumCommand;
|
use App\Commands\CreateAlbumCommand;
|
||||||
use App\Commands\DeleteAlbumCommand;
|
use App\Commands\DeleteAlbumCommand;
|
||||||
use App\Commands\EditAlbumCommand;
|
use App\Commands\EditAlbumCommand;
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
|
use App\Models\Album;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\ResourceLogItem;
|
use App\Models\ResourceLogItem;
|
||||||
|
use App\Models\Track;
|
||||||
|
use App\Models\User;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Gate;
|
use Gate;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use App\Models\User;
|
|
||||||
use Response;
|
use Response;
|
||||||
use App\Models\Track;
|
|
||||||
|
|
||||||
class AlbumsController extends ApiControllerBase
|
class AlbumsController extends ApiControllerBase
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ class AlbumsController extends ApiControllerBase
|
||||||
'user',
|
'user',
|
||||||
'user.avatar',
|
'user.avatar',
|
||||||
'comments',
|
'comments',
|
||||||
'comments.user'
|
'comments.user',
|
||||||
])
|
])
|
||||||
->userDetails()
|
->userDetails()
|
||||||
->find($id);
|
->find($id);
|
||||||
|
@ -86,7 +86,7 @@ class AlbumsController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'album' => $returned_album
|
'album' => $returned_album,
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class AlbumsController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json(
|
return Response::json(
|
||||||
["albums" => $albums, "current_page" => $page, "total_pages" => ceil($count / $perPage)],
|
['albums' => $albums, 'current_page' => $page, 'total_pages' => ceil($count / $perPage)],
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ class AlbumsController extends ApiControllerBase
|
||||||
'created_at' => $album->created_at->format('c'),
|
'created_at' => $album->created_at->format('c'),
|
||||||
'covers' => [
|
'covers' => [
|
||||||
'small' => $album->getCoverUrl(Image::SMALL),
|
'small' => $album->getCoverUrl(Image::SMALL),
|
||||||
'normal' => $album->getCoverUrl(Image::NORMAL)
|
'normal' => $album->getCoverUrl(Image::NORMAL),
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class AlbumsController extends ApiControllerBase
|
||||||
foreach ($album->tracks as $track) {
|
foreach ($album->tracks as $track) {
|
||||||
$tracks[] = [
|
$tracks[] = [
|
||||||
'id' => $track->id,
|
'id' => $track->id,
|
||||||
'title' => $track->title
|
'title' => $track->title,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class AlbumsController extends ApiControllerBase
|
||||||
'description' => $album->description,
|
'description' => $album->description,
|
||||||
'cover_url' => $album->hasCover() ? $album->getCoverUrl(Image::NORMAL) : null,
|
'cover_url' => $album->hasCover() ? $album->getCoverUrl(Image::NORMAL) : null,
|
||||||
'real_cover_url' => $album->getCoverUrl(Image::NORMAL),
|
'real_cover_url' => $album->getCoverUrl(Image::NORMAL),
|
||||||
'tracks' => $tracks
|
'tracks' => $tracks,
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Session\Store;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\AlexaSession;
|
use App\Models\AlexaSession;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Session\Store;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class AlexaController extends Controller
|
class AlexaController extends Controller
|
||||||
|
@ -35,11 +35,11 @@ class AlexaController extends Controller
|
||||||
|
|
||||||
$logger->debug('Incoming Alexa Request', [
|
$logger->debug('Incoming Alexa Request', [
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'intent' => $intent
|
'intent' => $intent,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$logger->debug('Incoming Alexa Full Request', [
|
$logger->debug('Incoming Alexa Full Request', [
|
||||||
'json' => json_encode($request->json()->all(), JSON_PRETTY_PRINT)
|
'json' => json_encode($request->json()->all(), JSON_PRETTY_PRINT),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** @var JsonResponse $response */
|
/** @var JsonResponse $response */
|
||||||
|
@ -63,7 +63,7 @@ class AlexaController extends Controller
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'LaunchRequest':
|
case 'LaunchRequest':
|
||||||
return $this->launch();
|
return $this->launch();
|
||||||
case 'PlayAudio';
|
case 'PlayAudio':
|
||||||
return $this->play();
|
return $this->play();
|
||||||
case 'AudioPlayer.PlaybackNearlyFinished':
|
case 'AudioPlayer.PlaybackNearlyFinished':
|
||||||
return $this->queueNextTrack();
|
return $this->queueNextTrack();
|
||||||
|
@ -101,9 +101,9 @@ class AlexaController extends Controller
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'sessionAttributes' => (object) [],
|
'sessionAttributes' => (object) [],
|
||||||
'response' => [
|
'response' => [
|
||||||
"outputSpeech" => [
|
'outputSpeech' => [
|
||||||
"type" => "SSML",
|
'type' => 'SSML',
|
||||||
"ssml" => "<speak>If you want to play music, say 'Alexa, ask pony fm to play'</speak>"
|
'ssml' => "<speak>If you want to play music, say 'Alexa, ask pony fm to play'</speak>",
|
||||||
],
|
],
|
||||||
'shouldEndSession' => true,
|
'shouldEndSession' => true,
|
||||||
],
|
],
|
||||||
|
@ -116,9 +116,9 @@ class AlexaController extends Controller
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'sessionAttributes' => (object) [],
|
'sessionAttributes' => (object) [],
|
||||||
'response' => [
|
'response' => [
|
||||||
"outputSpeech" => [
|
'outputSpeech' => [
|
||||||
"type" => "SSML",
|
'type' => 'SSML',
|
||||||
"ssml" => "<speak>Sorry, I don't recognise that command.</speak>"
|
'ssml' => "<speak>Sorry, I don't recognise that command.</speak>",
|
||||||
],
|
],
|
||||||
'shouldEndSession' => true,
|
'shouldEndSession' => true,
|
||||||
],
|
],
|
||||||
|
@ -131,13 +131,13 @@ class AlexaController extends Controller
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'sessionAttributes' => (object) [],
|
'sessionAttributes' => (object) [],
|
||||||
'response' => [
|
'response' => [
|
||||||
"outputSpeech" => [
|
'outputSpeech' => [
|
||||||
"type" => "SSML",
|
'type' => 'SSML',
|
||||||
"ssml" => "
|
'ssml' => '
|
||||||
<speak>
|
<speak>
|
||||||
Pony.fm was built by Pixel Wavelength for Viola to keep all her music in one place.
|
Pony.fm was built by Pixel Wavelength for Viola to keep all her music in one place.
|
||||||
</speak>
|
</speak>
|
||||||
"
|
',
|
||||||
],
|
],
|
||||||
'shouldEndSession' => true,
|
'shouldEndSession' => true,
|
||||||
],
|
],
|
||||||
|
@ -199,16 +199,16 @@ class AlexaController extends Controller
|
||||||
'version' => '1.0',
|
'version' => '1.0',
|
||||||
'sessionAttributes' => (object) [],
|
'sessionAttributes' => (object) [],
|
||||||
'response' => [
|
'response' => [
|
||||||
"outputSpeech" => [
|
'outputSpeech' => [
|
||||||
"type" => "SSML",
|
'type' => 'SSML',
|
||||||
"ssml" => "
|
'ssml' => "
|
||||||
<speak>
|
<speak>
|
||||||
You've reached the end of the popular tracks today. To start from the beginning say 'Alexa, ask pony fm to play'
|
You've reached the end of the popular tracks today. To start from the beginning say 'Alexa, ask pony fm to play'
|
||||||
</speak>
|
</speak>
|
||||||
"],
|
", ],
|
||||||
'directives' => [
|
'directives' => [
|
||||||
[
|
[
|
||||||
'type' => 'AudioPlayer.Stop'
|
'type' => 'AudioPlayer.Stop',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'shouldEndSession' => true,
|
'shouldEndSession' => true,
|
||||||
|
@ -247,7 +247,7 @@ class AlexaController extends Controller
|
||||||
'stream' => $stream,
|
'stream' => $stream,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ class AlexaController extends Controller
|
||||||
'stream' => $stream,
|
'stream' => $stream,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ class AlexaController extends Controller
|
||||||
'response' => [
|
'response' => [
|
||||||
'directives' => [
|
'directives' => [
|
||||||
[
|
[
|
||||||
'type' => 'AudioPlayer.Stop'
|
'type' => 'AudioPlayer.Stop',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'shouldEndSession' => true,
|
'shouldEndSession' => true,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,15 +20,17 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Commands\CreateAnnouncementCommand;
|
use App\Commands\CreateAnnouncementCommand;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Announcement;
|
use App\Models\Announcement;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Request;
|
use Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class AnnouncementsController extends Controller {
|
class AnnouncementsController extends Controller
|
||||||
public function getIndex() {
|
{
|
||||||
|
public function getIndex()
|
||||||
|
{
|
||||||
$currentDate = Carbon::now();
|
$currentDate = Carbon::now();
|
||||||
|
|
||||||
$query = Announcement::whereNotNull('start_time')
|
$query = Announcement::whereNotNull('start_time')
|
||||||
|
@ -40,23 +42,25 @@ class AnnouncementsController extends Controller {
|
||||||
$announcement = $query->first();
|
$announcement = $query->first();
|
||||||
|
|
||||||
return Response::json(
|
return Response::json(
|
||||||
["announcement" => $announcement],
|
['announcement' => $announcement],
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAdminIndex() {
|
public function getAdminIndex()
|
||||||
|
{
|
||||||
$this->authorize('access-admin-area');
|
$this->authorize('access-admin-area');
|
||||||
|
|
||||||
$announcements = Announcement::orderBy('start_time', 'desc')
|
$announcements = Announcement::orderBy('start_time', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'announcements' => $announcements->toArray()
|
'announcements' => $announcements->toArray(),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getItemById($genreId) {
|
public function getItemById($genreId)
|
||||||
|
{
|
||||||
$this->authorize('access-admin-area');
|
$this->authorize('access-admin-area');
|
||||||
|
|
||||||
$query = Announcement::where('id', '=', $genreId)
|
$query = Announcement::where('id', '=', $genreId)
|
||||||
|
@ -65,13 +69,15 @@ class AnnouncementsController extends Controller {
|
||||||
$announcement = $query->first();
|
$announcement = $query->first();
|
||||||
|
|
||||||
return Response::json(
|
return Response::json(
|
||||||
["announcement" => $announcement],
|
['announcement' => $announcement],
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postCreate() {
|
public function postCreate()
|
||||||
|
{
|
||||||
$command = new CreateAnnouncementCommand(Request::get('name'));
|
$command = new CreateAnnouncementCommand(Request::get('name'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,21 +20,21 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Gate;
|
use App;
|
||||||
use App\Commands\CreateUserCommand;
|
use App\Commands\CreateUserCommand;
|
||||||
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
use App\Models\Album;
|
use App\Models\Album;
|
||||||
use App\Models\Comment;
|
use App\Models\Comment;
|
||||||
use App\Models\Favourite;
|
use App\Models\Favourite;
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Models\Follower;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Follower;
|
use ColorThief\ColorThief;
|
||||||
use App;
|
use Gate;
|
||||||
|
use Helpers;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use Response;
|
use Response;
|
||||||
use ColorThief\ColorThief;
|
|
||||||
use Helpers;
|
|
||||||
|
|
||||||
class ArtistsController extends ApiControllerBase
|
class ArtistsController extends ApiControllerBase
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
},
|
},
|
||||||
'album' => function ($query) {
|
'album' => function ($query) {
|
||||||
$query->userDetails();
|
$query->userDetails();
|
||||||
}
|
},
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
$tracks = [];
|
$tracks = [];
|
||||||
|
@ -80,7 +80,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'tracks' => $tracks,
|
'tracks' => $tracks,
|
||||||
'albums' => $albums
|
'albums' => $albums,
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
->with([
|
->with([
|
||||||
'comments' => function ($query) {
|
'comments' => function ($query) {
|
||||||
$query->with(['user', 'user.avatar']);
|
$query->with(['user', 'user.avatar']);
|
||||||
}
|
},
|
||||||
])
|
])
|
||||||
->first();
|
->first();
|
||||||
if (! $user) {
|
if (! $user) {
|
||||||
|
@ -162,18 +162,18 @@ class ArtistsController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
$userData = [
|
$userData = [
|
||||||
'is_following' => false
|
'is_following' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($user->users->count()) {
|
if ($user->users->count()) {
|
||||||
$userRow = $user->users[0];
|
$userRow = $user->users[0];
|
||||||
$userData = [
|
$userData = [
|
||||||
'is_following' => (bool) $userRow->is_followed
|
'is_following' => (bool) $userRow->is_followed,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$palette = ColorThief::getPalette($user->getAvatarUrlLocal(Image::SMALL), 2);
|
$palette = ColorThief::getPalette($user->getAvatarUrlLocal(Image::SMALL), 2);
|
||||||
$formatted_palette = array_map("Helpers::rgb2hex", $palette);
|
$formatted_palette = array_map('Helpers::rgb2hex', $palette);
|
||||||
|
|
||||||
$followers = Follower::where('artist_id', $user->id)
|
$followers = Follower::where('artist_id', $user->id)
|
||||||
->count();
|
->count();
|
||||||
|
@ -186,7 +186,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
'is_archived' => (bool) $user->is_archived,
|
'is_archived' => (bool) $user->is_archived,
|
||||||
'avatars' => [
|
'avatars' => [
|
||||||
'small' => $user->getAvatarUrl(Image::SMALL),
|
'small' => $user->getAvatarUrl(Image::SMALL),
|
||||||
'normal' => $user->getAvatarUrl(Image::NORMAL)
|
'normal' => $user->getAvatarUrl(Image::NORMAL),
|
||||||
],
|
],
|
||||||
'avatar_colors' => $formatted_palette,
|
'avatar_colors' => $formatted_palette,
|
||||||
'created_at' => $user->created_at,
|
'created_at' => $user->created_at,
|
||||||
|
@ -199,10 +199,10 @@ class ArtistsController extends ApiControllerBase
|
||||||
'message_url' => $user->message_url,
|
'message_url' => $user->message_url,
|
||||||
'user_data' => $userData,
|
'user_data' => $userData,
|
||||||
'permissions' => [
|
'permissions' => [
|
||||||
'edit' => Gate::allows('edit', $user)
|
'edit' => Gate::allows('edit', $user),
|
||||||
|
],
|
||||||
|
'isAdmin' => $user->hasRole('admin'),
|
||||||
],
|
],
|
||||||
'isAdmin' => $user->hasRole('admin')
|
|
||||||
]
|
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json(
|
return Response::json(
|
||||||
["artists" => $users, "current_page" => $page, "total_pages" => ceil($count / $perPage)],
|
['artists' => $users, 'current_page' => $page, 'total_pages' => ceil($count / $perPage)],
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,7 @@ class ArtistsController extends ApiControllerBase
|
||||||
public function postIndex()
|
public function postIndex()
|
||||||
{
|
{
|
||||||
$name = Request::json('username');
|
$name = Request::json('username');
|
||||||
|
|
||||||
return $this->execute(new CreateUserCommand($name, $name, null, true));
|
return $this->execute(new CreateUserCommand($name, $name, null, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -22,8 +22,8 @@ namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use App\Commands\CreateCommentCommand;
|
use App\Commands\CreateCommentCommand;
|
||||||
use App\Models\Comment;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
|
use App\Models\Comment;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -51,7 +51,7 @@ class DashboardController extends ApiControllerBase
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'recent_tracks' => $recentTracks,
|
'recent_tracks' => $recentTracks,
|
||||||
'popular_tracks' => Track::popular(30, Auth::check() && Auth::user()->can_see_explicit_content)
|
'popular_tracks' => Track::popular(30, Auth::check() && Auth::user()->can_see_explicit_content),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use App\Models\Album;
|
|
||||||
use App\Commands\ToggleFavouriteCommand;
|
use App\Commands\ToggleFavouriteCommand;
|
||||||
use App\Models\Favourite;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
|
use App\Models\Album;
|
||||||
|
use App\Models\Favourite;
|
||||||
use App\Models\Playlist;
|
use App\Models\Playlist;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
@ -52,7 +52,7 @@ class FavouritesController extends ApiControllerBase
|
||||||
'track.genre',
|
'track.genre',
|
||||||
'track.cover',
|
'track.cover',
|
||||||
'track.album',
|
'track.album',
|
||||||
'track.album.user'
|
'track.album.user',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tracks = [];
|
$tracks = [];
|
||||||
|
@ -65,7 +65,7 @@ class FavouritesController extends ApiControllerBase
|
||||||
$tracks[] = Track::mapPublicTrackSummary($fav->track);
|
$tracks[] = Track::mapPublicTrackSummary($fav->track);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json(["tracks" => $tracks], 200);
|
return Response::json(['tracks' => $tracks], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAlbums()
|
public function getAlbums()
|
||||||
|
@ -79,7 +79,7 @@ class FavouritesController extends ApiControllerBase
|
||||||
},
|
},
|
||||||
'album.user',
|
'album.user',
|
||||||
'album.user.avatar',
|
'album.user.avatar',
|
||||||
'album.cover'
|
'album.cover',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$albums = [];
|
$albums = [];
|
||||||
|
@ -92,7 +92,7 @@ class FavouritesController extends ApiControllerBase
|
||||||
$albums[] = Album::mapPublicAlbumSummary($fav->album);
|
$albums[] = Album::mapPublicAlbumSummary($fav->album);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json(["albums" => $albums], 200);
|
return Response::json(['albums' => $albums], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPlaylist()
|
public function getPlaylist()
|
||||||
|
@ -107,7 +107,7 @@ class FavouritesController extends ApiControllerBase
|
||||||
'playlist.user',
|
'playlist.user',
|
||||||
'playlist.user.avatar',
|
'playlist.user.avatar',
|
||||||
'playlist.tracks',
|
'playlist.tracks',
|
||||||
'playlist.tracks.cover'
|
'playlist.tracks.cover',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$playlists = [];
|
$playlists = [];
|
||||||
|
@ -120,6 +120,6 @@ class FavouritesController extends ApiControllerBase
|
||||||
$playlists[] = Playlist::mapPublicPlaylistSummary($fav->playlist);
|
$playlists[] = Playlist::mapPublicPlaylistSummary($fav->playlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json(["playlists" => $playlists], 200);
|
return Response::json(['playlists' => $playlists], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use App\Commands\CreateGenreCommand;
|
use App\Commands\CreateGenreCommand;
|
||||||
use App\Commands\DeleteGenreCommand;
|
use App\Commands\DeleteGenreCommand;
|
||||||
use App\Commands\RenameGenreCommand;
|
use App\Commands\RenameGenreCommand;
|
||||||
use App\Models\Genre;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
|
use App\Models\Genre;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class GenresController extends ApiControllerBase
|
class GenresController extends ApiControllerBase
|
||||||
|
@ -41,26 +41,28 @@ class GenresController extends ApiControllerBase
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'genres' => $genres->toArray()
|
'genres' => $genres->toArray(),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postCreate()
|
public function postCreate()
|
||||||
{
|
{
|
||||||
$command = new CreateGenreCommand(Request::get('name'));
|
$command = new CreateGenreCommand(Request::get('name'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putRename($genreId)
|
public function putRename($genreId)
|
||||||
{
|
{
|
||||||
$command = new RenameGenreCommand($genreId, Request::get('name'));
|
$command = new RenameGenreCommand($genreId, Request::get('name'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function deleteGenre($genreId)
|
public function deleteGenre($genreId)
|
||||||
{
|
{
|
||||||
$command = new DeleteGenreCommand($genreId, Request::get('destination_genre_id'));
|
$command = new DeleteGenreCommand($genreId, Request::get('destination_genre_id'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class ImagesController extends ApiControllerBase
|
class ImagesController extends ApiControllerBase
|
||||||
|
@ -42,9 +42,9 @@ class ImagesController extends ApiControllerBase
|
||||||
'small' => $image->getUrl(Image::SMALL),
|
'small' => $image->getUrl(Image::SMALL),
|
||||||
'normal' => $image->getUrl(Image::NORMAL),
|
'normal' => $image->getUrl(Image::NORMAL),
|
||||||
'thumbnail' => $image->getUrl(Image::THUMBNAIL),
|
'thumbnail' => $image->getUrl(Image::THUMBNAIL),
|
||||||
'original' => $image->getUrl(Image::ORIGINAL)
|
'original' => $image->getUrl(Image::ORIGINAL),
|
||||||
],
|
],
|
||||||
'filename' => $image->filename
|
'filename' => $image->filename,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
use App\Models\Notification;
|
use App\Models\Notification;
|
||||||
use App\Models\Subscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
use Minishlink\WebPush\WebPush;
|
use Minishlink\WebPush\WebPush;
|
||||||
|
|
||||||
class NotificationsController extends ApiControllerBase
|
class NotificationsController extends ApiControllerBase
|
||||||
|
@ -85,7 +85,7 @@ class NotificationsController extends ApiControllerBase
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'endpoint' => $input->endpoint,
|
'endpoint' => $input->endpoint,
|
||||||
'p256dh' => $input->keys->p256dh,
|
'p256dh' => $input->keys->p256dh,
|
||||||
'auth' => $input->keys->auth
|
'auth' => $input->keys->auth,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return ['id' => $subscription->id];
|
return ['id' => $subscription->id];
|
||||||
|
@ -98,7 +98,7 @@ class NotificationsController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a user's notification subscription
|
* Removes a user's notification subscription.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use App\Commands\AddTrackToPlaylistCommand;
|
use App\Commands\AddTrackToPlaylistCommand;
|
||||||
use App\Commands\CreatePlaylistCommand;
|
use App\Commands\CreatePlaylistCommand;
|
||||||
use App\Commands\DeletePlaylistCommand;
|
use App\Commands\DeletePlaylistCommand;
|
||||||
|
@ -30,11 +29,12 @@ use App\Http\Controllers\ApiControllerBase;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use App\Models\Playlist;
|
use App\Models\Playlist;
|
||||||
use App\Models\ResourceLogItem;
|
use App\Models\ResourceLogItem;
|
||||||
use Auth;
|
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use App\Models\User;
|
|
||||||
use Response;
|
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
|
use Response;
|
||||||
|
|
||||||
class PlaylistsController extends ApiControllerBase
|
class PlaylistsController extends ApiControllerBase
|
||||||
{
|
{
|
||||||
|
@ -95,9 +95,9 @@ class PlaylistsController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
"playlists" => $playlists,
|
'playlists' => $playlists,
|
||||||
"current_page" => $page,
|
'current_page' => $page,
|
||||||
"total_pages" => ceil($count / $perPage)
|
'total_pages' => ceil($count / $perPage),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class PlaylistsController extends ApiControllerBase
|
||||||
},
|
},
|
||||||
'tracks.trackFiles',
|
'tracks.trackFiles',
|
||||||
'comments',
|
'comments',
|
||||||
'comments.user'
|
'comments.user',
|
||||||
])->userDetails()->find($id);
|
])->userDetails()->find($id);
|
||||||
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
if (! $playlist || ! $playlist->canView(Auth::user())) {
|
||||||
App::abort('404');
|
App::abort('404');
|
||||||
|
@ -201,18 +201,17 @@ class PlaylistsController extends ApiControllerBase
|
||||||
'url' => $playlist->url,
|
'url' => $playlist->url,
|
||||||
'covers' => [
|
'covers' => [
|
||||||
'small' => $playlist->getCoverUrl(Image::SMALL),
|
'small' => $playlist->getCoverUrl(Image::SMALL),
|
||||||
'normal' => $playlist->getCoverUrl(Image::NORMAL)
|
'normal' => $playlist->getCoverUrl(Image::NORMAL),
|
||||||
],
|
],
|
||||||
'is_pinned' => $playlist->hasPinFor(Auth::user()->id),
|
'is_pinned' => $playlist->hasPinFor(Auth::user()->id),
|
||||||
'is_public' => $playlist->is_public == 1,
|
'is_public' => $playlist->is_public == 1,
|
||||||
'track_ids' => $playlist->tracks->pluck('id')
|
'track_ids' => $playlist->tracks->pluck('id'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json($playlists, 200);
|
return Response::json($playlists, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function should not deal with anything other than applying order,
|
* This function should not deal with anything other than applying order,
|
||||||
* which is done after the query's total possible results are counted due
|
* which is done after the query's total possible results are counted due
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Elasticsearch;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use App\Library\Search;
|
use App\Library\Search;
|
||||||
|
use Elasticsearch;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class SearchController extends ApiControllerBase
|
class SearchController extends ApiControllerBase
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use App\Commands\CreateShowSongCommand;
|
use App\Commands\CreateShowSongCommand;
|
||||||
use App\Commands\DeleteShowSongCommand;
|
use App\Commands\DeleteShowSongCommand;
|
||||||
use App\Commands\RenameShowSongCommand;
|
use App\Commands\RenameShowSongCommand;
|
||||||
use App\Models\ShowSong;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
|
use App\Models\ShowSong;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class ShowSongsController extends ApiControllerBase
|
class ShowSongsController extends ApiControllerBase
|
||||||
|
@ -42,26 +42,28 @@ class ShowSongsController extends ApiControllerBase
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'showsongs' => $songs->toArray()
|
'showsongs' => $songs->toArray(),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postCreate()
|
public function postCreate()
|
||||||
{
|
{
|
||||||
$command = new CreateShowSongCommand(Request::get('title'));
|
$command = new CreateShowSongCommand(Request::get('title'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function putRename($songId)
|
public function putRename($songId)
|
||||||
{
|
{
|
||||||
$command = new RenameShowSongCommand($songId, Request::get('title'));
|
$command = new RenameShowSongCommand($songId, Request::get('title'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function deleteSong($songId)
|
public function deleteSong($songId)
|
||||||
{
|
{
|
||||||
$command = new DeleteShowSongCommand($songId, Request::get('destination_song_id'));
|
$command = new DeleteShowSongCommand($songId, Request::get('destination_song_id'));
|
||||||
|
|
||||||
return $this->execute($command);
|
return $this->execute($command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
use App\Models\ResourceLogItem;
|
use App\Models\ResourceLogItem;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DB;
|
|
||||||
use Response;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use DB;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
|
use Response;
|
||||||
|
|
||||||
class StatsController extends ApiControllerBase
|
class StatsController extends ApiControllerBase
|
||||||
{
|
{
|
||||||
|
@ -88,12 +88,12 @@ class StatsController extends ApiControllerBase
|
||||||
if ($hourly) {
|
if ($hourly) {
|
||||||
$set = [
|
$set = [
|
||||||
'hours' => $timeOffet.' '.str_plural('hour', $timeOffet),
|
'hours' => $timeOffet.' '.str_plural('hour', $timeOffet),
|
||||||
'plays' => $plays
|
'plays' => $plays,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$set = [
|
$set = [
|
||||||
'days' => $timeOffet.' '.str_plural('day', $timeOffet),
|
'days' => $timeOffet.' '.str_plural('day', $timeOffet),
|
||||||
'plays' => $plays
|
'plays' => $plays,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
array_push($output, $set);
|
array_push($output, $set);
|
||||||
|
@ -134,6 +134,7 @@ class StatsController extends ApiControllerBase
|
||||||
$statsData = $this->getStatsData($id, $hourly);
|
$statsData = $this->getStatsData($id, $hourly);
|
||||||
|
|
||||||
$output = $this->sortTrackStatsArray($statsData, $hourly);
|
$output = $this->sortTrackStatsArray($statsData, $hourly);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use App\Models\Genre;
|
|
||||||
use App\Http\Controllers\ApiControllerBase;
|
use App\Http\Controllers\ApiControllerBase;
|
||||||
|
use App\Models\Genre;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\ShowSong;
|
use App\Models\ShowSong;
|
||||||
use App\Models\TrackType;
|
use App\Models\TrackType;
|
||||||
|
@ -48,7 +48,7 @@ class TaxonomiesController extends ApiControllerBase
|
||||||
'id',
|
'id',
|
||||||
'slug',
|
'slug',
|
||||||
DB::raw('(SELECT COUNT(tracks.id) FROM show_song_track INNER JOIN tracks ON tracks.id = show_song_track.track_id WHERE show_song_track.show_song_id = show_songs.id AND tracks.published_at IS NOT NULL) AS track_count')
|
DB::raw('(SELECT COUNT(tracks.id) FROM show_song_track INNER JOIN tracks ON tracks.id = show_song_track.track_id WHERE show_song_track.show_song_id = show_songs.id AND tracks.published_at IS NOT NULL) AS track_count')
|
||||||
)->orderBy('title')->get()->toArray()
|
)->orderBy('title')->get()->toArray(),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,10 +20,6 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Api\Web;
|
namespace App\Http\Controllers\Api\Web;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use File;
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use Illuminate\Support\Facades\Request;
|
|
||||||
use App\Commands\DeleteTrackCommand;
|
use App\Commands\DeleteTrackCommand;
|
||||||
use App\Commands\EditTrackCommand;
|
use App\Commands\EditTrackCommand;
|
||||||
use App\Commands\GenerateTrackFilesCommand;
|
use App\Commands\GenerateTrackFilesCommand;
|
||||||
|
@ -33,9 +29,13 @@ use App\Jobs\EncodeTrackFile;
|
||||||
use App\Models\Genre;
|
use App\Models\Genre;
|
||||||
use App\Models\ResourceLogItem;
|
use App\Models\ResourceLogItem;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\TrackType;
|
|
||||||
use App\Models\TrackFile;
|
use App\Models\TrackFile;
|
||||||
|
use App\Models\TrackType;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
|
use File;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
use Response;
|
use Response;
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ class TracksController extends ApiControllerBase
|
||||||
|
|
||||||
$track->version_upload_status = Track::STATUS_PROCESSING;
|
$track->version_upload_status = Track::STATUS_PROCESSING;
|
||||||
$track->update();
|
$track->update();
|
||||||
|
|
||||||
return $this->execute(new UploadTrackCommand(true, false, null, false, $track->getNextVersion(), $track));
|
return $this->execute(new UploadTrackCommand(true, false, null, false, $track->getNextVersion(), $track));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ class TracksController extends ApiControllerBase
|
||||||
$versions[] = [
|
$versions[] = [
|
||||||
'version' => $trackFile->version,
|
'version' => $trackFile->version,
|
||||||
'url' => '/tracks/'.$track->id.'/version-change/'.$trackFile->version,
|
'url' => '/tracks/'.$track->id.'/version-change/'.$trackFile->version,
|
||||||
'created_at' => $trackFile->created_at->timestamp
|
'created_at' => $trackFile->created_at->timestamp,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +138,7 @@ class TracksController extends ApiControllerBase
|
||||||
$track->version_upload_status = Track::STATUS_PROCESSING;
|
$track->version_upload_status = Track::STATUS_PROCESSING;
|
||||||
$track->update();
|
$track->update();
|
||||||
$sourceFile = new UploadedFile($masterTrackFile->getFile(), $masterTrackFile->getFilename());
|
$sourceFile = new UploadedFile($masterTrackFile->getFile(), $masterTrackFile->getFilename());
|
||||||
|
|
||||||
return $this->execute(new GenerateTrackFilesCommand($track, $sourceFile, false, false, true, $newVersion));
|
return $this->execute(new GenerateTrackFilesCommand($track, $sourceFile, false, false, true, $newVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,21 +241,23 @@ class TracksController extends ApiControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response::json([
|
return Response::json([
|
||||||
"tracks" => $tracks,
|
'tracks' => $tracks,
|
||||||
"current_page" => $page,
|
'current_page' => $page,
|
||||||
"total_pages" => ceil($totalCount / $perPage)
|
'total_pages' => ceil($totalCount / $perPage),
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllTracks()
|
public function getAllTracks()
|
||||||
{
|
{
|
||||||
$this->authorize('access-admin-area');
|
$this->authorize('access-admin-area');
|
||||||
|
|
||||||
return $this->getIndex(true);
|
return $this->getIndex(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClassifierQueue()
|
public function getClassifierQueue()
|
||||||
{
|
{
|
||||||
$this->authorize('access-admin-area');
|
$this->authorize('access-admin-area');
|
||||||
|
|
||||||
return $this->getIndex(true, true);
|
return $this->getIndex(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,9 +359,10 @@ class TracksController extends ApiControllerBase
|
||||||
$archives = ['mlpma', 'ponify', 'eqbeats'];
|
$archives = ['mlpma', 'ponify', 'eqbeats'];
|
||||||
$akey = array_search($archive, $archives);
|
$akey = array_search($archive, $archives);
|
||||||
|
|
||||||
if (!$akey)
|
if (! $akey) {
|
||||||
$query->join($archive.'_tracks', 'tracks.id', '=', $archive.'tracks.track_id');
|
$query->join($archive.'_tracks', 'tracks.id', '=', $archive.'tracks.track_id');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Request::has('songs')) {
|
if (Request::has('songs')) {
|
||||||
// DISTINCT is needed here to avoid duplicate results
|
// DISTINCT is needed here to avoid duplicate results
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -42,7 +42,7 @@ abstract class ApiControllerBase extends Controller
|
||||||
if ($result->didFail()) {
|
if ($result->didFail()) {
|
||||||
return Response::json([
|
return Response::json([
|
||||||
'message' => 'Validation failed',
|
'message' => 'Validation failed',
|
||||||
'errors' => $result->getMessages()
|
'errors' => $result->getMessages(),
|
||||||
], $result->getStatusCode());
|
], $result->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -22,8 +22,8 @@ namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use View;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
use View;
|
||||||
|
|
||||||
class ArtistsController extends Controller
|
class ArtistsController extends Controller
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,18 +20,18 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Models\User;
|
||||||
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use DB;
|
||||||
use Illuminate\Support\Facades\Input;
|
use Illuminate\Support\Facades\Input;
|
||||||
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
||||||
use League\OAuth2\Client\Token\AccessToken;
|
use League\OAuth2\Client\Token\AccessToken;
|
||||||
use Log;
|
use Log;
|
||||||
use Poniverse\Lib\Client;
|
use Poniverse\Lib\Client;
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Models\User;
|
|
||||||
use Auth;
|
|
||||||
use DB;
|
|
||||||
use Request;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
use Request;
|
||||||
|
|
||||||
class AuthController extends Controller
|
class AuthController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,7 @@ class AuthController extends Controller
|
||||||
public function postLogout()
|
public function postLogout()
|
||||||
{
|
{
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
|
|
||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ class AuthController extends Controller
|
||||||
try {
|
try {
|
||||||
$accessToken = $oauthProvider->getAccessToken('authorization_code', [
|
$accessToken = $oauthProvider->getAccessToken('authorization_code', [
|
||||||
'code' => Request::query('code'),
|
'code' => Request::query('code'),
|
||||||
'redirect_uri' => action('AuthController@getOAuth')
|
'redirect_uri' => action('AuthController@getOAuth'),
|
||||||
]);
|
]);
|
||||||
$this->poniverse->setAccessToken($accessToken);
|
$this->poniverse->setAccessToken($accessToken);
|
||||||
$resourceOwner = $oauthProvider->getResourceOwner($accessToken);
|
$resourceOwner = $oauthProvider->getResourceOwner($accessToken);
|
||||||
|
@ -101,6 +102,7 @@ class AuthController extends Controller
|
||||||
if ($token) {
|
if ($token) {
|
||||||
//User already exists, update access token and refresh token if provided.
|
//User already exists, update access token and refresh token if provided.
|
||||||
DB::table('oauth2_tokens')->where('id', '=', $token->id)->update($setData);
|
DB::table('oauth2_tokens')->where('id', '=', $token->id)->update($setData);
|
||||||
|
|
||||||
return $this->loginRedirect(User::find($token->user_id));
|
return $this->loginRedirect(User::find($token->user_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +122,6 @@ class AuthController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->loginRedirect($user);
|
return $this->loginRedirect($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -22,8 +22,8 @@ namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
class Controller extends BaseController
|
class Controller extends BaseController
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App;
|
||||||
use App\Models\Image;
|
use App\Models\Image;
|
||||||
use Config;
|
use Config;
|
||||||
use App;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Feld0
|
* Copyright (C) 2016 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -21,19 +21,20 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Auth;
|
|
||||||
use DB;
|
|
||||||
use App\Models\Email;
|
use App\Models\Email;
|
||||||
use App\Models\EmailSubscription;
|
use App\Models\EmailSubscription;
|
||||||
|
use Auth;
|
||||||
|
use DB;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
class NotificationsController extends Controller
|
||||||
class NotificationsController extends Controller {
|
{
|
||||||
/**
|
/**
|
||||||
* @param $emailKey
|
* @param $emailKey
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
*/
|
*/
|
||||||
public function getEmailClick($emailKey) {
|
public function getEmailClick($emailKey)
|
||||||
|
{
|
||||||
/** @var Email $email */
|
/** @var Email $email */
|
||||||
$email = Email::findOrFail($emailKey);
|
$email = Email::findOrFail($emailKey);
|
||||||
|
|
||||||
|
@ -46,7 +47,8 @@ class NotificationsController extends Controller {
|
||||||
return redirect($email->getActivity()->url);
|
return redirect($email->getActivity()->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmailUnsubscribe($subscriptionKey) {
|
public function getEmailUnsubscribe($subscriptionKey)
|
||||||
|
{
|
||||||
/** @var EmailSubscription $subscription */
|
/** @var EmailSubscription $subscription */
|
||||||
$subscription = EmailSubscription::findOrFail($subscriptionKey);
|
$subscription = EmailSubscription::findOrFail($subscriptionKey);
|
||||||
$subscription->delete();
|
$subscription->delete();
|
||||||
|
@ -54,17 +56,18 @@ class NotificationsController extends Controller {
|
||||||
if (Auth::check() && $subscription->user->id === Auth::user()->id) {
|
if (Auth::check() && $subscription->user->id === Auth::user()->id) {
|
||||||
return redirect(route('account:settings', [
|
return redirect(route('account:settings', [
|
||||||
'slug' => $subscription->user->slug,
|
'slug' => $subscription->user->slug,
|
||||||
'unsubscribedMessageKey' => $subscription->activity_type
|
'unsubscribedMessageKey' => $subscription->activity_type,
|
||||||
]), 303);
|
]), 303);
|
||||||
} else {
|
} else {
|
||||||
return redirect(route('email:confirm-unsubscribed', [
|
return redirect(route('email:confirm-unsubscribed', [
|
||||||
'unsubscribedUser' => $subscription->user->display_name,
|
'unsubscribedUser' => $subscription->user->display_name,
|
||||||
'unsubscribedMessageKey' => $subscription->activity_type
|
'unsubscribedMessageKey' => $subscription->activity_type,
|
||||||
]), 303);
|
]), 303);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmailUnsubscribePage() {
|
public function getEmailUnsubscribePage()
|
||||||
|
{
|
||||||
return View::make('shared.null');
|
return View::make('shared.null');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2016 Logic
|
* Copyright (C) 2016 Logic.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App;
|
||||||
use App\Models\ResourceLogItem;
|
use App\Models\ResourceLogItem;
|
||||||
use App\Models\Track;
|
use App\Models\Track;
|
||||||
use App\Models\TrackFile;
|
use App\Models\TrackFile;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Config;
|
use Config;
|
||||||
use App;
|
use Illuminate\Http\Request;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Response;
|
use Response;
|
||||||
use View;
|
use View;
|
||||||
|
@ -58,9 +58,9 @@ class TracksController extends Controller
|
||||||
'stats' => [
|
'stats' => [
|
||||||
'views' => 0,
|
'views' => 0,
|
||||||
'plays' => 0,
|
'plays' => 0,
|
||||||
'downloads' => 0
|
'downloads' => 0,
|
||||||
],
|
],
|
||||||
'is_favourited' => false
|
'is_favourited' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($track->users->count()) {
|
if ($track->users->count()) {
|
||||||
|
@ -71,7 +71,7 @@ class TracksController extends Controller
|
||||||
'plays' => $userRow->play_count,
|
'plays' => $userRow->play_count,
|
||||||
'downloads' => $userRow->download_count,
|
'downloads' => $userRow->download_count,
|
||||||
],
|
],
|
||||||
'is_favourited' => $userRow->is_favourited
|
'is_favourited' => $userRow->is_favourited,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class TracksController extends Controller
|
||||||
'title' => $track->title,
|
'title' => $track->title,
|
||||||
'author_name' => $track->user->display_name,
|
'author_name' => $track->user->display_name,
|
||||||
'author_url' => $track->user->url,
|
'author_url' => $track->user->url,
|
||||||
'html' => '<iframe src="'.action('TracksController@getEmbed', ['id' => $track->id]).'" width="100%" height="150" allowTransparency="true" frameborder="0" seamless allowfullscreen></iframe>'
|
'html' => '<iframe src="'.action('TracksController@getEmbed', ['id' => $track->id]).'" width="100%" height="150" allowTransparency="true" frameborder="0" seamless allowfullscreen></iframe>',
|
||||||
];
|
];
|
||||||
|
|
||||||
return Response::json($output);
|
return Response::json($output);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -42,7 +42,7 @@ class Kernel extends HttpKernel
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
\App\Http\Middleware\DisabledAccountCheck::class,
|
\App\Http\Middleware\DisabledAccountCheck::class,
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -27,7 +28,6 @@ use Illuminate\Session\Store;
|
||||||
use League\OAuth2\Client\Token\AccessToken;
|
use League\OAuth2\Client\Token\AccessToken;
|
||||||
use Poniverse;
|
use Poniverse;
|
||||||
use Poniverse\Lib\Client;
|
use Poniverse\Lib\Client;
|
||||||
use App\Models\User;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
|
|
||||||
class AuthenticateOAuth
|
class AuthenticateOAuth
|
||||||
|
@ -92,7 +92,6 @@ class AuthenticateOAuth
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function determineAccessToken(Request $request, $headerOnly = true)
|
private function determineAccessToken(Request $request, $headerOnly = true)
|
||||||
{
|
{
|
||||||
$header = $request->header('Authorization');
|
$header = $request->header('Authorization');
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -43,8 +43,6 @@ class DisabledAccountCheck
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pony.fm - A community for pony fan music.
|
* Pony.fm - A community for pony fan music.
|
||||||
* Copyright (C) 2015 Feld0
|
* Copyright (C) 2015 Feld0.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -24,11 +24,7 @@ use Closure;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class JsonExceptions
|
* Class JsonExceptions.
|
||||||
* @package App\Http\Middleware
|
|
||||||
*
|
|
||||||
* This middleware turns any HTTP exceptions thrown during the request
|
|
||||||
* into a JSON response. To be used when implementing the API!
|
|
||||||
*/
|
*/
|
||||||
class JsonExceptions
|
class JsonExceptions
|
||||||
{
|
{
|
||||||
|
@ -45,7 +41,7 @@ class JsonExceptions
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
} catch (HttpException $e) {
|
} catch (HttpException $e) {
|
||||||
return \Response::json([
|
return \Response::json([
|
||||||
'message' => $e->getMessage()
|
'message' => $e->getMessage(),
|
||||||
], $e->getStatusCode());
|
], $e->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue