removed progress bar

This commit is contained in:
Morril
2023-01-18 03:36:16 +01:00
parent 5c1dcea12a
commit d2f75f478f

View File

@@ -49,25 +49,14 @@ public class LastFMToSpotify {
// Start Progress Bar // Start Progress Bar
try (ProgressBar pb = new ProgressBar("LastFM -> Spotify Playlist", 4)) { try {
for (int progress = 1; progress<=5; progress++) { logLn("Authenticating with Spotify...", 1);
pb.step(); // step by 1 logLn("Authenticating with LastFM...", 1);
switch (progress) {
case 1:
pb.setExtraMessage("Authenticating with Spotify...");
break;
case 2:
pb.setExtraMessage("Authenticating with LastFM...");
Caller.getInstance().setUserAgent(configuration.get("requests.useragent")); Caller.getInstance().setUserAgent(configuration.get("requests.useragent"));
logLn(User.getInfo(configuration.get("lastfm.user"), configuration.get("lastfm.apikey")).getName(), 1); logLn(User.getInfo(configuration.get("lastfm.user"), configuration.get("lastfm.apikey")).getName(), 1);
break; logLn("Reading from LastFM...", 1);
case 3:
pb.setExtraMessage("Reading from LastFM...");
User.getTopTracks(configuration.get("lastfm.user"), Period.ONE_MONTH, configuration.get("lastfm.apikey")); User.getTopTracks(configuration.get("lastfm.user"), Period.ONE_MONTH, configuration.get("lastfm.apikey"));
break; logLn("Creating Playlist...", 1);
case 4:
pb.setExtraMessage("Creating Playlist...");
SpotifyApi.Builder build = SpotifyApi.builder(); SpotifyApi.Builder build = SpotifyApi.builder();
build.setClientId(configuration.get("spotify.clientid")); build.setClientId(configuration.get("spotify.clientid"));
build.setClientSecret(configuration.get("spotify.secret")); build.setClientSecret(configuration.get("spotify.secret"));
@@ -75,12 +64,7 @@ public class LastFMToSpotify {
SpotifyApi api = build.build(); SpotifyApi api = build.build();
api.setAccessToken(configuration.get("spotify.access")); api.setAccessToken(configuration.get("spotify.access"));
api.createPlaylist(api.getCurrentUsersProfile().build().execute().getId(), configuration.get("playlist.name")).setHeader("User-Agent", configuration.get("requests.useragent")); api.createPlaylist(api.getCurrentUsersProfile().build().execute().getId(), configuration.get("playlist.name")).setHeader("User-Agent", configuration.get("requests.useragent"));
break; logLn("Done.", 1);
case 5:
pb.setExtraMessage("Done.");
break;
}
}
} catch (IOException | ParseException | SpotifyWebApiException e) { } catch (IOException | ParseException | SpotifyWebApiException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }