Skip to content

Commit

Permalink
Refactoring. Use english variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
ullenius committed Aug 15, 2023
1 parent be700f4 commit fb6e1d2
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/main/java/se/anosh/spctag/dao/Xid6Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@

final class Xid6Reader {

private static final Map<Byte, Id> mappningar = new HashMap<>();
private static final Map<Byte, Id> mappings = new HashMap<>();
private static final long XID6_OFFSET = 0x10200L;

private static final int XID6_HEADER_SIZE = 8;

static {
mappningar.put((byte) 0x01, new Id(Xid6Tag.SONG, Type.TEXT));
mappningar.put((byte) 0x02, new Id(Xid6Tag.GAME, Type.TEXT));
mappningar.put((byte) 0x03, new Id(Xid6Tag.ARTIST, Type.TEXT));
mappningar.put((byte) 0x04, new Id(Xid6Tag.DUMPER, Type.TEXT));
mappningar.put((byte) 0x06, new Id(Xid6Tag.EMULATOR, Type.DATA));
mappningar.put((byte) 0x07, new Id(Xid6Tag.COMMENTS, Type.TEXT));
mappningar.put((byte) 0x10, new Id(Xid6Tag.OST_TITLE, Type.TEXT));
mappningar.put((byte) 0x11, new Id(Xid6Tag.OST_DISC, Type.DATA));
mappningar.put((byte) 0x12, new Id(Xid6Tag.OST_TRACK, Type.OST));
mappningar.put((byte) 0x13, new Id(Xid6Tag.PUBLISHER, Type.TEXT));
mappningar.put((byte) 0x14, new Id(Xid6Tag.COPYRIGHT_YEAR, Type.YEAR));
mappings.put((byte) 0x01, new Id(Xid6Tag.SONG, Type.TEXT));
mappings.put((byte) 0x02, new Id(Xid6Tag.GAME, Type.TEXT));
mappings.put((byte) 0x03, new Id(Xid6Tag.ARTIST, Type.TEXT));
mappings.put((byte) 0x04, new Id(Xid6Tag.DUMPER, Type.TEXT));
mappings.put((byte) 0x06, new Id(Xid6Tag.EMULATOR, Type.DATA));
mappings.put((byte) 0x07, new Id(Xid6Tag.COMMENTS, Type.TEXT));
mappings.put((byte) 0x10, new Id(Xid6Tag.OST_TITLE, Type.TEXT));
mappings.put((byte) 0x11, new Id(Xid6Tag.OST_DISC, Type.DATA));
mappings.put((byte) 0x12, new Id(Xid6Tag.OST_TRACK, Type.OST));
mappings.put((byte) 0x13, new Id(Xid6Tag.PUBLISHER, Type.TEXT));
mappings.put((byte) 0x14, new Id(Xid6Tag.COPYRIGHT_YEAR, Type.YEAR));
// song info stuff
mappningar.put((byte) 0x30, new Id(Xid6Tag.INTRO, Type.INTRO));
mappningar.put((byte) 0x31, new Id(Xid6Tag.LOOP_LENGTH, Type.NUMBER));
mappningar.put((byte) 0x32, new Id(Xid6Tag.END, Type.NUMBER));
mappningar.put((byte) 0x33, new Id(Xid6Tag.FADE, Type.NUMBER));
mappningar.put((byte) 0x34, new Id(Xid6Tag.MUTED, Type.MUTED));
mappningar.put((byte) 0x35, new Id(Xid6Tag.LOOP_TIMES, Type.DATA));
mappningar.put((byte) 0x36, new Id(Xid6Tag.MIXING, Type.NUMBER));
mappings.put((byte) 0x30, new Id(Xid6Tag.INTRO, Type.INTRO));
mappings.put((byte) 0x31, new Id(Xid6Tag.LOOP_LENGTH, Type.NUMBER));
mappings.put((byte) 0x32, new Id(Xid6Tag.END, Type.NUMBER));
mappings.put((byte) 0x33, new Id(Xid6Tag.FADE, Type.NUMBER));
mappings.put((byte) 0x34, new Id(Xid6Tag.MUTED, Type.MUTED));
mappings.put((byte) 0x35, new Id(Xid6Tag.LOOP_TIMES, Type.DATA));
mappings.put((byte) 0x36, new Id(Xid6Tag.MIXING, Type.NUMBER));
}

private Xid6 xid6 = null;
Expand Down Expand Up @@ -138,10 +138,10 @@ private void parseXid6(Path spc) throws IOException {
Logger.debug("Current pos: {}", subChunks.position());

final byte id = subChunks.get();
if (!mappningar.containsKey(id)) {
if (!mappings.containsKey(id)) {
break;
}
final Id mappatId = mappningar.get(id);
final Id mappatId = mappings.get(id);
final Type type = mappatId.type;
final boolean dataStoredInHeader = subChunks.get() == 0 || type == Type.DATA; // workaround for broken type byte, always read from header

Expand Down Expand Up @@ -173,7 +173,7 @@ private void parseXid6(Path spc) throws IOException {
final int oldPos = subChunks.position();
final byte peek = subChunks.get(oldPos + peekPos);
Logger.debug("Peek byte: {}", peek);
if (mappningar.containsKey(peek)) {
if (mappings.containsKey(peek)) {
size--;
}
}
Expand Down

0 comments on commit fb6e1d2

Please sign in to comment.