Add epub loader resource
This commit is contained in:
parent
fd774948fb
commit
987d73ccb8
7 changed files with 1387 additions and 0 deletions
65
resources/epub-loader/BookInfos.class.php
Normal file
65
resources/epub-loader/BookInfos.class.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* BookInfos class
|
||||
*
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
* @author Didier Corbière <didier.corbiere@opale-concept.com>
|
||||
*/
|
||||
|
||||
require_once(realpath(dirname(__FILE__)) . '/ZipFile.class.php');
|
||||
require_once(realpath(dirname(dirname(__FILE__))) . '/php-epub-meta/epub.php');
|
||||
|
||||
/**
|
||||
* BookInfos class contains informations about a book,
|
||||
* and methods to load this informations from multiple sources (eg epub file)
|
||||
*/
|
||||
class BookInfos
|
||||
{
|
||||
public $mPath = '';
|
||||
public $mName = '';
|
||||
public $mFormat = '';
|
||||
public $mUuid = '';
|
||||
public $mUri = '';
|
||||
public $mTitle = '';
|
||||
public $mTitleSort = '';
|
||||
public $mAuthors = null;
|
||||
public $mLanguage = '';
|
||||
public $mDescription = '';
|
||||
public $mSubjects = null;
|
||||
public $mCover = '';
|
||||
public $mSerie = '';
|
||||
public $mSerieIndex = '';
|
||||
|
||||
/**
|
||||
* Loads book infos from an epub file
|
||||
*
|
||||
* @param string Epub full file name
|
||||
* @throws Exception if error
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function LoadFromEpub($inFileName)
|
||||
{
|
||||
// Load the epub file
|
||||
$epub = new EPub($inFileName, 'ZipFile');
|
||||
|
||||
// Get the epub infos
|
||||
$this->mFormat = 'epub';
|
||||
$this->mPath = pathinfo($inFileName, PATHINFO_DIRNAME);
|
||||
$this->mName = pathinfo($inFileName, PATHINFO_FILENAME);
|
||||
$this->mUuid = $epub->Uuid();
|
||||
$this->mUri = $epub->Uri();
|
||||
$this->mTitle = $epub->Title();
|
||||
$this->mTitleSort = $this->mTitle; // Use title for now
|
||||
$this->mAuthors = $epub->Authors();
|
||||
$this->mLanguage = $epub->Language();
|
||||
$this->mDescription = $epub->Description();
|
||||
$this->mSubjects = $epub->Subjects();
|
||||
$this->mCover = $epub->getCoverItem();
|
||||
$this->mSerie = $epub->Serie();
|
||||
$this->mSerieIndex = $epub->SerieIndex();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue