diff --git a/base.php b/base.php index 26271e8..487279f 100644 --- a/base.php +++ b/base.php @@ -622,10 +622,20 @@ abstract class Base const COMPATIBILITY_XML_ALDIKO = "aldiko"; private static $db = NULL; - - public static function getDbFileName () { + + public static function getDbDirectory () { global $config; - return $config['calibre_directory'] .'metadata.db'; + if (is_array ($config['calibre_directory'])) { + $database = GetUrlParam ("database", 0); + $array = array_values ($config['calibre_directory']); + return $array[$database]; + } + return $config['calibre_directory']; + } + + + public static function getDbFileName () { + return self::getDbDirectory () .'metadata.db'; } public static function getDb () { diff --git a/book.php b/book.php index e573ccb..c37e187 100644 --- a/book.php +++ b/book.php @@ -72,7 +72,7 @@ class Book extends Base { $this->title = $line->title; $this->timestamp = strtotime ($line->timestamp); $this->pubdate = strtotime ($line->pubdate); - $this->path = $config['calibre_directory'] . $line->path; + $this->path = Base::getDbDirectory () . $line->path; $this->relativePath = $line->path; $this->seriesIndex = $line->series_index; $this->comment = $line->comment; diff --git a/data.php b/data.php index cdd05d5..3602314 100644 --- a/data.php +++ b/data.php @@ -117,8 +117,8 @@ class Data extends Base { $textData = "&data=" . $idData; } - if (preg_match ('/^\//', $config['calibre_directory']) || // Linux / - preg_match ('/^\w\:/', $config['calibre_directory']) || // Windows X: + if (preg_match ('/^\//', Base::getDbDirectory ()) || // Linux / + preg_match ('/^\w\:/', Base::getDbDirectory ()) || // Windows X: ($type == "epub" && $config['cops_update_epub-metadata'])) { if ($type != "jpg") $textData .= "&type=" . $type; diff --git a/fetch.php b/fetch.php index bbde6fd..855f3fd 100644 --- a/fetch.php +++ b/fetch.php @@ -100,7 +100,7 @@ $dir = $config['calibre_internal_directory']; if (empty ($config['calibre_internal_directory'])) { - $dir = $config['calibre_directory']; + $dir = Base::getDbDirectory (); } if (empty ($config['cops_x_accel_redirect'])) {