- - (void)setCellData:(NSIndexPath *)fp8 {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSDictionary *cacheDict;
- if ([cacheFromDisk objectForKey:NUMBER(fp8.row)] != nil) {
- cacheDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
- [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftAlbumName"], @"LeftAlbumName",
- [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftArtistName"], @"LeftArtistName",
- [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftCoverImage"], @"LeftCoverImage",
- [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"RightAlbumName"], @"RightAlbumName",
- [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"RightArtistName"], @"RightArtistName",
- [[cacheFromDisk objectForKey:NUMBER(fp8.row)] objectForKey:@"RightCoverImage"], @"RightCoverImage", nil] autorelease];
- }
- else {
- cacheDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
- [self albumNameForItemAtIndex:fp8.row*2], @"LeftAlbumName",
- [self albumArtistForItemAtIndex:fp8.row*2], @"LeftArtistName",
- [self artworkImageAtIndex:fp8.row*2], @"LeftCoverImage",
- [self albumNameForItemAtIndex:fp8.row*2+1], @"RightAlbumName",
- [self albumArtistForItemAtIndex:fp8.row*2+1], @"RightArtistName",
- [self artworkImageAtIndex:fp8.row*2+1], @"RightCoverImage", nil] autorelease];
- }
- NSDictionary *infoDict = [[[NSDictionary alloc] initWithObjectsAndKeys:
- NUMBER(fp8.row), @"WhereToCache",
- cacheDict, @"WhatToCache", nil] autorelease];
- [self performSelectorOnMainThread:@selector(saveDictioneryToCache:) withObject:infoDict waitUntilDone:YES];
- CDLibraryTableViewCell *cell = (CDLibraryTableViewCell *)[self.tableView cellForRowAtIndexPath:fp8];
- cell.leftAlbumName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftAlbumName"];
- cell.leftArtistName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftArtistName"];
- cell.rightCoverImage = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"LeftCoverImage"];
- cell.rightAlbumName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"RightAlbumName"];
- cell.rightArtistName = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"RightArtistName"];
- cell.rightCoverImage = [[cache objectForKey:NUMBER(fp8.row)] objectForKey:@"RightCoverImage"];
- [cell updateCell];
- if (fp8.row == 0)
- [self.tableView reloadData];
- if (fp8.row == rowsInTable-1)
- [self saveCacheToDisk];
- [pool release];
- }