Implemented a few features #1
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
# Project exclude paths
|
||||
/target/
|
||||
/target/
|
||||
.idea/
|
||||
|
||||
@@ -15,12 +15,15 @@ import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static de.b00tload.tools.lastfmtospotifyplaylist.util.Logger.logLn;
|
||||
|
||||
public class LastFMToSpotify {
|
||||
|
||||
public static final String LINE_SEPERATOR = System.getProperty("line.separator");
|
||||
public static HashMap<String, String> configuration;
|
||||
|
||||
public static void main(String[] args) {
|
||||
configuration = new HashMap<>();
|
||||
configuration.put("requests.useragent", "LastFMToSpotify/1.0-Snapshot (" + System.getProperty("os.name") + "; " + System.getProperty("os.arch") + ") Java/"+System.getProperty("java.version"));
|
||||
for(int a = 0; a<args.length; a++){
|
||||
Arguments arg;
|
||||
@@ -44,6 +47,11 @@ public class LastFMToSpotify {
|
||||
}
|
||||
}
|
||||
|
||||
logLn("Priority 0",0 );
|
||||
logLn("Priority 1",1 );
|
||||
logLn("Priority 2",2 );
|
||||
logLn("Priority 3",3 );
|
||||
|
||||
// Start Progress Bar
|
||||
try (ProgressBar pb = new ProgressBar("LastFM -> Spotify Playlist", 4)) {
|
||||
for (int progress = 1; progress<=5; progress++) {
|
||||
|
||||
@@ -53,7 +53,13 @@ public class ArgumentHandler {
|
||||
}
|
||||
|
||||
private static void verbose(String value){
|
||||
//wenn value != int
|
||||
System.out.println("LogLevel must be a numeric value.");
|
||||
try {
|
||||
int loglevel = Integer.parseInt(value);
|
||||
configuration.put("logging.level", String.valueOf(loglevel));
|
||||
} catch (NumberFormatException e) {
|
||||
System.out.println("LogLevel must be a numeric value.");
|
||||
System.exit(500);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import static de.b00tload.tools.lastfmtospotifyplaylist.LastFMToSpotify.configur
|
||||
public class Logger {
|
||||
|
||||
public static void logLn(String string, int priority){
|
||||
if(Integer.parseInt(configuration.get("verbose.level")))
|
||||
if(Integer.parseInt(configuration.get("logging.level"))>=priority){
|
||||
System.out.println(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user