View Single Post
Old 02-14-2009, 12:56 PM   #53
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
Help! I want to create a PHP script that returns just the cleaned-up html output of the story. How do I go about doing that?

For example:

URL
Quote:
http://localhost/getstory.php?source=ffnet&storyid=1234567
I assume I'll have to create a getstory.php based on a modified fflag? Not exactly sure how I go about modifying fflag, though. Also, some modules (e.g. ffnet.source.php) display status messages. I assume I just need to comment out all printMsg lines from those modules?

EDIT:
Nevermind, got it working. Just had to edit two sections in the main fflag program. Didn't even need to touch any of the other modules. Additions in green, deletions in red.
Code:

	//Config
	require_once('inc/args.inc.php');
	//$config = getCliArgs();
	$config['source'] = $_GET['source'];
	$config['format'] = 'html';
	$config['storyid'] = $_GET['storyid'];

	//Output the compiled file if it the story is valid
	if ($story['meta']['title'] != "") {

		//Output file
		echo $output;

		/*
		//Create the file name
		if (!isset($config['outfile']) || $config['outfile'] == '-') $config['outfile'] = getBaseFilename($story) . ".{$config['format']}";
		
		//Output the file
		printMsg("\t* Writing output to {$config['outfile']}...\n");
		file_put_contents($config['outfile'], $output);
		*/
Oh yeah, just had a root canal so I had a bit of free time today. Just putting the finishing touches on a SugarQuill source.php and it'll be ready for posting.

Alas, porting the ffnet source to a Calibre/Python recipe is taking much longer. I have a working recipe used in conjuction with a local Apache+PHP server (that's the reason why I needed variable passing via URL) but converting the chapter retrieval and page cleaning logic to Python escapes me.

Last edited by ilovejedd; 02-17-2009 at 07:52 PM.
ilovejedd is offline   Reply With Quote