mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
rPF5d9b3f2d5bc8: Fixes T224. Also adds the rebuild:tags Artisan command and a missing ffmpeg…
This commit is contained in:
parent
92c2c43e58
commit
1fe6aa98b5
5 changed files with 62 additions and 8 deletions
|
@ -15,7 +15,7 @@ use Illuminate\Support\Str;
|
||||||
use Input;
|
use Input;
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
|
||||||
require_once(app_path() . '/Library/getid3/getid3/getid3.php');
|
//require_once(app_path() . '/Library/getid3/getid3/getid3.php');
|
||||||
|
|
||||||
class ImportMLPMA extends Command
|
class ImportMLPMA extends Command
|
||||||
{
|
{
|
||||||
|
|
53
app/Console/Commands/RebuildTags.php
Normal file
53
app/Console/Commands/RebuildTags.php
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Track;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class RebuildTags extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'rebuild:tags
|
||||||
|
{trackId? : ID of the track to rebuild tags for}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Rewrites tags in track files, ensuring they\'re up to date.';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
if ($this->argument('trackId')) {
|
||||||
|
$track = Track::findOrFail($this->argument('trackId'));
|
||||||
|
$tracks = [$track];
|
||||||
|
} else {
|
||||||
|
$tracks = Track::whereNotNull('published_at')->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($tracks as $track) {
|
||||||
|
$this->comment('Rewriting tags for track #'.$track->id.'...');
|
||||||
|
$track->updateTags();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
|
||||||
\App\Console\Commands\RefreshCache::class,
|
\App\Console\Commands\RefreshCache::class,
|
||||||
\App\Console\Commands\ImportMLPMA::class,
|
\App\Console\Commands\ImportMLPMA::class,
|
||||||
\App\Console\Commands\ClassifyMLPMA::class,
|
\App\Console\Commands\ClassifyMLPMA::class,
|
||||||
|
\App\Console\Commands\RebuildTags::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -570,7 +570,7 @@ class Track extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->cover !== null) {
|
if ($this->cover !== null) {
|
||||||
$command .= '--artwork ' . $this->getCoverUrl() . ' ';
|
$command .= '--artwork ' . $this->cover->getFile() . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$command .= '--overWrite';
|
$command .= '--overWrite';
|
||||||
|
@ -609,9 +609,9 @@ class Track extends Model
|
||||||
$tagWriter->tag_data['track'] = [$this->track_number];
|
$tagWriter->tag_data['track'] = [$this->track_number];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($format == 'MP3' && $this->cover_id != null && is_file($this->cover->file)) {
|
if ($format == 'MP3' && $this->cover_id != null && is_file($this->cover->getFile())) {
|
||||||
$tagWriter->tag_data['attached_picture'][0] = [
|
$tagWriter->tag_data['attached_picture'][0] = [
|
||||||
'data' => file_get_contents($this->cover->file),
|
'data' => file_get_contents($this->cover->getFile()),
|
||||||
'picturetypeid' => 2,
|
'picturetypeid' => 2,
|
||||||
'description' => 'cover',
|
'description' => 'cover',
|
||||||
'mime' => 'image/png'
|
'mime' => 'image/png'
|
||||||
|
@ -623,10 +623,10 @@ class Track extends Model
|
||||||
|
|
||||||
if ($tagWriter->WriteTags()) {
|
if ($tagWriter->WriteTags()) {
|
||||||
if (!empty($tagWriter->warnings)) {
|
if (!empty($tagWriter->warnings)) {
|
||||||
Log::warning('There were some warnings:<br />' . implode('<br /><br />', $tagWriter->warnings));
|
Log::warning('Track #'.$this->id.': There were some warnings:<br />' . implode('<br /><br />', $tagWriter->warnings));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log::error('Failed to write tags!<br />' . implode('<br /><br />', $tagWriter->errors));
|
Log::error('Track #' . $this->id . ': Failed to write tags!<br />' . implode('<br /><br />', $tagWriter->errors));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ echo "Installing tagging tools..."
|
||||||
sudo apt-get -qq install -y AtomicParsley flac vorbis-tools imagemagick
|
sudo apt-get -qq install -y AtomicParsley flac vorbis-tools imagemagick
|
||||||
|
|
||||||
echo "Installing ffmpeg dependencies.."
|
echo "Installing ffmpeg dependencies.."
|
||||||
sudo apt-get -qq install -y pkg-config yasm libfaac-dev libmp3lame-dev libvorbis-dev
|
sudo apt-get -qq install -y pkg-config yasm libfaac-dev libmp3lame-dev libvorbis-dev libtheora-dev
|
||||||
|
|
||||||
|
|
||||||
if type ffmpeg &>/dev/null; then
|
if type ffmpeg &>/dev/null; then
|
||||||
|
@ -18,7 +18,7 @@ else
|
||||||
wget "https://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2"
|
wget "https://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2"
|
||||||
tar -xjf "ffmpeg-2.6.3.tar.bz2"
|
tar -xjf "ffmpeg-2.6.3.tar.bz2"
|
||||||
cd "ffmpeg-2.6.3"
|
cd "ffmpeg-2.6.3"
|
||||||
./configure --enable-gpl --enable-encoder=flac --enable-encoder=alac --enable-libmp3lame --enable-libvorbis --enable-libfaac --enable-nonfree
|
./configure --enable-gpl --enable-encoder=flac --enable-encoder=alac --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libfaac --enable-nonfree
|
||||||
make -j4
|
make -j4
|
||||||
sudo make install
|
sudo make install
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue