69 lines
1.3 KiB
Objective-C
Executable File
69 lines
1.3 KiB
Objective-C
Executable File
//
|
|
// Mp3Lyrics.m
|
|
// iLyrics
|
|
//
|
|
// Created by Kim Wittenburg on 24.06.12.
|
|
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
|
//
|
|
|
|
#import "MP3Lyrics.h"
|
|
|
|
@implementation MP3Lyrics {
|
|
NSString *query;
|
|
NSString *firstPage;
|
|
int resultCount;
|
|
int loadedResults;
|
|
}
|
|
|
|
@synthesize enabled;
|
|
|
|
-(NSString *)name {
|
|
return @"MP3 Lyrics";
|
|
}
|
|
|
|
-(NSDate *)hosterVersion {
|
|
return [NSDate dateWithString:@"2012-06-24 15:00:00 +0100"];
|
|
}
|
|
|
|
-(void)startNewSearchForQuery:(NSString *)q {
|
|
query = [q stringByFormattingForURL];
|
|
int site = loadedResults;
|
|
NSString *searchPath = [NSString stringWithFormat:@"http://www.mp3lyrics.org/Search/%@%%7C%i", query, site];
|
|
NSURL *searchURL = [NSURL URLWithString:searchPath];
|
|
NSError *error;
|
|
firstPage = [NSString stringWithContentsOfURL:searchURL encoding:NSUTF8StringEncoding error:&error];
|
|
if (error || firstPage == nil) {
|
|
firstPage = nil;
|
|
return;
|
|
}
|
|
if ([firstPage rangeOfString:@"<div class=\"hit_list\">"].location == NSNotFound) {
|
|
resultCount = 0;
|
|
}
|
|
}
|
|
|
|
-(BOOL)hasMoreResults {
|
|
return loadedResults < resultCount;
|
|
}
|
|
|
|
-(NSArray *)nextResults {
|
|
|
|
}
|
|
|
|
-(BOOL)canShowInBrowser:(id)result {
|
|
|
|
}
|
|
|
|
-(void)showInBrowser:(id)result {
|
|
|
|
}
|
|
|
|
-(void)resetLoadedResults {
|
|
loadedResults = 0;
|
|
}
|
|
|
|
-(Lyrics *)lyricsBySearchResult:(id)result {
|
|
|
|
}
|
|
|
|
@end
|