Add basic application in order to perform the tasks
This commit is contained in:
		
							parent
							
								
									46d993d168
								
							
						
					
					
						commit
						8d5109d7de
					
				
					 9 changed files with 295 additions and 5 deletions
				
			
		
							
								
								
									
										29
									
								
								resources/epub-loader/app/action_db_load.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								resources/epub-loader/app/action_db_load.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| <?php | ||||
| /** | ||||
|  * Epub loader action: load ebooks into calibre databases | ||||
|  * | ||||
|  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) | ||||
|  * @author     Didier Corbière <didier.corbiere@opale-concept.com> | ||||
|  */ | ||||
| 
 | ||||
| foreach ($gConfig['databases'] as $dbConfig) { | ||||
| 	// Init database file
 | ||||
| 	$fileName = $dbConfig['db_path'] . DIRECTORY_SEPARATOR . 'metadata.db'; | ||||
| 	try { | ||||
| 		// Open or create the database
 | ||||
| 		$db = new CalibreDbLoader($fileName, $gConfig['create_db']); | ||||
| 		echo sprintf('Load database %s', $fileName) . '<br />'; | ||||
| 		// Add the epub files into the database
 | ||||
| 		if (!empty($dbConfig['epub_path'])) { | ||||
| 			$fileList = glob($dbConfig['epub_path'] . DIRECTORY_SEPARATOR . '*.epub'); | ||||
| 			foreach ($fileList as $fileName) { | ||||
| 				$db->AddEpub($fileName); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	catch (Exception $e) { | ||||
| 		$gErrorArray[$fileName] = $e->getMessage(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue