-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/audio tag unsupported in format 1.0.0 (#60)
* Refactor logic checking if tag is supported * Use AUDIO tag only if supported by format version
- Loading branch information
Showing
6 changed files
with
79 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/com/github/nianna/karedi/song/tag/FormatSpecificationSupportedTags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.github.nianna.karedi.song.tag; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Stream; | ||
|
||
class FormatSpecificationSupportedTags { | ||
|
||
private static final List<TagKey> V_1_0_0_SUPPORTED_KEYS = List.of( | ||
TagKey.VERSION, | ||
TagKey.TITLE, | ||
TagKey.ARTIST, | ||
TagKey.MP3, | ||
TagKey.BPM, | ||
TagKey.GAP, | ||
TagKey.COVER, | ||
TagKey.BACKGROUND, | ||
TagKey.VIDEO, | ||
TagKey.VIDEOGAP, | ||
TagKey.GENRE, | ||
TagKey.EDITION, | ||
TagKey.CREATOR, | ||
TagKey.LANGUAGE, | ||
TagKey.YEAR, | ||
TagKey.START, | ||
TagKey.END, | ||
TagKey.PREVIEWSTART, | ||
TagKey.MEDLEYSTARTBEAT, | ||
TagKey.MEDLEYENDBEAT, | ||
TagKey.CALCMEDLEY, | ||
TagKey.P1, | ||
TagKey.P2, | ||
TagKey.COMMENT | ||
); | ||
|
||
private static final List<TagKey> V_1_1_0_SUPPORTED_KEYS = Stream.concat( | ||
V_1_0_0_SUPPORTED_KEYS.stream(), | ||
Stream.of(TagKey.AUDIO, TagKey.VOCALS, TagKey.INSTRUMENTAL, TagKey.TAGS, TagKey.PROVIDEDBY) | ||
).toList(); | ||
|
||
private static final Map<FormatSpecification, List<TagKey>> SUPPORTED_KEYS = Map.of( | ||
FormatSpecification.V_1_0_0, V_1_0_0_SUPPORTED_KEYS, | ||
FormatSpecification.V_1_1_0, V_1_1_0_SUPPORTED_KEYS | ||
); | ||
|
||
private FormatSpecificationSupportedTags() { | ||
|
||
} | ||
|
||
static boolean isSupported(FormatSpecification formatSpecification, TagKey tagKey) { | ||
return SUPPORTED_KEYS.get(formatSpecification).contains(tagKey); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters