Jump to content

hiwatt99

Active Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by hiwatt99

  1. Hiwatt99, strange, not a big deal by any means, but when it creates the calendar based filename, it's naming them by the month of September (09), instead of October (10). I looked at your code in the post, and it looks right, so perhaps it's slightly different in the actual jar? Could it simply need an (add 1)>>?

    That's an odd artifact of the Java Calendar class -- it returns 0-based months, i.e., 0...11. The point of using the date was just to ensure unique filenames, not to be an accurate timestamp. ;-) Just add one to the returned value if you want the correct date/time.

    Now if I can just get Cooper's code to work it will all be moot...

    --h

  2. At a forum member's request, I uploaded my hacked version (which saves the 'unknown' MP3s) here:

    http://www.megaupload.com/?d=91MI1BR2

    Sorry about the lamer download site, but hey, it's free.

    For those like me that don't trust anonymous jars ;-), here are the changes:

    utilSongInfo.java

    import java.util.*;

    // Change main c'tor:

    public SongInfo(String artist, String title) {

    if ( null == artist )

    this.artist = "unknown";

    else

    this.artist = artist;

    if ( null == title ) {

    GregorianCalendar gc = new GregorianCalendar();

    this.title = "" +

    gc.get(Calendar.YEAR) +

    Util.fmt(gc.get(Calendar.MONTH),2) +

    Util.fmt(gc.get(Calendar.DAY_OF_MONTH),2) +

    Util.fmt(gc.get(Calendar.HOUR_OF_DAY),2) +

    Util.fmt(gc.get(Calendar.MINUTE),2) +

    Util.fmt(gc.get(Calendar.SECOND),2);

    }

    else

    this.title = title;

    }

    ...

    add to util/Util.java:

    public static String fmt(int i, int w) {

    StringBuffer sb = new StringBuffer();

    while (w-- > 0) {

    sb.append( (char)('0' + (i % 10)) );

    i /= 10;

    }

    sb.reverse();

    return sb.toString();

    }

    --h

  3. I suspect one or more of the strings in Constants.java need to be updated, but I don't know how the original author sussed out these values in the first place.

    public static final String PARAM_ARTIST = "artist";

    public static final String PARAM_ALBUM = "album";

    public static final String PARAM_GENRE = "genre";

    public static final String PARAM_COMMENT = "comment";

    public static final String PARAM_YEAR = "year";

    public static final String PARAM_TITLE = "title";

    etc.

    --h

×
×
  • Create New...