Changeset 85
- Timestamp:
- 12/23/07 00:02:28 (3 years ago)
- Files:
-
- trunk/src/main/org/lastpod/ModelImpl.java (modified) (1 diff)
- trunk/src/main/org/lastpod/Scrobbler.java (modified) (5 diffs)
- trunk/src/test/org/lastpod/MockModel.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/org/lastpod/ModelImpl.java
r82 r85 158 158 scrobbler.setChunkProgress(userInterface); 159 159 scrobbler.setTracksToSubmit(activeRecentPlayed); 160 scrobbler.addInactiveToHistories(inactiveRecentPlayed); 160 161 scrobbler.handshake(); 161 162 scrobbler.submitTracks(); 162 scrobbler.addHistories(activeRecentPlayed, inactiveRecentPlayed);163 163 164 164 /* Refresh track list. */ trunk/src/main/org/lastpod/Scrobbler.java
r77 r85 272 272 queryString += buildTrackQueryString(track, tracknum); 273 273 274 /* Unselect the submitted track. */275 track.setActive(Boolean.FALSE);276 274 tracknum++; 277 275 } … … 309 307 throw new RuntimeException("Unknown error submitting tracks"); 310 308 } 309 310 /* The chunk is successfully written to last.fm. Makes sure the 311 * tracks are marked as inactive. Writes the history file. 312 * This is done after each chunk because if the next chunk fails 313 * the history file should reflect where the failure occurred. 314 */ 315 for (int j = 0; j < chunk.getChunkSize(); j++) { 316 TrackItem track = (TrackItem) chunk.getContent().get(j); 317 track.setActive(Boolean.FALSE); 318 } 319 320 addHistories(chunk.getContent()); 311 321 312 322 /* Add 2 to progress. 1 because chunk progress starts at 1, whereas … … 381 391 * Creates the histories and writes them to a file. 382 392 * @param activeRecentPlayed The list of active recently played tracks. 383 * @param inactiveRecentPlayed The list of inactive recently played tracks. 384 */ 385 public void addHistories(List activeRecentPlayed, List inactiveRecentPlayed) { 393 */ 394 public void addHistories(List activeRecentPlayed) { 386 395 for (int i = 0; i < activeRecentPlayed.size(); i++) { 387 396 TrackItem track = (TrackItem) activeRecentPlayed.get(i); … … 389 398 } 390 399 400 History.getInstance(null).write(); 401 } 402 403 /** 404 * Adds inactive recent played tracks to the histories file. This is done 405 * so they will be preserved in the histories. 406 * @param inactiveRecentPlayed The list of inactive recently played tracks. 407 */ 408 public void addInactiveToHistories(List inactiveRecentPlayed) { 391 409 for (int i = 0; i < inactiveRecentPlayed.size(); i++) { 392 410 TrackItem track = (TrackItem) inactiveRecentPlayed.get(i); … … 396 414 } 397 415 } 398 399 History.getInstance(null).write();400 416 } 401 417 trunk/src/test/org/lastpod/MockModel.java
r82 r85 213 213 214 214 Scrobbler scrobbler = new Scrobbler(null, null, null); 215 scrobbler.addHistories(activeRecentPlayed, inactiveRecentPlayed); 215 scrobbler.addInactiveToHistories(inactiveRecentPlayed); 216 scrobbler.addHistories(activeRecentPlayed); 216 217 userInterface.setCompletionStatus(true); 217 218
