Merge lp:~urbanape/ubuntuone-ios-client/fix-auto-next into lp:ubuntuone-ios-client
- fix-auto-next
- Merge into trunk
Proposed by
Zachery Bir
Status: | Merged |
---|---|
Approved by: | Zachery Bir |
Approved revision: | 240 |
Merged at revision: | 193 |
Proposed branch: | lp:~urbanape/ubuntuone-ios-client/fix-auto-next |
Merge into: | lp:ubuntuone-ios-client |
Diff against target: |
368 lines (+56/-132) 10 files modified
musicstreaming/utilities/StreamingPlayer.m (+2/-2) musicstreaming/view_controllers/AlbumListViewController.m (+4/-28) musicstreaming/view_controllers/AlbumViewController.m (+0/-2) musicstreaming/view_controllers/ArtistListViewController.m (+4/-27) musicstreaming/view_controllers/ArtistViewController.m (+0/-2) musicstreaming/view_controllers/PlaylistListViewController.m (+15/-38) musicstreaming/view_controllers/PlaylistViewController.m (+0/-2) musicstreaming/view_controllers/SongListViewController.m (+4/-27) musicstreaming/view_controllers/SubsonicTableViewController.h (+4/-0) musicstreaming/view_controllers/SubsonicTableViewController.m (+23/-4) |
To merge this branch: | bzr merge lp:~urbanape/ubuntuone-ios-client/fix-auto-next |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jason Foreman (community) | Approve | ||
Review via email: mp+64888@code.launchpad.net |
Commit message
Description of the change
This fixes a bug in the behavior where we advance tracks at the end of a loop.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'musicstreaming/utilities/StreamingPlayer.m' | |||
2 | --- musicstreaming/utilities/StreamingPlayer.m 2011-05-13 08:07:05 +0000 | |||
3 | +++ musicstreaming/utilities/StreamingPlayer.m 2011-06-16 19:18:32 +0000 | |||
4 | @@ -253,7 +253,7 @@ | |||
5 | 253 | } | 253 | } |
6 | 254 | else | 254 | else |
7 | 255 | { | 255 | { |
9 | 256 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setPlayButtonImage) name:@"setPlayButtonImage" object:nil]; | 256 | self.isPlaying = NO; |
10 | 257 | [self destroyStreamer]; | 257 | [self destroyStreamer]; |
11 | 258 | } | 258 | } |
12 | 259 | } | 259 | } |
13 | @@ -294,7 +294,7 @@ | |||
14 | 294 | 294 | ||
15 | 295 | playlist = self.isShuffle ? [NSArray arrayWithArray:shufflePlaylist] : [NSArray arrayWithArray:currentPlaylist]; | 295 | playlist = self.isShuffle ? [NSArray arrayWithArray:shufflePlaylist] : [NSArray arrayWithArray:currentPlaylist]; |
16 | 296 | 296 | ||
18 | 297 | currentSong = [playlist objectAtIndex:0]; | 297 | self.currentSong = [playlist objectAtIndex:0]; |
19 | 298 | 298 | ||
20 | 299 | self.songUrl = [[Subsonic sharedSubsonic] getStreamingURLForSongId:self.currentSong.songId]; | 299 | self.songUrl = [[Subsonic sharedSubsonic] getStreamingURLForSongId:self.currentSong.songId]; |
21 | 300 | 300 | ||
22 | 301 | 301 | ||
23 | === modified file 'musicstreaming/view_controllers/AlbumListViewController.m' | |||
24 | --- musicstreaming/view_controllers/AlbumListViewController.m 2011-06-15 00:46:43 +0000 | |||
25 | +++ musicstreaming/view_controllers/AlbumListViewController.m 2011-06-16 19:18:32 +0000 | |||
26 | @@ -33,6 +33,10 @@ | |||
27 | 33 | + (UINavigationController *)navigableViewController | 33 | + (UINavigationController *)navigableViewController |
28 | 34 | { | 34 | { |
29 | 35 | AlbumListViewController *albumListViewController = [[[AlbumListViewController alloc] initWithTitle:NSLocalizedString(@"Albums", @"")] autorelease]; | 35 | AlbumListViewController *albumListViewController = [[[AlbumListViewController alloc] initWithTitle:NSLocalizedString(@"Albums", @"")] autorelease]; |
30 | 36 | AlbumListParser *parser = [[AlbumListParser alloc] init]; | ||
31 | 37 | albumListViewController.parserDelegate = parser; | ||
32 | 38 | albumListViewController.viewName = @"getAlbums.view"; | ||
33 | 39 | |||
34 | 36 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:albumListViewController] autorelease]; | 40 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:albumListViewController] autorelease]; |
35 | 37 | nav.navigationBar.barStyle = UIBarStyleBlack; | 41 | nav.navigationBar.barStyle = UIBarStyleBlack; |
36 | 38 | nav.tabBarItem.image = [UIImage imageNamed:@"albums"]; | 42 | nav.tabBarItem.image = [UIImage imageNamed:@"albums"]; |
37 | @@ -95,34 +99,6 @@ | |||
38 | 95 | } | 99 | } |
39 | 96 | 100 | ||
40 | 97 | 101 | ||
41 | 98 | - (void)beginLoadingRemoteData:(NSString*)force | ||
42 | 99 | { | ||
43 | 100 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
44 | 101 | |||
45 | 102 | NSURL *url = [[Subsonic sharedSubsonic] getBaseURL:@"getAlbums.view"]; | ||
46 | 103 | NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; | ||
47 | 104 | |||
48 | 105 | AlbumListParser *parser = [[AlbumListParser alloc] init]; | ||
49 | 106 | [xmlParser setDelegate:parser]; | ||
50 | 107 | |||
51 | 108 | if (![xmlParser parse]) | ||
52 | 109 | { | ||
53 | 110 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:[xmlParser parserError] waitUntilDone:NO]; | ||
54 | 111 | [xmlParser release]; | ||
55 | 112 | [parser release]; | ||
56 | 113 | [pool release]; | ||
57 | 114 | return; | ||
58 | 115 | } | ||
59 | 116 | |||
60 | 117 | [xmlParser release]; | ||
61 | 118 | [parser release]; | ||
62 | 119 | |||
63 | 120 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | ||
64 | 121 | [self performSelectorOnMainThread:@selector(finishLoadingData) withObject:nil waitUntilDone:NO]; | ||
65 | 122 | [pool release]; | ||
66 | 123 | } | ||
67 | 124 | |||
68 | 125 | |||
69 | 126 | - (void)updateReachability:(Reachability*)reachability; | 102 | - (void)updateReachability:(Reachability*)reachability; |
70 | 127 | { | 103 | { |
71 | 128 | [super updateReachability:reachability]; | 104 | [super updateReachability:reachability]; |
72 | 129 | 105 | ||
73 | === modified file 'musicstreaming/view_controllers/AlbumViewController.m' | |||
74 | --- musicstreaming/view_controllers/AlbumViewController.m 2011-06-15 00:46:43 +0000 | |||
75 | +++ musicstreaming/view_controllers/AlbumViewController.m 2011-06-16 19:18:32 +0000 | |||
76 | @@ -96,8 +96,6 @@ | |||
77 | 96 | if (error) | 96 | if (error) |
78 | 97 | { | 97 | { |
79 | 98 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:error waitUntilDone:NO]; | 98 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:error waitUntilDone:NO]; |
80 | 99 | [pool release]; | ||
81 | 100 | return; | ||
82 | 101 | } | 99 | } |
83 | 102 | 100 | ||
84 | 103 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | 101 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; |
85 | 104 | 102 | ||
86 | === modified file 'musicstreaming/view_controllers/ArtistListViewController.m' | |||
87 | --- musicstreaming/view_controllers/ArtistListViewController.m 2011-06-15 00:46:43 +0000 | |||
88 | +++ musicstreaming/view_controllers/ArtistListViewController.m 2011-06-16 19:18:32 +0000 | |||
89 | @@ -44,6 +44,10 @@ | |||
90 | 44 | + (UINavigationController *)navigableViewController | 44 | + (UINavigationController *)navigableViewController |
91 | 45 | { | 45 | { |
92 | 46 | ArtistListViewController *artistListViewController = [[[ArtistListViewController alloc] initWithTitle:NSLocalizedString(@"Artists", @"")] autorelease]; | 46 | ArtistListViewController *artistListViewController = [[[ArtistListViewController alloc] initWithTitle:NSLocalizedString(@"Artists", @"")] autorelease]; |
93 | 47 | ArtistListParser *parser = [[ArtistListParser alloc] init]; | ||
94 | 48 | artistListViewController.parserDelegate = parser; | ||
95 | 49 | artistListViewController.viewName = @"getIndexes.view"; | ||
96 | 50 | |||
97 | 47 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:artistListViewController] autorelease]; | 51 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:artistListViewController] autorelease]; |
98 | 48 | nav.navigationBar.barStyle = UIBarStyleBlack; | 52 | nav.navigationBar.barStyle = UIBarStyleBlack; |
99 | 49 | nav.tabBarItem.image = [UIImage imageNamed:@"artists"]; | 53 | nav.tabBarItem.image = [UIImage imageNamed:@"artists"]; |
100 | @@ -86,33 +90,6 @@ | |||
101 | 86 | [self.tableView reloadData]; | 90 | [self.tableView reloadData]; |
102 | 87 | } | 91 | } |
103 | 88 | 92 | ||
104 | 89 | - (void)beginLoadingRemoteData:(NSString*)force | ||
105 | 90 | { | ||
106 | 91 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
107 | 92 | |||
108 | 93 | NSURL *url = [[Subsonic sharedSubsonic] getBaseURL:@"getIndexes.view"]; | ||
109 | 94 | NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; | ||
110 | 95 | |||
111 | 96 | ArtistListParser *parser = [[ArtistListParser alloc] init]; | ||
112 | 97 | [xmlParser setDelegate:parser]; | ||
113 | 98 | |||
114 | 99 | if (![xmlParser parse]) | ||
115 | 100 | { | ||
116 | 101 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:[xmlParser parserError] waitUntilDone:NO]; | ||
117 | 102 | [xmlParser release]; | ||
118 | 103 | [parser release]; | ||
119 | 104 | [pool release]; | ||
120 | 105 | return; | ||
121 | 106 | } | ||
122 | 107 | |||
123 | 108 | [xmlParser release]; | ||
124 | 109 | [parser release]; | ||
125 | 110 | |||
126 | 111 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | ||
127 | 112 | [self performSelectorOnMainThread:@selector(finishLoadingData) withObject:nil waitUntilDone:NO]; | ||
128 | 113 | [pool release]; | ||
129 | 114 | } | ||
130 | 115 | |||
131 | 116 | - (void)updateReachability:(Reachability*)reachability; | 93 | - (void)updateReachability:(Reachability*)reachability; |
132 | 117 | { | 94 | { |
133 | 118 | [super updateReachability:reachability]; | 95 | [super updateReachability:reachability]; |
134 | 119 | 96 | ||
135 | === modified file 'musicstreaming/view_controllers/ArtistViewController.m' | |||
136 | --- musicstreaming/view_controllers/ArtistViewController.m 2011-06-16 16:52:07 +0000 | |||
137 | +++ musicstreaming/view_controllers/ArtistViewController.m 2011-06-16 19:18:32 +0000 | |||
138 | @@ -109,8 +109,6 @@ | |||
139 | 109 | if (error) | 109 | if (error) |
140 | 110 | { | 110 | { |
141 | 111 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:error waitUntilDone:NO]; | 111 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:error waitUntilDone:NO]; |
142 | 112 | [pool release]; | ||
143 | 113 | return; | ||
144 | 114 | } | 112 | } |
145 | 115 | 113 | ||
146 | 116 | [pool release]; | 114 | [pool release]; |
147 | 117 | 115 | ||
148 | === modified file 'musicstreaming/view_controllers/PlaylistListViewController.m' | |||
149 | --- musicstreaming/view_controllers/PlaylistListViewController.m 2011-06-15 16:49:27 +0000 | |||
150 | +++ musicstreaming/view_controllers/PlaylistListViewController.m 2011-06-16 19:18:32 +0000 | |||
151 | @@ -30,6 +30,10 @@ | |||
152 | 30 | + (UINavigationController *)navigableViewController | 30 | + (UINavigationController *)navigableViewController |
153 | 31 | { | 31 | { |
154 | 32 | PlaylistListViewController *playlistListViewController = [[[PlaylistListViewController alloc] initWithTitle:NSLocalizedString(@"Playlists", @"")] autorelease]; | 32 | PlaylistListViewController *playlistListViewController = [[[PlaylistListViewController alloc] initWithTitle:NSLocalizedString(@"Playlists", @"")] autorelease]; |
155 | 33 | PlaylistListParser *parser = [[PlaylistListParser alloc] init]; | ||
156 | 34 | playlistListViewController.parserDelegate = parser; | ||
157 | 35 | playlistListViewController.viewName = @"getPlaylists.view"; | ||
158 | 36 | |||
159 | 33 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:playlistListViewController] autorelease]; | 37 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:playlistListViewController] autorelease]; |
160 | 34 | nav.navigationBar.barStyle = UIBarStyleBlack; | 38 | nav.navigationBar.barStyle = UIBarStyleBlack; |
161 | 35 | nav.tabBarItem.image = [UIImage imageNamed:@"playlists"]; | 39 | nav.tabBarItem.image = [UIImage imageNamed:@"playlists"]; |
162 | @@ -42,17 +46,17 @@ | |||
163 | 42 | { | 46 | { |
164 | 43 | if ((self = [super initWithTitle:title])) | 47 | if ((self = [super initWithTitle:title])) |
165 | 44 | { | 48 | { |
177 | 45 | UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,40)]; | 49 | // UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,40)]; |
178 | 46 | header.autoresizingMask = UIViewAutoresizingFlexibleWidth; | 50 | // header.autoresizingMask = UIViewAutoresizingFlexibleWidth; |
179 | 47 | 51 | // | |
180 | 48 | UIButton *createButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; | 52 | // UIButton *createButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; |
181 | 49 | createButton.frame = CGRectMake(5, 5, 310, 30); | 53 | // createButton.frame = CGRectMake(5, 5, 310, 30); |
182 | 50 | [createButton setTitle:NSLocalizedString(@"Create new playlist", @"") forState:UIControlStateNormal]; | 54 | // [createButton setTitle:NSLocalizedString(@"Create new playlist", @"") forState:UIControlStateNormal]; |
183 | 51 | [createButton addTarget:self action:@selector(createNewPlaylist) forControlEvents:UIControlEventTouchUpInside]; | 55 | // [createButton addTarget:self action:@selector(createNewPlaylist) forControlEvents:UIControlEventTouchUpInside]; |
184 | 52 | [header addSubview:createButton]; | 56 | // [header addSubview:createButton]; |
185 | 53 | 57 | // | |
186 | 54 | self.tableView.tableHeaderView = header; | 58 | // self.tableView.tableHeaderView = header; |
187 | 55 | [header release]; | 59 | // [header release]; |
188 | 56 | } | 60 | } |
189 | 57 | return self; | 61 | return self; |
190 | 58 | } | 62 | } |
191 | @@ -71,33 +75,6 @@ | |||
192 | 71 | [self.tableView reloadData]; | 75 | [self.tableView reloadData]; |
193 | 72 | } | 76 | } |
194 | 73 | 77 | ||
195 | 74 | - (void)beginLoadingRemoteData:(NSString*)force | ||
196 | 75 | { | ||
197 | 76 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
198 | 77 | |||
199 | 78 | NSURL *url = [[Subsonic sharedSubsonic] getBaseURL:@"getPlaylists.view"]; | ||
200 | 79 | NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; | ||
201 | 80 | |||
202 | 81 | PlaylistListParser *parser = [[PlaylistListParser alloc] init]; | ||
203 | 82 | [xmlParser setDelegate:parser]; | ||
204 | 83 | |||
205 | 84 | if (![xmlParser parse]) | ||
206 | 85 | { | ||
207 | 86 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:[xmlParser parserError] waitUntilDone:NO]; | ||
208 | 87 | [xmlParser release]; | ||
209 | 88 | [parser release]; | ||
210 | 89 | [pool release]; | ||
211 | 90 | return; | ||
212 | 91 | } | ||
213 | 92 | |||
214 | 93 | [xmlParser release]; | ||
215 | 94 | [parser release]; | ||
216 | 95 | |||
217 | 96 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | ||
218 | 97 | [self performSelectorOnMainThread:@selector(finishLoadingData) withObject:nil waitUntilDone:NO]; | ||
219 | 98 | [pool release]; | ||
220 | 99 | } | ||
221 | 100 | |||
222 | 101 | #pragma mark - UITableView | 78 | #pragma mark - UITableView |
223 | 102 | 79 | ||
224 | 103 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | 80 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section |
225 | 104 | 81 | ||
226 | === modified file 'musicstreaming/view_controllers/PlaylistViewController.m' | |||
227 | --- musicstreaming/view_controllers/PlaylistViewController.m 2011-06-15 16:49:27 +0000 | |||
228 | +++ musicstreaming/view_controllers/PlaylistViewController.m 2011-06-16 19:18:32 +0000 | |||
229 | @@ -98,8 +98,6 @@ | |||
230 | 98 | if (error) | 98 | if (error) |
231 | 99 | { | 99 | { |
232 | 100 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:error waitUntilDone:NO]; | 100 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:error waitUntilDone:NO]; |
233 | 101 | [pool release]; | ||
234 | 102 | return; | ||
235 | 103 | } | 101 | } |
236 | 104 | 102 | ||
237 | 105 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | 103 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; |
238 | 106 | 104 | ||
239 | === modified file 'musicstreaming/view_controllers/SongListViewController.m' | |||
240 | --- musicstreaming/view_controllers/SongListViewController.m 2011-06-15 00:46:43 +0000 | |||
241 | +++ musicstreaming/view_controllers/SongListViewController.m 2011-06-16 19:18:32 +0000 | |||
242 | @@ -31,6 +31,10 @@ | |||
243 | 31 | + (UINavigationController *)navigableViewController | 31 | + (UINavigationController *)navigableViewController |
244 | 32 | { | 32 | { |
245 | 33 | SongListViewController *songListViewController = [[[SongListViewController alloc] initWithTitle:NSLocalizedString(@"Songs", @"")] autorelease]; | 33 | SongListViewController *songListViewController = [[[SongListViewController alloc] initWithTitle:NSLocalizedString(@"Songs", @"")] autorelease]; |
246 | 34 | SongListParser *parser = [[SongListParser alloc] init]; | ||
247 | 35 | songListViewController.parserDelegate = parser; | ||
248 | 36 | songListViewController.viewName = @"getSongs.view"; | ||
249 | 37 | |||
250 | 34 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:songListViewController] autorelease]; | 38 | UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:songListViewController] autorelease]; |
251 | 35 | nav.navigationBar.barStyle = UIBarStyleBlack; | 39 | nav.navigationBar.barStyle = UIBarStyleBlack; |
252 | 36 | nav.tabBarItem.image = [UIImage imageNamed:@"songs"]; | 40 | nav.tabBarItem.image = [UIImage imageNamed:@"songs"]; |
253 | @@ -76,33 +80,6 @@ | |||
254 | 76 | [self.tableView reloadData]; | 80 | [self.tableView reloadData]; |
255 | 77 | } | 81 | } |
256 | 78 | 82 | ||
257 | 79 | - (void)beginLoadingRemoteData:(NSString*)force | ||
258 | 80 | { | ||
259 | 81 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
260 | 82 | |||
261 | 83 | NSURL *url = [[Subsonic sharedSubsonic] getBaseURL:@"getSongs.view"]; | ||
262 | 84 | NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; | ||
263 | 85 | |||
264 | 86 | SongListParser *parser = [[SongListParser alloc] init]; | ||
265 | 87 | [xmlParser setDelegate:parser]; | ||
266 | 88 | |||
267 | 89 | if (![xmlParser parse]) | ||
268 | 90 | { | ||
269 | 91 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:[xmlParser parserError] waitUntilDone:NO]; | ||
270 | 92 | [xmlParser release]; | ||
271 | 93 | [parser release]; | ||
272 | 94 | [pool release]; | ||
273 | 95 | return; | ||
274 | 96 | } | ||
275 | 97 | |||
276 | 98 | [xmlParser release]; | ||
277 | 99 | [parser release]; | ||
278 | 100 | |||
279 | 101 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | ||
280 | 102 | [self performSelectorOnMainThread:@selector(finishLoadingData) withObject:nil waitUntilDone:NO]; | ||
281 | 103 | [pool release]; | ||
282 | 104 | } | ||
283 | 105 | |||
284 | 106 | - (void)updateReachability:(Reachability *)reachability | 83 | - (void)updateReachability:(Reachability *)reachability |
285 | 107 | { | 84 | { |
286 | 108 | [super updateReachability:reachability]; | 85 | [super updateReachability:reachability]; |
287 | 109 | 86 | ||
288 | === modified file 'musicstreaming/view_controllers/SubsonicTableViewController.h' | |||
289 | --- musicstreaming/view_controllers/SubsonicTableViewController.h 2011-06-15 00:46:43 +0000 | |||
290 | +++ musicstreaming/view_controllers/SubsonicTableViewController.h 2011-06-16 19:18:32 +0000 | |||
291 | @@ -32,6 +32,8 @@ | |||
292 | 32 | NSTimer *respondToRemoteTimer; | 32 | NSTimer *respondToRemoteTimer; |
293 | 33 | NSMutableArray *tableData; | 33 | NSMutableArray *tableData; |
294 | 34 | NSMutableArray *searchResults; | 34 | NSMutableArray *searchResults; |
295 | 35 | id <NSXMLParserDelegate> parserDelegate; | ||
296 | 36 | NSString *viewName; | ||
297 | 35 | 37 | ||
298 | 36 | @protected | 38 | @protected |
299 | 37 | BOOL canStream; | 39 | BOOL canStream; |
300 | @@ -64,6 +66,8 @@ | |||
301 | 64 | 66 | ||
302 | 65 | @property(nonatomic,retain) NSMutableArray *tableData; | 67 | @property(nonatomic,retain) NSMutableArray *tableData; |
303 | 66 | @property(nonatomic,retain) NSMutableArray *searchResults; | 68 | @property(nonatomic,retain) NSMutableArray *searchResults; |
304 | 69 | @property(nonatomic,assign) id<NSXMLParserDelegate> parserDelegate; | ||
305 | 70 | @property(nonatomic,retain) NSString *viewName; | ||
306 | 67 | 71 | ||
307 | 68 | extern NSString * const NOTIF_reloadAccountCredentials; | 72 | extern NSString * const NOTIF_reloadAccountCredentials; |
308 | 69 | extern NSString * const NOTIF_removeCachedContent; | 73 | extern NSString * const NOTIF_removeCachedContent; |
309 | 70 | 74 | ||
310 | === modified file 'musicstreaming/view_controllers/SubsonicTableViewController.m' | |||
311 | --- musicstreaming/view_controllers/SubsonicTableViewController.m 2011-06-16 17:56:08 +0000 | |||
312 | +++ musicstreaming/view_controllers/SubsonicTableViewController.m 2011-06-16 19:18:32 +0000 | |||
313 | @@ -35,6 +35,7 @@ | |||
314 | 35 | 35 | ||
315 | 36 | @implementation SubsonicTableViewController | 36 | @implementation SubsonicTableViewController |
316 | 37 | @synthesize tableData, searchResults; | 37 | @synthesize tableData, searchResults; |
317 | 38 | @synthesize parserDelegate, viewName; | ||
318 | 38 | @synthesize hasLoadedRemoteData; | 39 | @synthesize hasLoadedRemoteData; |
319 | 39 | 40 | ||
320 | 40 | #pragma mark - Initialization | 41 | #pragma mark - Initialization |
321 | @@ -50,7 +51,10 @@ | |||
322 | 50 | self.title = title; | 51 | self.title = title; |
323 | 51 | self.tableData = [NSMutableArray array]; | 52 | self.tableData = [NSMutableArray array]; |
324 | 52 | self.searchResults = [NSMutableArray array]; | 53 | self.searchResults = [NSMutableArray array]; |
325 | 54 | self.parserDelegate = nil; | ||
326 | 55 | self.viewName = nil; | ||
327 | 53 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetTableData:) name:NOTIF_removeCachedContent object:nil]; | 56 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetTableData:) name:NOTIF_removeCachedContent object:nil]; |
328 | 57 | |||
329 | 54 | } | 58 | } |
330 | 55 | return self; | 59 | return self; |
331 | 56 | } | 60 | } |
332 | @@ -270,10 +274,23 @@ | |||
333 | 270 | 274 | ||
334 | 271 | - (void)beginLoadingRemoteData:(NSString*)force | 275 | - (void)beginLoadingRemoteData:(NSString*)force |
335 | 272 | { | 276 | { |
340 | 273 | //Starts with an NSAutoreleasePool | 277 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
341 | 274 | //Loads data either from CoreData or from an XML feed. If force == @"YES" | 278 | |
342 | 275 | //Release the pool | 279 | NSURL *url = [[Subsonic sharedSubsonic] getBaseURL:self.viewName]; |
343 | 276 | //Call finishLoadingData on the main thread. | 280 | NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; |
344 | 281 | |||
345 | 282 | [xmlParser setDelegate:self.parserDelegate]; | ||
346 | 283 | |||
347 | 284 | if (![xmlParser parse]) | ||
348 | 285 | { | ||
349 | 286 | [self performSelectorOnMainThread:@selector(failedLoadingData:) withObject:[xmlParser parserError] waitUntilDone:NO]; | ||
350 | 287 | } | ||
351 | 288 | |||
352 | 289 | [xmlParser release]; | ||
353 | 290 | |||
354 | 291 | [self performSelectorOnMainThread:@selector(loadLocalData) withObject:nil waitUntilDone:NO]; | ||
355 | 292 | [self performSelectorOnMainThread:@selector(finishLoadingData) withObject:nil waitUntilDone:NO]; | ||
356 | 293 | [pool release]; | ||
357 | 277 | } | 294 | } |
358 | 278 | 295 | ||
359 | 279 | - (void)finishLoadingData | 296 | - (void)finishLoadingData |
360 | @@ -418,6 +435,8 @@ | |||
361 | 418 | { | 435 | { |
362 | 419 | [[NSNotificationCenter defaultCenter] removeObserver:self]; | 436 | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
363 | 420 | [hudView hide:NO]; | 437 | [hudView hide:NO]; |
364 | 438 | RELEASE_SAFELY(parserDelegate); | ||
365 | 439 | RELEASE_SAFELY(viewName); | ||
366 | 421 | RELEASE_SAFELY(hudView); | 440 | RELEASE_SAFELY(hudView); |
367 | 422 | RELEASE_SAFELY(tableData); | 441 | RELEASE_SAFELY(tableData); |
368 | 423 | RELEASE_SAFELY(searchResults); | 442 | RELEASE_SAFELY(searchResults); |
Looks good!