Permalink
Browse files

Add a fun new library for dealing with common stuff

  • Loading branch information...
1 parent 8d37cc8 commit 4ac3b5a6ab5ae58af1efe6d39aad508cdc148cbe @nperrier nperrier committed Aug 6, 2013
View
BIN lib/std/commons-lang3-3.1.jar
Binary file not shown.
View
15 src/com/pugh/sockso/music/DBCollectionManager.java
@@ -19,6 +19,8 @@
import org.apache.log4j.Logger;
+import org.apache.commons.lang3.StringUtils;
+
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@@ -156,7 +158,7 @@ protected void addFile( final int collectionId, final File file ) throws Invalid
final int artistId = addArtist( tag.getArtist() );
int albumArtistId = artistId;
- if ( tag.getAlbumArtist() != null && tag.getAlbumArtist().equals("") ) {
+ if ( StringUtils.isBlank(tag.getAlbumArtist()) ) {
albumArtistId = addArtist( tag.getAlbumArtist() );
}
@@ -196,7 +198,7 @@ protected void addCoverArt( final int itemId, final String itemType, final Buffe
log.warn("addCoverArt: itemId param was -1");
return;
}
-
+
// TODO Would be nice if we had some sort of helper to build a coverId from arbitrary music item types
String coverId = itemType + itemId;
@@ -761,7 +763,7 @@ public int addDirectory( final File dir ) {
private int addArtist( String name ) {
- if ( name.equals("") ) {
+ if ( StringUtils.isBlank(name) ) {
name = "Unknown Artist";
}
@@ -826,7 +828,7 @@ private int addArtist( String name ) {
private int addAlbum( final int artistId, String name, String year ) {
- if ( name.equals("") ) {
+ if ( StringUtils.isBlank(name) ) {
name = "Unknown Album";
}
@@ -893,7 +895,7 @@ private int addAlbum( final int artistId, String name, String year ) {
private int addGenre( String name ) {
- if ( name.equals("") ) {
+ if ( StringUtils.isBlank(name) ) {
name = "Unknown Genre";
}
@@ -955,8 +957,9 @@ private int addGenre( String name ) {
private int addTrack( final int artistId, final int albumId, String name,
final int trackNo, final File file, final int collectionId, final int genreId ) {
- if ( name.equals("") )
+ if ( StringUtils.isBlank(name) ) {
name = "Unknown Track (" + trackNo + ")";
+ }
ResultSet rs = null;
PreparedStatement st = null;

0 comments on commit 4ac3b5a

Please sign in to comment.