Skip to content

Conversation

@Yihuki
Copy link
Contributor

@Yihuki Yihuki commented Oct 12, 2025

Primo backend only returns isbn but not issn, browzine coverimage loader needs issn to get the cover image.

Primo backend only returns isbn but not issn, browzine coverimage loader needs issn to get the cover image.
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing this! In order to fix the error in GitHub Actions, please run composer fix and commit the results; that should adjust the minor style issues that are causing the problem.

I'm also requesting a review from @EreMaijala, since he is more familiar with Primo than me and may have additional feedback.

@demiankatz demiankatz requested a review from EreMaijala October 12, 2025 11:45
@Yihuki
Copy link
Contributor Author

Yihuki commented Oct 12, 2025

Also, Booksite needs isbn to be used for cover image loading. Not sure if we need to change isn here to isbn or add another isbn.

/**
* Get image URL for a particular API key and set of IDs (or false if invalid).
*
* @param string $key API key
* @param string $size Size of image to load (small/medium/large)
* @param array $ids Associative array of identifiers (keys may include 'isbn'
* pointing to an ISBN object and 'issn' pointing to a string)
*
* @return string|bool
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getUrl($key, $size, $ids)
{
if (!isset($ids['isbn'])) {
return false;
}
$isbn = $ids['isbn']->get13();
return $this->url . '/poca/content_img?apikey=' . $this->apiKey
. '&ean=' . $isbn;
}
}

/**
* Get image URL for a particular API key and set of IDs (or false if invalid).
*
* @param string $key API key
* @param string $size Size of image to load (small/medium/large)
* @param array $ids Associative array of identifiers (keys may include 'isbn'
* pointing to an ISBN object and 'issn' pointing to a string)
*
* @return string|bool
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getUrl($key, $size, $ids)
{
// Don't bother trying if ISSN is missing:
if (!isset($ids['issn'])) {
return false;
}
$command = new LookupIssnsCommand('BrowZine', $ids['issn']);
$result = $this->searchService->invoke($command)->getResult();
$url = $result['data'][0]['coverImageUrl'] ?? false;
return ($url && in_array($url, $this->ignoreList)) ? false : $url;
}
}

return ['size' => $size, 'contenttype' => 'JournalArticle'];

if (empty($params['isbn']) && empty($params['issn'])) {
$params['contenttype'] = 'JournalArticle';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't contenttype still be always set? As far as I can see it's only used by cover loader's fetchFromContentType method, but Summon driver sets it from format. Perhaps the same could be done here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree: it might be preferable to set the content type by mapping format values if we want to be more consistent.

@demiankatz
Copy link
Member

Also, Booksite needs isbn to be used for cover image loading. Not sure if we need to change isn here to isbn or add another isbn.

I'm not sure if the Booksite service/API even still exists; that integration was contributed many, many years ago and I don't think anyone has been able to test it since then. It's certainly possible that code fell out of date during that time. If you want to try to fix it in a separate PR, you're welcome to, but I'm not sure how to confirm that the fix makes a difference.

@Yihuki
Copy link
Contributor Author

Yihuki commented Oct 14, 2025

I'm not sure if the Booksite service/API even still exists; that integration was contributed many, many years ago and I don't think anyone has been able to test it since then. It's certainly possible that code fell out of date during that time. If you want to try to fix it in a separate PR, you're welcome to, but I'm not sure how to confirm that the fix makes a difference.

It's right that this booksite service is inaccessible this year, and the last time seen on wayback machine is 2024 DEC. Maybe this backend could be removed someday in the future.

@demiankatz demiankatz requested a review from EreMaijala October 14, 2025 13:00
@demiankatz
Copy link
Member

It's right that this booksite service is inaccessible this year, and the last time seen on wayback machine is 2024 DEC. Maybe this backend could be removed someday in the future.

I have opened #4736 to clean this up. Thanks for doing the investigation!

(And on this present PR, I am waiting for @EreMaijala to re-review before taking further action; he is out of office today but should return next week).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants