Changeset 60
- Timestamp:
- 05/19/07 22:23:42 (2 years ago)
- Files:
-
- trunk/src/main/org/lastpod/DbReader.java (modified) (3 diffs)
- trunk/src/main/org/lastpod/History.java (modified) (1 diff)
- trunk/src/main/org/lastpod/Scrobbler.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/org/lastpod/DbReader.java
r56 r60 38 38 public class DbReader { 39 39 /** 40 * The location of the iTunes path. 41 */ 42 private String iTunesPath; 43 44 /** 40 45 * The location of the iTunes database file. 41 46 */ … … 92 97 } 93 98 99 this.iTunesPath = itunespath; 94 100 this.itunesfile = itunespath + "iTunesDB"; 95 101 this.playcountsfile = itunespath + "Play Counts"; … … 297 303 temptrack.setLastplayed(lastplayed - temptrack.getLength()); 298 304 299 if (History.getInstance( ).isInHistory(temptrack.getLastplayed())) {305 if (History.getInstance(iTunesPath).isInHistory(temptrack.getLastplayed())) { 300 306 temptrack.setActive(Boolean.FALSE); 301 307 } trunk/src/main/org/lastpod/History.java
r53 r60 64 64 * Singleton that reads the history file and creates this 65 65 * <code>History</code> object. 66 * @param iTunesPath The path to the iPod's iTunes DB. LastPod's history 67 * data will be stored there. 66 68 * @return This <code>History</code> object with a List of histories. 67 69 */ 68 public static History getInstance( ) {70 public static History getInstance(String iTunesPath) { 69 71 if (_instance == null) { 70 _instance = new History(new File(URL)); 72 if (iTunesPath == null) { 73 throw new RuntimeException("iTunes path was not supplied."); 74 } 75 76 if (!iTunesPath.endsWith(File.separator)) { 77 iTunesPath += File.separator; 78 } 79 80 _instance = new History(new File(iTunesPath + URL)); 71 81 _instance.read(); 72 82 } trunk/src/main/org/lastpod/Scrobbler.java
r57 r60 329 329 for (int i = 0; i < activeRecentPlayed.size(); i++) { 330 330 TrackItem track = (TrackItem) activeRecentPlayed.get(i); 331 History.getInstance( ).addhistory(track.getLastplayed());331 History.getInstance(null).addhistory(track.getLastplayed()); 332 332 } 333 333 … … 335 335 TrackItem track = (TrackItem) inactiveRecentPlayed.get(i); 336 336 337 if (History.getInstance( ).isInHistory(track.getLastplayed())) {338 History.getInstance( ).addhistory(track.getLastplayed());339 } 340 } 341 342 History.getInstance( ).write();337 if (History.getInstance(null).isInHistory(track.getLastplayed())) { 338 History.getInstance(null).addhistory(track.getLastplayed()); 339 } 340 } 341 342 History.getInstance(null).write(); 343 343 } 344 344
