From 740852f905b4173cd0209a125f1883a0ecae6120 Mon Sep 17 00:00:00 2001
From: mrfakename
Date: Wed, 20 Nov 2024 16:58:45 -0800
Subject: [PATCH] Move cover art to ?coverart=1
---
application/controllers/api/Feed.php | 1 +
application/libraries/Librivox_API.php | 13 +++++++++----
application/views/public/temp_info/api.php | 5 ++++-
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/application/controllers/api/Feed.php b/application/controllers/api/Feed.php
index d77d7e5b..5ae4e884 100644
--- a/application/controllers/api/Feed.php
+++ b/application/controllers/api/Feed.php
@@ -22,6 +22,7 @@ public function audiobooks_get()
$params['since'] = $this->get('since');
$params['extended'] = $this->get('extended');
+ $params['coverart'] = $this->get('coverart');
//$params['simple'] = $this->get('simple');
$params['genre'] = $this->get('genre');
$params['title'] = $this->get('title');
diff --git a/application/libraries/Librivox_API.php b/application/libraries/Librivox_API.php
index eaa20743..c30a9449 100644
--- a/application/libraries/Librivox_API.php
+++ b/application/libraries/Librivox_API.php
@@ -72,6 +72,7 @@ function _build_data_set($params)
//return $params;
$extended = (empty($params['extended'])) ? 0 : 1;
+ $show_cover_art = (empty($params['coverart'])) ? 0 : 1;
$limit = (!empty($params['limit'])) ? $params['limit'] : 50;
$offset = (!empty($params['offset'])) ? $params['offset'] : 0;
@@ -164,14 +165,18 @@ function _build_data_set($params)
// get authors
$project['authors'] = $this->_get_authors($row['id'], 'author');
-
- if ($extended)
+ if ($show_cover_art)
{
- $project['url_iarchive'] = $row['url_iarchive'];
-
$project['coverart_jpg'] = !empty($row['coverart_jpg']) ? $row['coverart_jpg'] : null;
$project['coverart_pdf'] = !empty($row['coverart_pdf']) ? $row['coverart_pdf'] : null;
$project['coverart_thumbnail'] = !empty($row['coverart_thumbnail']) ? $row['coverart_thumbnail'] : null;
+ }
+
+ if ($extended)
+ {
+ $project['url_iarchive'] = $row['url_iarchive'];
+
+
//get sections
$project['sections'] = $this->_get_sections($row['id']);
diff --git a/application/views/public/temp_info/api.php b/application/views/public/temp_info/api.php
index 0500c6b9..dadea608 100644
--- a/application/views/public/temp_info/api.php
+++ b/application/views/public/temp_info/api.php
@@ -19,6 +19,7 @@
title - all matching titles
genre - all projects of the matching genre
extended - =1 will return the full set of data about the project
+ coverart - =1 will return links to cover art (if available) for each audiobook
@@ -135,10 +136,12 @@
totaltime
totaltimesecs
authors
+ coverart_jpg
+ coverart_pdf
+ coverart_thumbnail
sections
genres
translators
-