Skip to content

Commit

Permalink
Add a fun new library for dealing with common stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
nperrier committed Aug 6, 2013
1 parent 8d37cc8 commit 4ac3b5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Binary file added lib/std/commons-lang3-3.1.jar
Binary file not shown.
15 changes: 9 additions & 6 deletions src/com/pugh/sockso/music/DBCollectionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() );
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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";
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4ac3b5a

Please sign in to comment.