I would use the string methods. The NSPredicate is powerful, but since you want to do a replace. I would go straight for the replaceOccurrencesOfString: method.
Stack as many of those in a row, there is no point in using the rangeOfString: to then determine if you are going to remove the same section. It's quite likely that internally replaceOccurrencesOfString: uses rangeOfString: method.
That's why you wrote *pedias and I just wrote small VisualBasic routine!
I was going for the while loop in order to remove ALL of the occurrences of a given string and probably I didn't find this method because i was looking on the NSString class (hope I'm using right terms).
What do you think on substituting double spaces with single one (so, in case of an even number of spaces we will remain with just one)?
Your going to need the "while" loop to run the replace a number of times until there are no double spaces. The replaceOccurrencesOfString: returns the number of replacements that took place, so adding it to a while loop is enough.
while ([cleanString replaceOccurrencesOfString:@"\n\n" withString:@"\n" options:NSLiteralSearch range:NSMakeRange(0, [cleanString length])] != 0);
The "!= 0" is not needed and can be implicit, but I put it in to make clear what is happening.
Your doing really well for recently diving into Cocoa and objective-C. It's a documentation heavy language as there is so much to it. Inheritance is one of the tricky parts to remember. That an object might respond to more messages than are in NSString, that it might be a subset or that it has parents that have more methods. Speaking of NSMutableString, make sure to turn the string you pass into the method into a NSMutableString if necessary, just like the other clean method.
Here I am...again!
First I would like to ask what do you think about assumptions (hope the online dictionary works well). I mean that I put on the plugin some code to convert video format to uppercase (so we will always have PAL and NTSC) and even to convert to uppercase media type if string length <= 3 (DVD, HD or BD but not blu-ray).
Secondly I have a little problem with actors code
//Cast
NSString *castSection = [results stringBetween:@">Cast:" and:@"ShowCast"];
NSArray *credits = [castSection stringsBetween:@"sottolinguette href='/tvweb/appli" and:@"</"]; //notice plural of 'strings' returns a list of strings
NSMutableArray *creditsArray = [NSMutableArray array]; //To hold our credit information
NSEnumerator *creditsEnum = [credits objectEnumerator];
NSString *nextPerson;
while (nextPerson = [creditsEnum nextObject]) {
nextPerson = [nextPerson stringBetween:@">" and:@"</a"]; //remove URL part
NSMutableDictionary *oneCredit = [NSMutableDictionary dictionary];
[oneCredit setValue:nextPerson forKey:@"name"];
// [oneCredit setValue:nextRole forKey:@"role"]; //if there was a role it would be added here to the dictionary
[creditsArray addObject:oneCredit];
}
if ([creditsArray count])
[returnData setValue:creditsArray forKey:@"creditsSet"];
Conor wrote:I have to update the constant.h but the real key for credits is just "credits" without the "Set", sorry about that old information. It should be:
James23 wrote:The file constant.h will give a list of all the keys you can use to pass data in, but they are mostly what you would expect.
That's almost true...
Conor sent me a plug-in skeleton and I just had to write code to extract data but the constants.h file was not updated (that's why I asked about creditsSet, the constat in the header file...).
I too would like a new sight added to search, but even after reading the instructions you offer to do this, it is just not in my skill set. Anyone open to doing this and making it available? The sight I want to add for searches is DVDEmpire.com. Before I started using DVDpedia, I was using another program that had them in the search options. Certainly Amazon and imdb are the best, but there just are those times when DVDEmpire had a better cover or summary.