Quote:
Originally Posted by erayd
Thanks :-). To create the diff, just have the folder for each version side-by-side and run any kind of program over them than can generate standard diff/patch output on them. On Linux I'd usually use the command 'diff', or use subversion's diff command. Not sure about Windows - I know there are several, but I wouldn't know what they're called sorry.
As far as the working on Linux bit goes, don't worry about that - half the reason I want a diff is so I can debug things as I merge it.
|
Hmm, just this once, how about I send you a zip of the full working directory (from clean source)? Should only take me a couple of days to do. Notepad++ doesn't seem to do diffs at the moment and I don't want to waste time installing and learning new software if it's something that's quick and easy for you to do now. After that, I'll experiment on subversion software on the virtual machine so I can just send you diffs in the future.
Ugh. I know I promised I'd clean up the source and stuff but it's just too frakkin hot to think (98F here in SoCal). In the meantime, here's a quick band-aid for ffnet.source.php. Again, this one's messy as hell and contains redundant code here and there but it should work...
PHP Code:
<?php
function ffnet_source_info() {
return "\tFetches stories from fanfiction.net";
}
function ffnet_get_story($storyid, $meta = true) {
$ffurl = 'www.fanfiction.net';
$story['source'] = $ffurl;
$ffurl = 'http://' . $ffurl;
//get initial info
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'FLAG/1.0 (Fanfiction.net Lightweight Automated Grabber)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_URL, "$ffurl/s/$storyid/1");
$story['pages'][1] = curl_exec($ch);
//extract metadata
$story['meta'] = ffnet_get_meta($story['pages'][1], $meta);
//fetch remaining pages
if(!$meta) {
if(isset($story['meta']['chapters'])) {
foreach($story['meta']['chapters'] as $key => $chaptitle) {
if(!isset($story['pages'][$key])) {
curl_setopt($ch, CURLOPT_URL, "$ffurl/s/$storyid/$key");
$story['pages'][$key] = curl_exec($ch);
}
}
}
else $story['meta']['chapters'][1] = $story['meta']['title'];
//clean pages
foreach($story['pages'] as &$currpage) {
preg_match("/<!-- start story -->(.+)<!-- end story -->/Usi", $currpage, $matches);
$currpage = $matches[1];
}
}
return $story;
}
function ffnet_get_meta($page, $nochapters) {
$matches = array();
//category and title
if (preg_match('/.*<a href.+>.+Crossover<\/a> »/Ui', $page, $matches)) {
preg_match('/.*<a href.+>(.+) Crossover<\/a> » <b>(.+)<\/b>/Ui', $page, $matches);
$matches[1] = str_ireplace(',', '', $matches[1]);
$tag = str_ireplace(' and ', ',', $matches[1]);
}
else preg_match('/.+ » <a href=.+>(.+)<\/a> » <b>(.+)<\/b>/Ui', $page, $matches);
//author
preg_match("/<a href='\/u\/[0-9]+\/.+'>(.+)<\/a>/Ui", $page, $author);
$meta['title'] = $matches[2];
$meta['author'] = $author[1];
$meta['category'] = $matches[1];
$meta['crosscat'] = $tag;
//rating, lang, category
preg_match("/Rated: <a href='http:\/\/www.fictionratings.com\/guide.php' target='rating'> (.+)<\/a> - (.+) - (.+)( - Reviews: <a href='.+'>[0-9]+<\/a>)?( - Updated: ([0-9-]+))? - Published: ([0-9-]+) (- (Complete)+ )?- id:([0-9]+) /Ui", $page, $matches);
$meta['rating'] = $matches[1];
$meta['language'] = $matches[2];
$meta['genre'] = $matches[3];
$meta['date_pub'] = $matches[7];
$meta['date_update'] = $matches[6];
$meta['complete'] = $matches[9] == 'Complete' ? true : false;
$meta['ficstatus'] = $matches[9] == 'Complete' ? 'Complete' : 'In-Progress';
$meta['id'] = $matches[10];
//description
preg_match('/<meta name="description" content="(.+), (.+)(, pairing: (.+))?, (.+)">/Ui', $page, $matches);
$meta['category2'] = $matches[1];
$meta['genre2'] = $matches[2];
$meta['char'] = $matches[4];
$meta['summary'] = $matches[5];
$meta['summary'] = iconv('UTF-8', 'ISO-8859-15//TRANSLIT//IGNORE', $meta['summary']);
//chapters
if($nochapters){
if(preg_match("/<SELECT title='chapter navigation' Name=chapter onChange=\".+\">(<option.+)<\/select>/Ui", $page, $matches)) {
preg_match_all("/<option value=[0-9]+ (selected)?>([0-9]+). (.+)(?=<option|$)/Ui", $matches[1], $matches);
foreach($matches[2] as $key => $chapnum) $chaparr = $chapnum;
$meta['chapters'] = $chaparr;
}
}
else {
if(preg_match("/<SELECT title='chapter navigation' Name=chapter onChange=\".+\">(<option.+)<\/select>/Ui", $page, $matches)) {
preg_match_all("/<option value=[0-9]+ (selected)?>([0-9]+). (.+)(?=<option|$)/Ui", $matches[1], $matches);
foreach($matches[2] as $key => $chapnum) $chaparr[$chapnum] = $matches[3][$key];
$meta['chapters'] = $chaparr;
}
}
return $meta;
}
?>