Merge rPFfe22c9547edf: Fixed broken Year and Genre tags in tracks.

This commit is contained in:
Kelvin Zhang 2015-09-10 11:27:04 +01:00
parent 8de0cb1932
commit 85586c17de

View file

@ -375,7 +375,7 @@ class Track extends Model
return $this->hasMany('App\TrackFile'); return $this->hasMany('App\TrackFile');
} }
public function getYear() public function getYearAttribute()
{ {
return date('Y', strtotime($this->release_date)); return date('Y', strtotime($this->release_date));
} }
@ -423,14 +423,14 @@ class Track extends Model
return $this->user->display_name; return $this->user->display_name;
} }
public function getReleaseDate() public function getReleaseDateAttribute()
{ {
if ($this->attributes['released_at'] !== null) { if ($this->attributes['released_at'] !== null) {
return $this->attributes['released_at']; return $this->attributes['released_at'];
} }
if ($this->attributes['published_at'] !== null) { if ($this->attributes['published_at'] !== null) {
return Str::limit($this->$this->attributes['published_at'], 10, ''); return Str::limit($this->attributes['published_at'], 10, '');
} }
return Str::limit($this->attributes['created_at'], 10, ''); return Str::limit($this->attributes['created_at'], 10, '');
@ -550,7 +550,7 @@ class Track extends Model
$command .= '--title ' . escapeshellarg($this->title) . ' '; $command .= '--title ' . escapeshellarg($this->title) . ' ';
$command .= '--artist ' . escapeshellarg($this->user->display_name) . ' '; $command .= '--artist ' . escapeshellarg($this->user->display_name) . ' ';
$command .= '--year "' . $this->year . '" '; $command .= '--year "' . $this->year . '" ';
$command .= '--genre ' . escapeshellarg($this->genre != null ? $this->genre->title : '') . ' '; $command .= '--genre ' . escapeshellarg($this->genre != null ? $this->genre->name : '') . ' ';
$command .= '--copyright ' . escapeshellarg('© ' . $this->year . ' ' . $this->user->display_name) . ' '; $command .= '--copyright ' . escapeshellarg('© ' . $this->year . ' ' . $this->user->display_name) . ' ';
$command .= '--comment "' . 'Downloaded from: https://pony.fm/' . '" '; $command .= '--comment "' . 'Downloaded from: https://pony.fm/' . '" ';
$command .= '--encodingTool "' . 'Pony.fm' . '" '; $command .= '--encodingTool "' . 'Pony.fm' . '" ';
@ -585,7 +585,7 @@ class Track extends Model
'title' => [$this->title], 'title' => [$this->title],
'artist' => [$this->user->display_name], 'artist' => [$this->user->display_name],
'year' => ['' . $this->year], 'year' => ['' . $this->year],
'genre' => [$this->genre != null ? $this->genre->title : ''], 'genre' => [$this->genre != null ? $this->genre->name : ''],
'comment' => ['Downloaded from: https://pony.fm/'], 'comment' => ['Downloaded from: https://pony.fm/'],
'copyright' => ['© ' . $this->year . ' ' . $this->user->display_name], 'copyright' => ['© ' . $this->year . ' ' . $this->user->display_name],
'publisher' => ['Pony.fm - https://pony.fm/'], 'publisher' => ['Pony.fm - https://pony.fm/'],