diff --git a/app/Models/File.php b/app/Models/File.php index ff5d7717..d9bcdfb5 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -136,6 +136,7 @@ class File 'title' => basename($this->path, '.'.pathinfo($this->path, PATHINFO_EXTENSION)), // default to be file name 'length' => $info['playtime_seconds'], 'track' => (int) $track, + 'disc' => (int) array_get($info, 'comments.part_of_a_set.0', 1), 'lyrics' => '', 'cover' => array_get($info, 'comments.picture', [null])[0], 'path' => $this->path, diff --git a/app/Models/Song.php b/app/Models/Song.php index a1477d43..e8868d46 100644 --- a/app/Models/Song.php +++ b/app/Models/Song.php @@ -24,6 +24,7 @@ use YouTube; * @property float length * @property string lyrics * @property int track + * @property int disc * @property int album_id * @property int id * @property int artist_id @@ -50,6 +51,7 @@ class Song extends Model 'length' => 'float', 'mtime' => 'int', 'track' => 'int', + 'disc' => 'int', ]; /** diff --git a/app/Services/Media.php b/app/Services/Media.php index 123ce7b2..c1a025c9 100644 --- a/app/Services/Media.php +++ b/app/Services/Media.php @@ -28,6 +28,7 @@ class Media 'title', 'length', 'track', + 'disc', 'lyrics', 'cover', 'mtime', diff --git a/database/migrations/2017_11_27_184010_add_disc_into_songs.php b/database/migrations/2017_11_27_184010_add_disc_into_songs.php new file mode 100644 index 00000000..166e51a7 --- /dev/null +++ b/database/migrations/2017_11_27_184010_add_disc_into_songs.php @@ -0,0 +1,32 @@ +integer('disc')->after('track')->default(1); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('songs', function (Blueprint $table) { + $table->dropColumn('disc'); + }); + } +} diff --git a/resources/assets/js/components/shared/album-item.vue b/resources/assets/js/components/shared/album-item.vue index 70bac264..3f1dba6a 100644 --- a/resources/assets/js/components/shared/album-item.vue +++ b/resources/assets/js/components/shared/album-item.vue @@ -36,6 +36,7 @@