aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/DownloadConfigPane.java36
-rw-r--r--src/main/java/TagEditorScreen.java2
2 files changed, 30 insertions, 8 deletions
diff --git a/src/main/java/DownloadConfigPane.java b/src/main/java/DownloadConfigPane.java
index f16c58f..0772bde 100644
--- a/src/main/java/DownloadConfigPane.java
+++ b/src/main/java/DownloadConfigPane.java
@@ -53,10 +53,10 @@ public class DownloadConfigPane extends JFrame{
if (url.length() == 0){
return;
}
- if (from.length() != 8){
+ if (from.length() != 7){
from = "00:00:00";
}
- if (to.length() != 8){
+ if (to.length() != 7){
to = "00:00:00";
}
Object[] song = new Object[]{url, from, to};
@@ -118,6 +118,19 @@ public class DownloadConfigPane extends JFrame{
return null;
}
+ private File selectDirectoryFileChooser(){
+ JFileChooser chooser = new JFileChooser();
+ chooser.setCurrentDirectory(new File(System.getProperty("user.home")));
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int result = chooser.showOpenDialog(this);
+ if (result == JFileChooser.APPROVE_OPTION) {
+ File selectedFile = chooser.getSelectedFile();
+ System.out.println("Selected file: " + selectedFile.getAbsolutePath());
+ return selectedFile;
+ }
+ return null;
+ }
+
private void loadConfigFromFile(){
File file = selectTextFileChooser();
if (file == null){
@@ -139,10 +152,10 @@ public class DownloadConfigPane extends JFrame{
}
String from = timeRange[0];
String to = timeRange[1];
- if (from.length() != 8){
+ if (from.length() != 7){
from = "00:00:00";
}
- if (to.length() != 8){
+ if (to.length() != 7){
to = "00:00:00";
}
Object[] song = new Object[]{url, from, to};
@@ -166,8 +179,11 @@ public class DownloadConfigPane extends JFrame{
private void saveConfigToFile() throws IOException {
if(loadedPath == null){
- System.out.println("No file loaded");
- return;
+ File selectedDirectory = selectDirectoryFileChooser();
+ if (selectedDirectory == null){
+ return;
+ }
+ loadedPath = selectedDirectory.getAbsolutePath() + "/download_config.txt";
}
File saveFile = new File(loadedPath);
FileWriter writer = new FileWriter(saveFile);
@@ -179,7 +195,13 @@ public class DownloadConfigPane extends JFrame{
String url = (String) outputTable.getValueAt(i, 0);
String from = (String) outputTable.getValueAt(i, 1);
String to = (String) outputTable.getValueAt(i, 2);
- String line = url + "," + from + "-" + to;
+ String line = "";
+ if (from.equals("00:00:00") && to.equals("00:00:00")){
+ line = url;
+ }
+ else{
+ line = url + "," + from + "-" + to;
+ }
try{
writer.write(line + System.lineSeparator());
}
diff --git a/src/main/java/TagEditorScreen.java b/src/main/java/TagEditorScreen.java
index c787853..7942912 100644
--- a/src/main/java/TagEditorScreen.java
+++ b/src/main/java/TagEditorScreen.java
@@ -39,9 +39,9 @@ public class TagEditorScreen extends JFrame {
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setSize(700, 550);
- listenButton.setEnabled(false);
initalizeListeners();
initializeTable();
+ listenButton.setEnabled(false);
this.add(mainPanel);
this.setVisible(true);
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage