Added ACX website connections
This commit is contained in:
@@ -41,6 +41,10 @@ public class AudiobookRecorder extends JFrame {
|
||||
|
||||
JMenuItem bookNewChapter;
|
||||
JMenuItem bookExportAudio;
|
||||
JMenu bookVisitACX;
|
||||
JMenuItem bookVisitTitle;
|
||||
JMenuItem bookVisitAudition;
|
||||
JMenuItem bookVisitProduce;
|
||||
|
||||
JMenuItem toolsMerge;
|
||||
JMenuItem toolsArchive;
|
||||
@@ -184,6 +188,33 @@ public class AudiobookRecorder extends JFrame {
|
||||
bookMenu.add(bookNewChapter);
|
||||
bookMenu.add(bookExportAudio);
|
||||
|
||||
bookVisitACX = new JMenu("Visit ACX");
|
||||
bookMenu.add(bookVisitACX);
|
||||
|
||||
bookVisitTitle = new JMenuItem("Title");
|
||||
bookVisitTitle.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Utils.browse("https://www.acx.com/titleview/" + book.getACX());
|
||||
}
|
||||
});
|
||||
bookVisitACX.add(bookVisitTitle);
|
||||
|
||||
bookVisitAudition = new JMenuItem("Audition");
|
||||
bookVisitAudition.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Utils.browse("https://www.acx.com/titleview/" + book.getACX() + "?bucket=AUDITION_READY");
|
||||
}
|
||||
});
|
||||
bookVisitACX.add(bookVisitAudition);
|
||||
|
||||
bookVisitProduce = new JMenuItem("Produce");
|
||||
bookVisitProduce.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Utils.browse("https://www.acx.com/titleview/" + book.getACX() + "?bucket=PRODUCE");
|
||||
}
|
||||
});
|
||||
bookVisitACX.add(bookVisitProduce);
|
||||
|
||||
menuBar.add(bookMenu);
|
||||
|
||||
toolsMenu = new JMenu("Tools");
|
||||
@@ -589,7 +620,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
}
|
||||
|
||||
public void createNewBook() {
|
||||
BookInfoPanel info = new BookInfoPanel("", "", "", "");
|
||||
BookInfoPanel info = new BookInfoPanel("", "", "", "", "");
|
||||
int r = JOptionPane.showConfirmDialog(this, info, "New Book", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (r != JOptionPane.OK_OPTION) return;
|
||||
|
||||
@@ -608,6 +639,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
prefs.setProperty("book.author", info.getAuthor());
|
||||
prefs.setProperty("book.genre", info.getGenre());
|
||||
prefs.setProperty("book.comment", info.getComment());
|
||||
prefs.setProperty("book.acx", info.getACX());
|
||||
prefs.setProperty("chapter.audition.name", "Audition");
|
||||
prefs.setProperty("chapter.audition.pre-gap", Options.get("catenation.pre-chapter"));
|
||||
prefs.setProperty("chapter.audition.post-gap", Options.get("catenation.post-chapter"));
|
||||
@@ -1282,6 +1314,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
prefs.setProperty("book.author", book.getAuthor());
|
||||
prefs.setProperty("book.genre", book.getGenre());
|
||||
prefs.setProperty("book.comment", book.getComment());
|
||||
prefs.setProperty("book.acx", book.getACX());
|
||||
|
||||
prefs.setProperty("audio.recording.samplerate", "" + book.getSampleRate());
|
||||
prefs.setProperty("audio.recording.resolution", "" + book.getResolution());
|
||||
@@ -1363,6 +1396,7 @@ public class AudiobookRecorder extends JFrame {
|
||||
book.setAuthor(prefs.getProperty("book.author"));
|
||||
book.setGenre(prefs.getProperty("book.genre"));
|
||||
book.setComment(prefs.getProperty("book.comment"));
|
||||
book.setACX(prefs.getProperty("book.acx"));
|
||||
|
||||
int sr = Utils.s2i(prefs.getProperty("audio.recording.samplerate"));
|
||||
if (sr == 0) {
|
||||
|
||||
@@ -17,6 +17,7 @@ public class Book extends DefaultMutableTreeNode {
|
||||
String author;
|
||||
String genre;
|
||||
String comment;
|
||||
String ACX;
|
||||
|
||||
int sampleRate;
|
||||
int channels;
|
||||
@@ -35,29 +36,15 @@ public class Book extends DefaultMutableTreeNode {
|
||||
AudiobookRecorder.window.setTitle("AudioBook Recorder :: " + name);
|
||||
}
|
||||
|
||||
public void setAuthor(String a) {
|
||||
author = a;
|
||||
}
|
||||
public void setAuthor(String a) { author = a; }
|
||||
public void setGenre(String g) { genre = g; }
|
||||
public void setComment(String c) { comment = c; }
|
||||
public void setACX(String c) { ACX = c; }
|
||||
|
||||
public void setGenre(String g) {
|
||||
genre = g;
|
||||
}
|
||||
|
||||
public void setComment(String c) {
|
||||
comment = c;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public String getGenre() {
|
||||
return genre;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
public String getAuthor() { return author; }
|
||||
public String getGenre() { return genre; }
|
||||
public String getComment() { return comment; }
|
||||
public String getACX() { return ACX; }
|
||||
|
||||
public Chapter getClosingCredits() {
|
||||
return getChapterById("close");
|
||||
|
||||
@@ -4,6 +4,7 @@ import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class BookInfoPanel extends JPanel {
|
||||
|
||||
@@ -11,8 +12,9 @@ public class BookInfoPanel extends JPanel {
|
||||
JTextField author;
|
||||
JTextField genre;
|
||||
JTextField comment;
|
||||
JTextField acx;
|
||||
|
||||
public BookInfoPanel(String t, String a, String g, String c) {
|
||||
public BookInfoPanel(String t, String a, String g, String c, String x) {
|
||||
super();
|
||||
setLayout(new GridBagLayout());
|
||||
GridBagConstraints con = new GridBagConstraints();
|
||||
@@ -56,37 +58,36 @@ public class BookInfoPanel extends JPanel {
|
||||
con.gridx = 0;
|
||||
con.gridy++;
|
||||
|
||||
add(new JLabel("AXC Code:"), con);
|
||||
con.gridx = 1;
|
||||
acx = new JTextField(x);
|
||||
acx.setPreferredSize(new Dimension(200, 20));
|
||||
add(acx, con);
|
||||
|
||||
con.gridx = 0;
|
||||
con.gridy++;
|
||||
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title.getText();
|
||||
public String getTitle() { return title.getText(); }
|
||||
public String getAuthor() { return author.getText(); }
|
||||
public String getGenre() { return genre.getText(); }
|
||||
public String getComment() { return comment.getText(); }
|
||||
|
||||
public String getACX() {
|
||||
Pattern p = Pattern.compile("\\/titleview\\/([A-Z0-9]{14})");
|
||||
Matcher m = p.matcher(acx.getText());
|
||||
if (m.find()) {
|
||||
System.err.println(m);
|
||||
return m.group(1);
|
||||
}
|
||||
return acx.getText();
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author.getText();
|
||||
}
|
||||
public void setTitle(String t) { title.setText(t); }
|
||||
public void setAuthor(String a) { author.setText(a); }
|
||||
public void setGenre(String g) { genre.setText(g); }
|
||||
public void setComment(String c) { comment.setText(c); }
|
||||
public void setACX(String a) { acx.setText(a); }
|
||||
|
||||
public String getGenre() {
|
||||
return genre.getText();
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment.getText();
|
||||
}
|
||||
|
||||
public void setTitle(String t) {
|
||||
title.setText(t);
|
||||
}
|
||||
|
||||
public void setAuthor(String a) {
|
||||
author.setText(a);
|
||||
}
|
||||
|
||||
public void setGenre(String g) {
|
||||
genre.setText(g);
|
||||
}
|
||||
|
||||
public void setComment(String c) {
|
||||
comment.setText(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,12 +40,7 @@ public class DonationPanel extends JPanel {
|
||||
JButton donate = new JButton("Donate!");
|
||||
donate.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI("https://paypal.me/majenko"));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
Utils.browse("https://paypal.me/majenko");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.awt.image.*;
|
||||
import javax.swing.border.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
public class Utils {
|
||||
public static Image getScaledImage(Image srcImg, int w, int h){
|
||||
@@ -46,4 +47,12 @@ public class Utils {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public static void browse(String url) {
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user