Made playlist/cuesheet encoding a little more robust (Vasfed).
parent
2e44b9833e
commit
5ff84158cc
|
@ -98,8 +98,6 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
|
|||
amountRead += [self convert:dest + amountRead amount:amount - amountRead];
|
||||
}
|
||||
|
||||
NSLog(@"Amount read: %i/%i", amountRead, amount);
|
||||
|
||||
return amountRead;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,24 @@
|
|||
|
||||
- (void)parseFile:(NSString *)filename
|
||||
{
|
||||
NSStringEncoding encoding;
|
||||
NSError *error = nil;
|
||||
NSString *contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
|
||||
NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error];
|
||||
if (error) {
|
||||
NSLog(@"Trying UTF8");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Trying windows CP1251");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error];
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Trying latin1");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error];
|
||||
}
|
||||
if (error || !contents) {
|
||||
NSLog(@"Could not open file...%@ %@ %@", filename, contents, error);
|
||||
return;
|
||||
|
|
|
@ -68,11 +68,27 @@
|
|||
|
||||
NSString *filename = [url path];
|
||||
|
||||
NSStringEncoding encoding;
|
||||
NSError *error = nil;
|
||||
NSString *contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
|
||||
NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error];
|
||||
if (error) {
|
||||
NSLog(@"Trying UTF8");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Trying windows CP1251");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error];
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Trying latin1");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error];
|
||||
}
|
||||
if (error || !contents) {
|
||||
NSLog(@"Could not open file...%@ %@", contents, error);
|
||||
return NO;
|
||||
NSLog(@"Could not open file...%@ %@ %@", filename, contents, error);
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *entry;
|
||||
|
|
|
@ -70,9 +70,26 @@
|
|||
|
||||
NSString *filename = [url path];
|
||||
|
||||
NSStringEncoding encoding;
|
||||
NSError *error;
|
||||
NSString *contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
|
||||
NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error];
|
||||
if (error) {
|
||||
NSLog(@"Trying UTF8");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Trying windows CP1251");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error];
|
||||
}
|
||||
if (error) {
|
||||
NSLog(@"Trying latin1");
|
||||
error = nil;
|
||||
contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error];
|
||||
}
|
||||
if (error || !contents) {
|
||||
NSLog(@"Could not open file...%@ %@ %@", filename, contents, error);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue