1
0
Fork 0
mirror of https://github.com/Yetangitu/owncloud-apps.git synced 2025-10-02 14:49:17 +02:00

Changed ISBN provider order, Google now goes first, if nothing found ISBNdb is queried. This way the daily quotum at ISBNdb lasts longer. Also, Google now actually works, before the data was ignored by the parser...

This commit is contained in:
frankdelange 2014-12-22 22:17:05 +01:00
parent 106b30a8e1
commit 68345e612f
4 changed files with 5 additions and 3 deletions

BIN
dist/files_opds-0.5.3.tar.gz vendored Normal file

Binary file not shown.

View file

@ -4,7 +4,7 @@
<name>OPDS catalog</name> <name>OPDS catalog</name>
<description>Personal OPDS catalog</description> <description>Personal OPDS catalog</description>
<licence>AGPL</licence> <licence>AGPL</licence>
<version>0.5.2</version> <version>0.5.3</version>
<author>Frank de Lange</author> <author>Frank de Lange</author>
<requiremin>7.0</requiremin> <requiremin>7.0</requiremin>
<shipped>true</shipped> <shipped>true</shipped>

View file

@ -28,7 +28,7 @@ class Google
$command = 'https://www.googleapis.com/books/v1/volumes?q=isbn:' . $isbn; $command = 'https://www.googleapis.com/books/v1/volumes?q=isbn:' . $isbn;
$data = json_decode(file_get_contents($command),true); $data = json_decode(file_get_contents($command),true);
if($data['totalItems'] > 0) { if($data['totalItems'] > 0) {
self::parse($isbn,$meta); self::parse($data['items'][0]['volumeInfo'],$meta);
return true; return true;
} else { } else {
$meta['rescan'] = date("Y-m-d\TH:i:sP", time() + Isbn::RESCAN_NOT_FOUND); $meta['rescan'] = date("Y-m-d\TH:i:sP", time() + Isbn::RESCAN_NOT_FOUND);

View file

@ -88,8 +88,10 @@ class Isbn
public static function get($isbn,&$meta) { public static function get($isbn,&$meta) {
/* set ISBN in metadata; can be overwritten later with ISBN13 */ /* set ISBN in metadata; can be overwritten later with ISBN13 */
$meta['isbn'] = $isbn; $meta['isbn'] = $isbn;
/* try Google first, then ISBNdb */
if (!(Isbn::SUCCESS == Google::get($isbn,$meta)) && (!(Isbn::SUCCESS == Isbndb::get($isbn,$meta)) )) {
/* Try ISBNdb, then Google */ /* Try ISBNdb, then Google */
if (!(Isbn::SUCCESS == Isbndb::get($isbn,$meta)) && (!(Isbn::SUCCESS == Google::get($isbn,$meta)))) { //if (!(Isbn::SUCCESS == Isbndb::get($isbn,$meta)) && (!(Isbn::SUCCESS == Google::get($isbn,$meta)))) {
return false; return false;
} else { } else {
return true; return true;