implement fscript into suggs
This commit is contained in:
parent
3c6b3e84ba
commit
c24da0edfd
|
@ -27,8 +27,10 @@ import java.awt.event.ActionListener;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
@ -156,7 +158,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
AudioTrack at = tracklist.get(curIndex);
|
AudioTrack at = tracklist.get(curIndex);
|
||||||
fTitle.setText(at.title);
|
fTitle.setText(at.title);
|
||||||
fArtist.setText(at.artist);
|
fArtist.setText(at.artist);
|
||||||
dTrackNo.setText(String.format("MT_%02d", curIndex));
|
dTrackNo.setText(String.format("MT_%02d", curIndex+1));
|
||||||
dFileSize.setText((at.size / 1000) + "kb");
|
dFileSize.setText((at.size / 1000) + "kb");
|
||||||
} else {
|
} else {
|
||||||
fTitle.setText("");
|
fTitle.setText("");
|
||||||
|
@ -285,17 +287,21 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
progressDialog.setProgressMax(progressSize);
|
progressDialog.setProgressMax(progressSize);
|
||||||
progressDialog.setProgressValue(0);
|
progressDialog.setProgressValue(0);
|
||||||
|
|
||||||
|
try {
|
||||||
new File(Main.inpath + "temp/data/audio/music").mkdirs();
|
new File(Main.inpath + "temp/data/audio/music").mkdirs();
|
||||||
|
FileOutputStream fos = new FileOutputStream(new File(Main.inpath + "temp/fscript"));
|
||||||
|
PrintStream ps = new PrintStream(fos);
|
||||||
|
ps.println("fscript 1");
|
||||||
|
ps.println("# AUTOGENERATED BY FIRESTAR");
|
||||||
for (int i = 0; i < tracklist.size(); i++) {
|
for (int i = 0; i < tracklist.size(); i++) {
|
||||||
AudioTrack at = tracklist.get(i);
|
AudioTrack at = tracklist.get(i);
|
||||||
String trackno = String.format("%02d", i);
|
String trackno = String.format("%02d", i+1);
|
||||||
new File(Main.inpath + "temp/data/audio/music/" + trackno).mkdirs();
|
new File(Main.inpath + "temp/data/audio/music/" + trackno).mkdirs();
|
||||||
if (at.path.getName().endsWith(".at9")) {
|
if (at.path.getName().endsWith(".at9")) {
|
||||||
progressDialog.setText("Copying track " + (i+1) + " out of " + tracklist.size() + "...");
|
progressDialog.setText("Copying track " + (i+1) + " out of " + tracklist.size() + "...");
|
||||||
try {
|
try {
|
||||||
// Assume whoever made the AT9s knows what they're doing
|
// Assume whoever made the AT9s knows what they're doing
|
||||||
System.out.println("Copying track #" + (i+1) + " \"" + at.title + " - " + at.artist + "\"...");
|
System.out.println("Copying track #" + (i+1) + " \"" + at.artist + " - " + at.title + "\"...");
|
||||||
Files.copy(at.path.toPath(), Paths.get(Main.inpath + "tmp/data/audio/music/" + trackno + "/music_stereo.at9"), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(at.path.toPath(), Paths.get(Main.inpath + "tmp/data/audio/music/" + trackno + "/music_stereo.at9"), StandardCopyOption.REPLACE_EXISTING);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
@ -303,15 +309,22 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
} else {
|
} else {
|
||||||
progressDialog.setText("Encoding track " + (i+1) + " out of " + tracklist.size() + "...");
|
progressDialog.setText("Encoding track " + (i+1) + " out of " + tracklist.size() + "...");
|
||||||
try {
|
try {
|
||||||
System.out.println("Encoding track #" + (i+1) + " \"" + at.title + " - " + at.artist + "\"...");
|
System.out.println("Encoding track #" + (i+1) + " \"" + at.artist + " - " + at.title + "\"...");
|
||||||
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", at.path.getPath(), "data/audio/music/" + trackno + "/music_stereo.at9"}, Main.inpath + "temp/");
|
Process p = Main.exec(new String[]{Main.inpath + "at9tool.exe", "-e", "-br", "144", at.path.getPath(), "data/audio/music/" + trackno + "/music_stereo.at9"}, Main.inpath + "temp/");
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
} catch (IOException | InterruptedException ex) {
|
} catch (IOException | InterruptedException ex) {
|
||||||
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String ocmd = "modify";
|
||||||
|
if (i >= 12) ocmd = "create";
|
||||||
|
ps.println("file \"data/plugins/languages/american/entries.xml\" xml "+ocmd+" StringTable.entry#MT_"+trackno+" set attribute \"string\" \""+at.artist.replace("\"", "\\\"")+"\\n"+at.title.replace("\"", "\\\"")+"\"");
|
||||||
|
ps.println("file \"data/audio/music/"+trackno+"/music_stereo.fft\" delete");
|
||||||
progressDialog.setProgressValue(i+1);
|
progressDialog.setProgressValue(i+1);
|
||||||
}
|
}
|
||||||
|
for (int s = tracklist.size(); s < 12; s++) {
|
||||||
|
ps.println("file \"data/audio/music/"+String.format("%02d", s+1)+"/music_stereo.fft\" delete");
|
||||||
|
}
|
||||||
if (sptrack != null) {
|
if (sptrack != null) {
|
||||||
progressDialog.setText("Encoding singleplayer frontend track...");
|
progressDialog.setText("Encoding singleplayer frontend track...");
|
||||||
if (sptrack.exists()) {
|
if (sptrack.exists()) {
|
||||||
|
@ -324,6 +337,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ps.println("file \"data/audio/music/FEMusic/frontend_stereo.fft\" delete");
|
||||||
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
||||||
}
|
}
|
||||||
if (mptrack != null) {
|
if (mptrack != null) {
|
||||||
|
@ -337,6 +351,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
} catch (IOException | InterruptedException ex) {
|
} catch (IOException | InterruptedException ex) {
|
||||||
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
ps.println("file \"data/audio/music/FEDemoMusic/frontend_stereo.fft\" delete");
|
||||||
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
||||||
}
|
}
|
||||||
System.out.println("Finished encoding.");
|
System.out.println("Finished encoding.");
|
||||||
|
@ -351,7 +366,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
docScreen.setAttribute("name", "Top");
|
docScreen.setAttribute("name", "Top");
|
||||||
for (int i = 0; i < tracklist.size(); i++) { // TODO: support for additive
|
for (int i = 0; i < tracklist.size(); i++) { // TODO: support for additive
|
||||||
AudioTrack at = tracklist.get(i);
|
AudioTrack at = tracklist.get(i);
|
||||||
String trackno = String.format("%02d", i);
|
String trackno = String.format("%02d", i+1);
|
||||||
|
|
||||||
Element trackElem = defDoc.createElement("PI_Music");
|
Element trackElem = defDoc.createElement("PI_Music");
|
||||||
trackElem.setAttribute("name", trackno);
|
trackElem.setAttribute("name", trackno);
|
||||||
|
@ -386,9 +401,15 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
}
|
}
|
||||||
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
||||||
|
|
||||||
progressDialog.setText("Localizing...");
|
progressDialog.setText("Finalizing script...");
|
||||||
System.out.println("Creating localization edits for music tracks...");
|
System.out.println("Finalizing Fscript...");
|
||||||
// TODO: Actually do what the above print-out says
|
ps.println("# END FIRESTAR AUTOGENERATION");
|
||||||
|
ps.close();
|
||||||
|
fos.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(Suggs.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
progressDialog.setProgressValue(progressDialog.getProgressValue()+1);
|
||||||
|
|
||||||
progressDialog.destroyDialog();
|
progressDialog.destroyDialog();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user