Skip to content

Commit

Permalink
Support command and atom changes in latest AtomicParsley
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcintyre authored and Jared McIntyre committed Nov 26, 2024
1 parent ae7d4bf commit b565707
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions Plugins/AtomicParsley/src/AtomicParsleyPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ - (id)init
//@"contentRating",
@"genre",
/*@"album", @"albumArtist",*/ @"purchaseDate", @"description",
@"longDescription",
@"longdesc",
@"TVShowName", @"TVEpisode",
@"TVSeasonNum", @"TVEpisodeNum", @"TVNetwork", @"podcastURL",
@"podcastGUID",@"category", @"keyword", @"advisory",
Expand Down Expand Up @@ -466,13 +466,33 @@ - (void)parseData:(NSData *)data withFileName:(NSString *)fileName dict:(NSMutab
NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithCapacity:[atoms count]];
for(NSString* atom in atoms)
{
NSRange split = [atom rangeOfString:@"\" contains: "];
if(split.location == NSNotFound)
continue;
NSString* type = [atom substringToIndex:split.location];
NSString* content = [[atom substringFromIndex:split.location+split.length]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[dict setObject:content forKey:type];
// Example reverse dns:
// ----" [com.apple.iTunes;iTunEXTC] contains: mpaa|PG-13|300|
if( atom.length > 7 && [[atom substringToIndex:7] compare:@"----\" ["] == NSOrderedSame )
{
NSRange split = [atom rangeOfString:@"] contains: "];
if( split.location != NSNotFound )
{
NSRange typeRange = {7, split.location - 7};
NSString* type = [atom substringWithRange:typeRange];
NSString* content = [[atom substringFromIndex:split.location+split.length]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[dict setObject:content forKey:type];
}
}
// Example standard:
// gnre" contains: Comedy
else
{
NSRange split = [atom rangeOfString:@"\" contains: "];
if( split.location != NSNotFound )
{
NSString* type = [atom substringToIndex:split.location];
NSString* content = [[atom substringFromIndex:split.location+split.length]
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[dict setObject:content forKey:type];
}
}
}

// Initialize a null value for all known keys
Expand Down

0 comments on commit b565707

Please sign in to comment.