Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ilyrics/iLyrics/MP3Lyrics.m
Kim Wittenburg 221b43e29f Archive Project
2017-07-25 16:38:32 +02:00

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