diff --git a/CHANGELOG b/CHANGELOG index 3e5ec06..6d93685 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Version 1.2.1 +- Minor textual updates +- Show error messages + Version 1.2 - Support for latest Flickr API diff --git a/EasyFlickrBackup.jar b/EasyFlickrBackup.jar index 1fc9b92..f736ebd 100644 Binary files a/EasyFlickrBackup.jar and b/EasyFlickrBackup.jar differ diff --git a/LICENSE b/LICENSE index d23854e..67f4e98 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Lutana +Copyright (c) 2024 Matthias Mohr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 25992d1..768f16b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # EasyFlickrBackup Easy to use application to download and backup all your photos in original size from flickr. -* Current version: 1.2 +* Current version: 1.2.1 * License: MIT License ![Screenshot](https://c2.staticflickr.com/2/1701/25533200184_1d88bdfa68_o.png) @@ -12,7 +12,7 @@ Easy to use application to download and backup all your photos in original size ## Download & Installation -* Download: https://github.com/lutana-de/easyflickrbackup/raw/master/EasyFlickrBackup.jar +* Download: https://github.com/m-mohr/easyflickrbackup/raw/master/EasyFlickrBackup.jar Please make sure your computer meets the system requirements. After the download has finished, click on the EasyFlickrBackup.jar file. diff --git a/pom.xml b/pom.xml index 0ecee8f..f08f537 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.lutana EasyFlickrBackup - 1.2 + 1.2.1 jar UTF-8 diff --git a/src/main/java/de/lutana/easyflickrbackup/AboutDlg.form b/src/main/java/de/lutana/easyflickrbackup/AboutDlg.form index 30b83f7..17a719c 100644 --- a/src/main/java/de/lutana/easyflickrbackup/AboutDlg.form +++ b/src/main/java/de/lutana/easyflickrbackup/AboutDlg.form @@ -89,7 +89,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -135,8 +135,7 @@ - - + @@ -151,8 +150,11 @@ - + + + + diff --git a/src/main/java/de/lutana/easyflickrbackup/AboutDlg.java b/src/main/java/de/lutana/easyflickrbackup/AboutDlg.java index 35c93ad..d74ae61 100644 --- a/src/main/java/de/lutana/easyflickrbackup/AboutDlg.java +++ b/src/main/java/de/lutana/easyflickrbackup/AboutDlg.java @@ -61,7 +61,7 @@ private void initComponents() { setResizable(false); jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() | java.awt.Font.BOLD)); - jLabel1.setText("EasyFlickrBackup 1.2"); + jLabel1.setText("EasyFlickrBackup 1.2.1"); jLabel2.setText("MIT License"); @@ -70,7 +70,7 @@ private void initComponents() { jLabel4.setText("Matthias Mohr"); jLabel5.setForeground(new java.awt.Color(0, 51, 255)); - jLabel5.setText("http://www.lutana.de"); + jLabel5.setText("https://mohr.ws"); jLabel5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel5MouseClicked(evt); @@ -82,14 +82,13 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { jTextArea1.setEditable(false); jTextArea1.setColumns(20); jTextArea1.setRows(5); - jTextArea1.setText("Version 1.2\n- Support for latest Flickr API\n\nVersion 1.1.1\n- File names comply with flickr guidelines\n\nVersion 1.1\n- Download process about 10 times faster\n- Pause & Resume the download process at any time\n- Store files in a separate directory per user\n\nVersion 1.0\n- Initial release"); - jTextArea1.setCaretPosition(0); + jTextArea1.setText("Version 1.2.1\n- Minor textual updates\n- Show error messages\n\nVersion 1.2\n- Support for latest Flickr API\n\nVersion 1.1.1\n- File names comply with flickr guidelines\n\nVersion 1.1\n- Download process about 10 times faster\n- Pause & Resume the download process at any time\n- Store files in a separate directory per user\n\nVersion 1.0\n- Initial release"); jScrollPane1.setViewportView(jTextArea1); jLabel7.setText("License:"); jLabel8.setForeground(new java.awt.Color(0, 51, 255)); - jLabel8.setText("https://github.com/lutana-de/easyflickrbackup"); + jLabel8.setText("https://github.com/m-mohr/easyflickrbackup"); jLabel8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel8MouseClicked(evt); @@ -147,19 +146,21 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { .addContainerGap()) ); + jLabel8.getAccessibleContext().setAccessibleDescription(""); + pack(); }// //GEN-END:initComponents private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked try { - Desktop.getDesktop().browse(new URI("http://www.lutana.de")); + Desktop.getDesktop().browse(new URI("https://mohr.ws")); } catch (URISyntaxException | IOException ex) { } }//GEN-LAST:event_jLabel5MouseClicked private void jLabel8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MouseClicked try { - Desktop.getDesktop().browse(new URI("https://github.com/lutana-de/easyflickrbackup")); + Desktop.getDesktop().browse(new URI("https://github.com/m-mohr/easyflickrbackup")); } catch (URISyntaxException | IOException ex) { } }//GEN-LAST:event_jLabel8MouseClicked diff --git a/src/main/java/de/lutana/easyflickrbackup/GUI.form b/src/main/java/de/lutana/easyflickrbackup/GUI.form index 6f4004d..338de58 100644 --- a/src/main/java/de/lutana/easyflickrbackup/GUI.form +++ b/src/main/java/de/lutana/easyflickrbackup/GUI.form @@ -147,7 +147,7 @@ - + @@ -170,11 +170,12 @@ - + + @@ -192,9 +193,11 @@ - - - + + + + + @@ -225,6 +228,21 @@ + + + + + + + + + + + + + + + diff --git a/src/main/java/de/lutana/easyflickrbackup/GUI.java b/src/main/java/de/lutana/easyflickrbackup/GUI.java index 38308b8..5896117 100644 --- a/src/main/java/de/lutana/easyflickrbackup/GUI.java +++ b/src/main/java/de/lutana/easyflickrbackup/GUI.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright 2016 Lutana.de + * Copyright 2024 Matthias Mohr * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -88,6 +88,8 @@ private void initComponents() { statusLabel = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); cancelBtn = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + messageArea = new javax.swing.JTextArea(); jPanel1 = new javax.swing.JPanel(); openFolderBtn = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); @@ -120,7 +122,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { Auth[] auths = this.flickrAuth.retrieveAll(); for (Auth auth : auths) { - userBox.addItem(new StringContainer.Auth(auth)); + userBox.addItem(new StringContainerAuth(auth)); } if (userBox.getItemCount() > 0) { userBox.setSelectedIndex(0); @@ -190,6 +192,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + messageArea.setEditable(false); + messageArea.setColumns(20); + jScrollPane1.setViewportView(messageArea); + javax.swing.GroupLayout backupPanelLayout = new javax.swing.GroupLayout(backupPanel); backupPanel.setLayout(backupPanelLayout); backupPanelLayout.setHorizontalGroup( @@ -200,10 +206,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(startBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(backupSep) .addGroup(backupPanelLayout.createSequentialGroup() - .addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 459, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancelBtn)) - .addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()) ); backupPanelLayout.setVerticalGroup( @@ -218,7 +225,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(statusLabel) .addComponent(cancelBtn)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE) .addContainerGap()) ); @@ -309,7 +318,7 @@ private void updateComponents() { } public void updateAuth() { - StringContainer.Auth authContainer = (StringContainer.Auth) userBox.getSelectedItem(); + StringContainerAuth authContainer = (StringContainerAuth) userBox.getSelectedItem(); if (authContainer != null) { this.setAuth(authContainer.get()); } @@ -375,7 +384,7 @@ private void authBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST try { OAuth1Token requestToken = authInterface.getAccessToken(accessToken, tokenKey); Auth auth = authInterface.checkToken(requestToken); - StringContainer.Auth ac = new StringContainer.Auth(auth); + StringContainerAuth ac = new StringContainerAuth(auth); userBox.addItem(ac); userBox.setSelectedItem(ac); updateAuth(); @@ -479,21 +488,44 @@ public void run() { fos.flush(); fos.close(); bis.close(); + addMessage("Succeeded", current); + } + else { + addMessage("Exists -> Skipped", current); } } catch (Exception e) { + addMessage(e.getMessage(), current); error++; } progressBar.setValue(current); } page++; } while (page <= pages && isRunning); - statusLabel.setText(isRunning ? "Download of " + total + " photos finished. " + (error == 0 ? "No" : error) + " errors occured!" : "Stopped downloading process. You can resume it at any time."); + addMessage(isRunning ? "Download of " + total + " photos finished. " + (error == 0 ? "No" : error) + " errors occured!" : "Stopped downloading process. You can resume it at any time."); } catch (FlickrException ex) { - statusLabel.setText(ex.getMessage()); + addMessage(ex.getMessage()); } isRunning = false; updateComponents(); } + + public void addMessage(String message) { + this.addMessage(message, null); + } + + public void addMessage(String message, Integer count) { + if (count == null) { + statusLabel.setText(message); + } + if (messageArea.getDocument().getLength() > 0) { + messageArea.append(System.lineSeparator()); + messageArea.setCaretPosition(messageArea.getDocument().getLength()); + } + if (count != null) { + messageArea.append(count + ": "); + } + messageArea.append(message); + } /** * @param args the command line arguments @@ -501,7 +533,7 @@ public void run() { public static void main(String args[]) { /* Set the Nimbus look and feel */ // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { @@ -552,6 +584,8 @@ public void run() { private javax.swing.JLabel dirLabel; private javax.swing.JButton jButton1; private javax.swing.JPanel jPanel1; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextArea messageArea; private javax.swing.JButton openFolderBtn; private javax.swing.JProgressBar progressBar; private javax.swing.JPanel settingsPanel; diff --git a/src/main/java/de/lutana/easyflickrbackup/ImageSizes.java b/src/main/java/de/lutana/easyflickrbackup/ImageSizes.java index 55a9b91..7b5f197 100644 --- a/src/main/java/de/lutana/easyflickrbackup/ImageSizes.java +++ b/src/main/java/de/lutana/easyflickrbackup/ImageSizes.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright 2016 Matthias. + * Copyright 2016 Matthias Mohr. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,17 +24,12 @@ package de.lutana.easyflickrbackup; import com.flickr4java.flickr.photos.Size; -import java.util.AbstractMap; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; public class ImageSizes { - private Map suffix; + private final Map suffix; public ImageSizes() { suffix = new HashMap<>(); diff --git a/src/main/java/de/lutana/easyflickrbackup/Settings.java b/src/main/java/de/lutana/easyflickrbackup/Settings.java index 74d5a76..7e270dd 100644 --- a/src/main/java/de/lutana/easyflickrbackup/Settings.java +++ b/src/main/java/de/lutana/easyflickrbackup/Settings.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright 2016 Lutana.de + * Copyright 2024 Matthias Mohr * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,7 +28,7 @@ public class Settings { - private static Preferences prefs = Preferences.userNodeForPackage(de.lutana.easyflickrbackup.Settings.class); + private static final Preferences prefs = Preferences.userNodeForPackage(Settings.class); public static void setBackupDirectory(File file) { if (file != null) { diff --git a/src/main/java/de/lutana/easyflickrbackup/StringContainer.java b/src/main/java/de/lutana/easyflickrbackup/StringContainer.java index 780a4b5..c80ae99 100644 --- a/src/main/java/de/lutana/easyflickrbackup/StringContainer.java +++ b/src/main/java/de/lutana/easyflickrbackup/StringContainer.java @@ -23,8 +23,6 @@ */ package de.lutana.easyflickrbackup; -import com.flickr4java.flickr.people.User; - public abstract class StringContainer { protected T obj; @@ -40,19 +38,5 @@ public T get() { @Override public abstract String toString(); { } - - public static class Auth extends StringContainer { - - public Auth(com.flickr4java.flickr.auth.Auth obj) { - super(obj); - } - - @Override - public String toString() { - User u = obj.getUser(); - return u.getUsername() + " (" + u.getId() + ")"; - } - - } } diff --git a/src/main/java/de/lutana/easyflickrbackup/StringContainerAuth.java b/src/main/java/de/lutana/easyflickrbackup/StringContainerAuth.java new file mode 100644 index 0000000..1528b0e --- /dev/null +++ b/src/main/java/de/lutana/easyflickrbackup/StringContainerAuth.java @@ -0,0 +1,40 @@ +/* + * The MIT License + * + * Copyright 2024 Matthias Mohr. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package de.lutana.easyflickrbackup; + +import com.flickr4java.flickr.people.User; + +public class StringContainerAuth extends StringContainer { + + public StringContainerAuth(com.flickr4java.flickr.auth.Auth obj) { + super(obj); + } + + @Override + public String toString() { + User u = obj.getUser(); + return u.getUsername() + " (" + u.getId() + ")"; + } + +} \ No newline at end of file