From 85586c17de1d262e01437454919457b6f48660e3 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Thu, 10 Sep 2015 11:27:04 +0100 Subject: [PATCH] Merge rPFfe22c9547edf: Fixed broken Year and Genre tags in tracks. --- app/Track.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Track.php b/app/Track.php index 2cc94a5a..71e0fee6 100644 --- a/app/Track.php +++ b/app/Track.php @@ -375,7 +375,7 @@ class Track extends Model return $this->hasMany('App\TrackFile'); } - public function getYear() + public function getYearAttribute() { return date('Y', strtotime($this->release_date)); } @@ -423,14 +423,14 @@ class Track extends Model return $this->user->display_name; } - public function getReleaseDate() + public function getReleaseDateAttribute() { if ($this->attributes['released_at'] !== null) { return $this->attributes['released_at']; } 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, ''); @@ -550,7 +550,7 @@ class Track extends Model $command .= '--title ' . escapeshellarg($this->title) . ' '; $command .= '--artist ' . escapeshellarg($this->user->display_name) . ' '; $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 .= '--comment "' . 'Downloaded from: https://pony.fm/' . '" '; $command .= '--encodingTool "' . 'Pony.fm' . '" '; @@ -585,7 +585,7 @@ class Track extends Model 'title' => [$this->title], 'artist' => [$this->user->display_name], 'year' => ['' . $this->year], - 'genre' => [$this->genre != null ? $this->genre->title : ''], + 'genre' => [$this->genre != null ? $this->genre->name : ''], 'comment' => ['Downloaded from: https://pony.fm/'], 'copyright' => ['© ' . $this->year . ' ' . $this->user->display_name], 'publisher' => ['Pony.fm - https://pony.fm/'],