mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 13:07:59 +01:00
Fixes T224. Also adds the rebuild:tags Artisan command and a missing ffmpeg compilation flag.
This commit is contained in:
parent
6911b3e560
commit
5d9b3f2d5b
4 changed files with 84 additions and 7 deletions
76
app/commands/RebuildTags.php
Normal file
76
app/commands/RebuildTags.php
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Entities\Track;
|
||||
|
||||
class RebuildTags extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'rebuild:tags';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
array('trackId', InputArgument::OPTIONAL, 'ID of the track to rebuild tags for.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
|
@ -456,7 +456,7 @@
|
|||
}
|
||||
|
||||
if ($this->cover !== NULL) {
|
||||
$command .= '--artwork ' . $this->getCoverUrl() . ' ';
|
||||
$command .= '--artwork ' . $this->cover->getFile() . ' ';
|
||||
}
|
||||
|
||||
$command .= '--overWrite';
|
||||
|
@ -494,9 +494,9 @@
|
|||
$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] = [
|
||||
'data' => file_get_contents($this->cover->file),
|
||||
'data' => file_get_contents($this->cover->getFile()),
|
||||
'picturetypeid' => 2,
|
||||
'description' => 'cover',
|
||||
'mime' => 'image/png'
|
||||
|
@ -508,10 +508,10 @@
|
|||
|
||||
if ($tagWriter->WriteTags()) {
|
||||
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 {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,6 @@
|
|||
|
||||
Artisan::add(new MigrateOldData);
|
||||
Artisan::add(new RefreshCache);
|
||||
Artisan::add(new RebuildTags);
|
||||
Artisan::add(new ImportMLPMA);
|
||||
Artisan::add(new ClassifyMLPMA);
|
||||
|
|
|
@ -7,7 +7,7 @@ echo "Installing tagging tools..."
|
|||
sudo apt-get -qq install -y AtomicParsley flac vorbis-tools imagemagick
|
||||
|
||||
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
|
||||
|
@ -18,7 +18,7 @@ else
|
|||
wget "https://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2"
|
||||
tar -xjf "ffmpeg-2.6.3.tar.bz2"
|
||||
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
|
||||
sudo make install
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue