-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- removed trackinfo table - deleting directory is now faster - deleting a track deletes it from file system - if a song is deleted from file system it automatically gets deleted from database when it is played - added sqlite - now beatboxer can play .m4a and .wmv files too
- Loading branch information
Showing
29 changed files
with
1,220 additions
and
784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
dist/ | ||
build/ | ||
dist/ | ||
build/ | ||
/Sqlite/nbproject/private/ | ||
/test/nbproject/private/ |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package beatboxer; | ||
|
||
import java.sql.*; | ||
import javafx.collections.ObservableList; | ||
|
||
/** | ||
* | ||
* @author SANJAY TAYAL | ||
*/ | ||
public class Album extends CreateConnection { | ||
|
||
public ObservableList<BBItem> ShowAllAlbums() { | ||
Statement count = null; | ||
try { | ||
count = con.createStatement(); | ||
return BBGenerator.item(count.executeQuery("Select * from album order by albumname")); | ||
} catch (SQLException e) { | ||
|
||
} finally { | ||
if (count != null) { | ||
try { | ||
count.close(); | ||
} catch (SQLException e) { | ||
|
||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public ObservableList<BBSong> ShowAllTracksinAlbum(int albumId) { | ||
PreparedStatement statement = null; | ||
try { | ||
String sql = "select trackid,trackname,artistname,albumname,location,genre,favourite from track natural join artist natural join album WHERE albumid = ? order by trackname"; | ||
statement = con.prepareStatement(sql); | ||
statement.setInt(1, albumId); | ||
return BBGenerator.song(statement.executeQuery()); | ||
} catch (SQLException e) { | ||
|
||
} finally { | ||
if (statement != null) { | ||
try { | ||
statement.close(); | ||
} catch (SQLException e) { | ||
|
||
} | ||
} | ||
} | ||
return null; | ||
|
||
} | ||
|
||
public ObservableList<BBItem> SearchAlbum(String string) { | ||
PreparedStatement statement = null; | ||
try { | ||
String sql = "select * from album WHERE albumname LIKE ? order by albumname"; | ||
statement = con.prepareStatement(sql); | ||
statement.setString(1, '%' + string + '%'); | ||
return BBGenerator.item(statement.executeQuery()); | ||
} catch (Exception e) { | ||
return null; | ||
} finally { | ||
if (statement != null) { | ||
try { | ||
statement.close(); | ||
} catch (SQLException e) { | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package beatboxer; | ||
|
||
import java.sql.*; | ||
import javafx.collections.ObservableList; | ||
|
||
/** | ||
* | ||
* @author SANJAY TAYAL | ||
*/ | ||
public class Artist extends CreateConnection { | ||
|
||
public ObservableList<BBItem> ShowAllArtists() { | ||
Statement count = null; | ||
try { | ||
count = con.createStatement(); | ||
return BBGenerator.item(count.executeQuery("Select * from artist order by artistname")); | ||
} catch (SQLException e) { | ||
|
||
} finally { | ||
if (count != null) { | ||
try { | ||
count.close(); | ||
} catch (SQLException e) { | ||
|
||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public ObservableList<BBSong> ShowAllTracksByArtists(int artistId) { | ||
PreparedStatement statement = null; | ||
try { | ||
String sql = "select trackid,trackname,artistname,albumname,location,genre,favourite from track natural join artist natural join album WHERE artistid = ? order by trackname"; | ||
statement = con.prepareStatement(sql); | ||
statement.setInt(1, artistId); | ||
return BBGenerator.song(statement.executeQuery()); | ||
} catch (SQLException e) { | ||
|
||
} finally { | ||
if (statement != null) { | ||
try { | ||
statement.close(); | ||
} catch (SQLException e) { | ||
|
||
} | ||
} | ||
} | ||
return null; | ||
|
||
} | ||
|
||
public ObservableList<BBItem> SearchArtist(String string) { | ||
PreparedStatement statement = null; | ||
try { | ||
String sql = "select * from artist WHERE artistname LIKE ? order by artistname"; | ||
statement = con.prepareStatement(sql); | ||
statement.setString(1, '%' + string + '%'); | ||
return BBGenerator.item(statement.executeQuery()); | ||
} catch (Exception e) { | ||
return null; | ||
} finally { | ||
if (statement != null) { | ||
try { | ||
statement.close(); | ||
} catch (SQLException e) { | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
package beatboxer; | ||
|
||
import javafx.collections.*; | ||
|
||
import java.sql.*; | ||
|
||
public class BBGenerator { | ||
public static ObservableList<BBItem> item(ResultSet res){ | ||
ObservableList<BBItem> list = FXCollections.observableArrayList(); | ||
try { | ||
while(res.next()){ | ||
list.add(new BBItem(res.getInt(1),res.getString(2))); | ||
} | ||
} catch (SQLException e) { } | ||
return list; | ||
} | ||
public static ObservableList<BBSong> song(ResultSet res){ | ||
ObservableList<BBSong> list = FXCollections.observableArrayList(); | ||
try { | ||
while(res.next()){ | ||
list.add(new BBSong(res.getInt("trackid"),res.getString("trackname"),res.getString("albumname"),res.getString("artistname"),res.getString("genre"),res.getString("location"), res.getBoolean("favourite"))); | ||
} | ||
// ObservableList<BBSong> l = FXCollections.observableArrayList(); | ||
// for(BBSong song : list){ | ||
// if(! l.contains(song)){ | ||
// l.add(song); | ||
// } | ||
// } | ||
// list = l; | ||
} catch (SQLException e) { } | ||
return list; | ||
} | ||
public static int find(ObservableList<BBSong> haystack, BBSong needle){ | ||
for (int i = 0; i < haystack.size(); i++) { | ||
if(haystack.get(i).getId()==needle.getId()) | ||
return i; | ||
|
||
public static ObservableList<BBItem> item(ResultSet res) { | ||
ObservableList<BBItem> list = FXCollections.observableArrayList(); | ||
try { | ||
while (res.next()) { | ||
list.add(new BBItem(res.getInt(1), res.getString(2))); | ||
} | ||
res.close(); | ||
} catch (SQLException e) { | ||
} | ||
return list; | ||
} | ||
|
||
public static ObservableList<BBSong> song(ResultSet res) { | ||
ObservableList<BBSong> list = FXCollections.observableArrayList(); | ||
try { | ||
while (res.next()) { | ||
list.add(new BBSong(res.getInt("trackid"), res.getString("trackname"), res.getString("albumname"), res.getString("artistname"), res.getString("genre"), res.getString("location"), res.getBoolean("favourite"))); | ||
} | ||
res.close(); | ||
} catch (SQLException e) { | ||
} | ||
return list; | ||
} | ||
|
||
public static int find(ObservableList<BBSong> haystack, BBSong needle) { | ||
for (int i = 0; i < haystack.size(); i++) { | ||
if (haystack.get(i).getId() == needle.getId()) { | ||
return i; | ||
} | ||
return -1; | ||
} | ||
} | ||
return -1; | ||
} | ||
} |
Oops, something went wrong.