public
Description: Mac OS X Last.fm scrobbler for iTunes and iPod
Homepage: http://www.scrobblepod.com
Clone URL: git://github.com/scrobblepod/scrobblepod.git
scrobblepod / BGAudioScrobblerXmlRpcParameter.m
100644 51 lines (40 sloc) 1.246 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// BGAudioScrobblerXmlRpcParameter.m
// ScrobblePod
//
// Created by Ben Gummer on 24/04/08.
// Copyright 2008 Ben Gummer. All rights reserved.
//
 
#import "BGAudioScrobblerXmlRpcParameter.h"
 
 
@implementation BGAudioScrobblerXmlRpcParameter
 
@synthesize parameter;
 
-(id)initWithParameter:(id)aParam {
self = [super init];
if (self != nil) {
self.parameter = aParam;
}
return self;
}
 
-(void)dealloc
{
self.parameter = nil;
[super dealloc];
}
 
 
-(NSString *)xmlDescription {
if ([[parameter className] isEqualToString:@"NSCFString"]) {
return [NSString stringWithFormat:@"<param><value><string>%@</string></value></param>",parameter];
} else if ([[parameter className] isEqualToString:@"NSCFArray"]) {
NSMutableString *outputString = [NSMutableString stringWithCapacity:200];
[outputString appendString:@"<param><value><array><data>"];
int i;
for (i = 0; i < [parameter count]; i++) {
[outputString appendFormat:@"<value><string>%@</string></value>",[parameter objectAtIndex:i]];
}
[outputString appendString:@"</data></array></value></param>"];
return outputString;
}
 
// Otherwise
NSLog(@"BGAudioScrobblerXmlRpcParameter: Unexpected Parameter Type: %@",[parameter className]);
return @"ERROR";
}
 
@end