Skip to content

Commit

Permalink
Version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
googleknight committed May 31, 2017
1 parent 1cf043b commit d639730
Show file tree
Hide file tree
Showing 39 changed files with 543 additions and 294 deletions.
2 changes: 2 additions & 0 deletions Log v1.1 .md → Logs/Log v1.1 .md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Changes from v1.0
* Categorization and analysis of catalog added.
* Checks invalid entries in catalog at boot up, like files which are moved or removed etc.
* Checks for new movies at boot up, gives option to add those movies.
* Option to copy movies added.
* Menu items in Help added.
* Dependency on OMDB API removed.
Expand Down
10 changes: 10 additions & 0 deletions Logs/Log v1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Changes from v1.1
* In categorization and analysis, user can directly see all the details of selected movie in Main Window.
* Option to hide/unhide pie chart added.
* Option to copy movies fixed.
* Menu items in Help updated.
* Temporary posters created are now safely removed.
* Will now able to find details of "video", along with "feature" in individual update.
* Checks invalid entries in catalog at movie selection, copying, playing etc is added.
* Color of the UI changed.
* Other minor bugs fixed.
54 changes: 39 additions & 15 deletions Movie Cataloger/src/moviecatalog/common/Tools.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,34 +645,58 @@ public static void removeMovie(String title)
/**
* Removes invalid entries from catalog. Invalid like file moved or renamed or deleted but still exists in catalog with old data
*/
public static void checkInvlaidEntries() {
public static boolean checkInvlaidEntries(String name) {
Connection c;
Statement stmt;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:" + Tools.getDBNAME());
System.out.println("Opened database successfully");
stmt = c.createStatement();
ResultSet res = stmt.executeQuery("select Title,FileFullPath from LocalInfo");
int count = 0;
List<String> obselete = new ArrayList<String>();
while (res.next()) {
File file = new File(res.getString("FileFullPath"));
if (!file.exists()) {
obselete.add(res.getString("Title")); //Adding invalid entries into list
count++; //counting invalid entries
ResultSet res ;
if (name==null)
{
res= stmt.executeQuery("select Title,FileFullPath from LocalInfo");
int count = 0;
List<String> obselete = new ArrayList<String>();
while (res.next()) {
File file = new File(res.getString("FileFullPath"));
if (!file.exists()) {
obselete.add(res.getString("Title")); //Adding invalid entries into list
count++; //counting invalid entries
}
}
c.close();
for (String title : obselete) {
System.out.println("Removing " + title);
removeMovie(title);// deleting movies one by one
}
if (count > 0)
{
JOptionPane.showMessageDialog(null, "Invalid entries removed " + count);
return true;
}
}
c.close();
for (String title : obselete) {
System.out.println("Removing " + title);
removeMovie(title);// deleting movies one by one
else
{
PreparedStatement pstmt=c.prepareStatement("select Title,FileFullPath from LocalInfo where Title=?");
pstmt.setString(1,name);
res = pstmt.executeQuery();
while (res.next()) {
File file = new File(res.getString("FileFullPath"));
if (!file.exists()) {
res.close();
c.close();
removeMovie(name);// deleting invalid movie
return true;
}
}
}
if (count > 0)
JOptionPane.showMessageDialog(null, "Invalid entries removed " + count);

} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
return false;
}
/**
* Checks in the set folders if any new movies are available
Expand Down
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/Help/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Movie Cataloger/src/moviecatalog/resources/about.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Movie Cataloger/src/moviecatalog/views/AddFolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Iterator;
import java.awt.event.ActionEvent;
import java.awt.Toolkit;
import java.awt.Color;


public class AddFolder extends JDialog {
Expand Down Expand Up @@ -71,11 +72,13 @@ private void initComponents() {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBackground(Color.WHITE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);

lstmodel = new DefaultListModel<>();
lstpath = new JList<>(lstmodel);
lstpath.setBackground(Color.WHITE);

btnAddFolder = new JButton("Add Folder");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import javax.swing.JOptionPane;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Toolkit;
import java.awt.Color;

public class AddingMoviesProgress extends JDialog {

Expand Down Expand Up @@ -85,15 +86,20 @@ private void initComponents() {
setTitle("Adding movies to catalog");
setBounds(100, 100, 450, 150);
contentPanel = new JPanel();
contentPanel.setBackground(Color.WHITE);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);

pgrsbr = new JProgressBar();
pgrsbr.setOpaque(true);
pgrsbr.setBackground(Color.WHITE);

lblmovies = new JLabel("Adding movies to catalog");
lblmovies.setBackground(Color.WHITE);

lblprogress = new JLabel("");
lblprogress.setBackground(Color.WHITE);
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING).addGroup(
gl_contentPanel.createSequentialGroup().addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
Expand Down
16 changes: 10 additions & 6 deletions Movie Cataloger/src/moviecatalog/views/BatchCopy.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Color;

public class BatchCopy extends JDialog {
private final JPanel contentPanel = new JPanel();
Expand Down Expand Up @@ -105,6 +106,7 @@ private void initcomponents() {
Toolkit.getDefaultToolkit().getImage(BatchCopy.class.getResource("/moviecatalog/resources/icon.png")));

JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
Expand All @@ -116,10 +118,13 @@ private void initcomponents() {
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

prgbar = new JProgressBar();
prgbar.setBackground(Color.WHITE);

lblCopy = new JLabel("Copying Movies");
lblCopy.setBackground(Color.WHITE);

lblupdate = new JLabel("");
lblupdate.setBackground(Color.WHITE);
GroupLayout gl_panel = new GroupLayout(panel);
gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_panel.createSequentialGroup().addContainerGap(180, Short.MAX_VALUE).addComponent(lblCopy)
Expand Down Expand Up @@ -147,7 +152,7 @@ private void copyMovies() {
obj.setDaemon(true);
obj.start();
}

}
//A daemon thread to copy files in background
class BatchCopyProgress extends Thread {
BatchCopy obj;
Expand All @@ -171,15 +176,14 @@ public void run() {
obj.getPrgbar().setMaximum(counter);
for (i = 0; i < counter; i++) {
for (j = 0; j < n; j++) {
boolean chk = (boolean) (obj.getModel().getValueAt(j, 0));
if (chk) {
if ((boolean) (obj.getModel().getValueAt(j, 0))) {
String moviename = (String) obj.getModel().getValueAt(j, 1);
filefullpath = Tools.getFullPath(moviename);
Path source = Paths.get(filefullpath);
String name = source.getFileName().toString();
Path destn = Paths.get(dest + name);
Path destn = Paths.get(obj.getDest() + name);
CopyOption[] options = new CopyOption[] { StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES };// Maintains User Privilage
StandardCopyOption.COPY_ATTRIBUTES };// Maintains User Privilege
try {
Files.copy(source, destn, options);
} catch (IOException e1) {
Expand All @@ -199,4 +203,4 @@ public void run() {

}
}
}

4 changes: 4 additions & 0 deletions Movie Cataloger/src/moviecatalog/views/BatchUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import java.awt.Toolkit;
import java.awt.Color;

public class BatchUpdate extends JDialog {

Expand Down Expand Up @@ -72,6 +73,7 @@ private void initComponents() {
setIconImage(Toolkit.getDefaultToolkit().getImage(BatchUpdate.class.getResource("/moviecatalog/resources/icon.png")));
setBounds(100, 100, 516, 370);
contentPanel = new JPanel();
contentPanel.setBackground(Color.WHITE);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
Expand All @@ -85,8 +87,10 @@ private void initComponents() {
btnUpdateByFiltering = new JButton("Update by filtering moviename");

lblStatus = new JLabel("");
lblStatus.setBackground(Color.WHITE);

lblMovieSelected = new JLabel("");
lblMovieSelected.setBackground(Color.WHITE);

GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
Expand Down
Loading

0 comments on commit d639730

Please sign in to comment.