From 3d65a47781db1bbec17b4b268c59a58a1f4c04b7 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Mon, 21 Mar 2016 01:12:38 -0500 Subject: [PATCH] Allow disc_number to be a string (1/2, 2/2, for example). --- core/src/main/groovy/com/jdbernard/wdiwtlt/MediaLibrary.groovy | 2 +- .../main/java/com/jdbernard/wdiwtlt/db/models/MediaFile.java | 2 +- .../main/sql/migrations/20151209054632-initial-schema-up.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/groovy/com/jdbernard/wdiwtlt/MediaLibrary.groovy b/core/src/main/groovy/com/jdbernard/wdiwtlt/MediaLibrary.groovy index 599d4b5..99cd9e1 100644 --- a/core/src/main/groovy/com/jdbernard/wdiwtlt/MediaLibrary.groovy +++ b/core/src/main/groovy/com/jdbernard/wdiwtlt/MediaLibrary.groovy @@ -106,7 +106,7 @@ public class MediaLibrary { mf.name = fileTag?.getFirst(TITLE)?.trim() ?: f.name mf.comment = fileTag?.getAll(COMMENT)?.collect { it.trim() }?.join('\n\n') - mf.discNumber = safeToInteger(fileTag?.getFirst(DISC_NO)) ?: 1 + mf.discNumber = fileTag?.getFirst(DISC_NO) ?: '1' mf.trackNumber = safeToInteger(fileTag?.getFirst(TRACK)) def folderParts = mf.filePath.split("[\\\\/]")[1..<-1] as LinkedList diff --git a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/MediaFile.java b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/MediaFile.java index 4b668f0..5212133 100644 --- a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/MediaFile.java +++ b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/MediaFile.java @@ -8,7 +8,7 @@ public class MediaFile extends Model { public static final String FILE_LOCATION = "file location"; public String name; - public Integer discNumber; + public String discNumber; public Integer trackNumber; public int playCount = 0; public String filePath; diff --git a/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql b/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql index 3611956..da3390f 100644 --- a/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql +++ b/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql @@ -17,7 +17,7 @@ CREATE INDEX albums_name_idx ON albums(name); CREATE TABLE media_files ( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, - disc_number INTEGER NOT NULL DEFAULT 1, + disc_number VARCHAR NOT NULL DEFAULT '1', track_number INTEGER, play_count INTEGER NOT NULL DEFAULT 0, file_path VARCHAR NOT NULL,