Skip to content

Commit

Permalink
Issue #7 - version handling
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleDee73 committed Dec 10, 2023
1 parent 4b55d17 commit 8f6f4f6
Show file tree
Hide file tree
Showing 22 changed files with 831 additions and 185 deletions.
2 changes: 2 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions launch4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>.\target\Yass-Reloaded-2023.11-jar-with-dependencies.jar</jar>
<jar>.\target\Yass-Reloaded-2023.12-jar-with-dependencies.jar</jar>
<outfile>.\target\yass.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
Expand All @@ -27,12 +27,12 @@
<timeoutErr>true</timeoutErr>
</splash>
<versionInfo>
<fileVersion>2.5.2.0</fileVersion>
<txtFileVersion>Yass Reloaded 2023.11</txtFileVersion>
<fileVersion>2.5.3.0</fileVersion>
<txtFileVersion>Yass Reloaded 2023.12</txtFileVersion>
<fileDescription>Yass Reloaded - Karaoke Editor</fileDescription>
<copyright>(C)2023 DoubleDee</copyright>
<productVersion>2.5.2.0</productVersion>
<txtProductVersion>2023.11</txtProductVersion>
<productVersion>2.5.3.0</productVersion>
<txtProductVersion>2023.12</txtProductVersion>
<productName>Yass Reloaded</productName>
<companyName>yass-reloaded.com</companyName>
<internalName>yass</internalName>
Expand Down
2 changes: 1 addition & 1 deletion nsis-installer.nsi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name "Yass"

OutFile ".\target\yass-installer-2023.11.exe"
OutFile ".\target\yass-installer-2023.12.exe"

Unicode true
SetCompressor lzma
Expand Down
7 changes: 1 addition & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>yass</groupId>
<artifactId>Yass-Reloaded</artifactId>
<version>2023.11</version>
<version>2023.12</version>
<dependencies>
<dependency>
<groupId>com.danielreese</groupId>
Expand Down Expand Up @@ -186,11 +186,6 @@
<version>21.0.1</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>uk.co.caprica</groupId>
<artifactId>vlcj</artifactId>
<version>4.8.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
147 changes: 147 additions & 0 deletions src/yass/UltrastarHeaderTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* Yass Reloaded - Karaoke Editor
* Copyright (C) 2009-2023 Saruta
* Copyright (C) 2023 DoubleDee
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package yass;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import static yass.UltrastarHeaderTagVersion.*;

public enum UltrastarHeaderTag {
VERSION(0),
ARTIST(4),
TITLE(5),
EDITION(6, OLDY),
GENRE(7, OLDY),
LANGUAGE(8, OLDY),
YEAR(9, OLDY),
MP3(10),
COVER(11, OLDY),
BACKGROUND(12, OLDY),
VIDEO(13, OLDY),
VIDEOGAP(14, OLDY),
START(15, OLDY),
END(16, OLDY),
RELATIVE(17, OLDY, CLASSY, UNITY),
BPM(18),
GAP(19, OLDY),
ALBUM(23, OLDY, CLASSY, UNITY),
LENGTH(24, OLDY, CLASSY, UNITY),
ID(25, OLDY, CLASSY, UNITY),
PREVIEWSTART(27, OLDY),
MEDLEYSTARTBEAT(28, OLDY),
MEDLEYENDBEAT(29, OLDY),
ENCODING(30, OLDY, CLASSY, UNITY),
CREATOR(31, OLDY),
CALCMEDLEY(32, OLDY),
P1(33, OLDY),
P2(34, OLDY),
DUETSINGERP1(35, OLDY, CLASSY, UNITY, P1),
DUETSINGERP2(36, OLDY, CLASSY, UNITY, P2),
COMMENT(37, OLDY),
RESOLUTION(38, OLDY, CLASSY, UNITY),
NOTESGAP(39, OLDY, CLASSY, UNITY),
AUTHOR(40, OLDY, CLASSY, UNITY, CREATOR);

final int index;
final boolean mandatory;
final UltrastarHeaderTagVersion added;
final UltrastarHeaderTagVersion deprecation;
final UltrastarHeaderTagVersion deleted;
final UltrastarHeaderTag replacedBy;

UltrastarHeaderTag(int index) {
this.index = index;
this.added = OLDY;
this.mandatory = true;
this.deprecation = null;
this.deleted = null;
this.replacedBy = null;
}
UltrastarHeaderTag(int index, UltrastarHeaderTagVersion added) {
this.index = index;
this.added = added;
this.deprecation = null;
this.deleted = null;
this.replacedBy = null;
this.mandatory = false;
}

UltrastarHeaderTag(int index,
UltrastarHeaderTagVersion added,
UltrastarHeaderTagVersion deprecation,
UltrastarHeaderTagVersion deleted) {
this.index = index;
this.added = added;
this.deprecation = deprecation;
this.deleted = deleted;
this.replacedBy = null;
this.mandatory = false;
}

UltrastarHeaderTag(int index,
UltrastarHeaderTagVersion added,
UltrastarHeaderTagVersion deprecation,
UltrastarHeaderTagVersion deleted,
UltrastarHeaderTag replacedBy) {
this.index = index;
this.added = added;
this.deprecation = deprecation;
this.deleted = deleted;
this.replacedBy = replacedBy;
this.mandatory = false;
}

public String getTagName() {
return this + ":";
}

public static UltrastarHeaderTag getTag(String tagname) {
for (UltrastarHeaderTag tag : values()) {
if (tag.getTagName().equals(tagname)) {
return tag;
}
}
return null;
}
public static UltrastarHeaderTag getDeprecation(String tagname, UltrastarHeaderTagVersion version) {
UltrastarHeaderTag tag = getTag(tagname);
if (tag != null && tag.getTagName().equals(tagname)) {
if (tag.deprecation == null) {
return tag;
}
if (version.getNumericVersion() >= tag.deprecation.getNumericVersion()) {
return tag.replacedBy;
} else {
return tag;
}
}
return null;
}

public static List<String> deprecatedTags(UltrastarHeaderTagVersion version) {
return Arrays.stream(values())
.filter(tag -> tag.deprecation != null)
.filter(tag -> tag.deprecation.getNumericVersion() <= version.numericVersion)
.map(Enum::toString)
.collect(Collectors.toList());
}
}
65 changes: 65 additions & 0 deletions src/yass/UltrastarHeaderTagVersion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Yass Reloaded - Karaoke Editor
* Copyright (C) 2009-2023 Saruta
* Copyright (C) 2023 DoubleDee
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package yass;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum UltrastarHeaderTagVersion implements YassEnum {
CLASSY("0.2.0", 0.2d),
OLDY("0.3.0", 0.3d),
UNITY("1.0.0", 1d);
final String version;
final double numericVersion;

UltrastarHeaderTagVersion(String version, double numericVersion) {
this.version = version;
this.numericVersion = numericVersion;
}

@Override
public String getValue() {
return version;
}

@Override
public List<YassEnum> listElements() {
return Arrays.stream(values()).collect(Collectors.toList());
}

@Override
public String getLabel() {
return this + " (" + version + ")";
}

public double getNumericVersion() {
return numericVersion;
}

public static UltrastarHeaderTagVersion getFormatVersion(String version) {
for (UltrastarHeaderTagVersion tagVersion : values()) {
if (tagVersion.version.equals(version)) {
return tagVersion;
}
}
return UltrastarHeaderTagVersion.UNITY;
}
}
Loading

0 comments on commit 8f6f4f6

Please sign in to comment.