Page MenuHomePhabricator

Add the image of authors to generate thumbnails for the books in the list of books section
Closed, ResolvedPublic

Description

Currently the thumbnails of the books are generated in the following ways

  1. image of the book property
  2. title page number as qualifier of document file on Wikimedia Commons property.

But, still thumbnails could not be generated for many other books in the app as their Wikidata items are not filled with the above mentioned properties.

For that, a third option to generate thumbnail is needed, where the image of authors can be used as an alternative. The value of authors are already included in the Wsindex API

Task:

  • Fetch image from the Wikidata items of the authors and include in the Wsindex API
  • Fetch only one image if the Wikdiata item of an author has multiple images.
    • Sometimes, the item of an author having multiple images have one image with preferred rank (see this item for example). Fetch that preferred image only.
    • For item of an author having multiple images but which do not have preferred rank, fetch any one of the images.

[Note: Add the image url of authors in the Wsindex API in the authors section. The image url should also be of the lower resolution version from Wikimedia Commons (check how we are generating existing book thumbnails for example). ]

  • For thumbnail generation on the app side
    • Skip books which already uses the first two options of thumbnail generation and look for those books which do not. [Note: Use the author image url if thumbnail url is empty in API response.]
    • For books with more than one value of authors, look for image of the first author in the item. .
      • If the first author has image, add it as the thumbnail and do not check the next author.
      • If the first author does not have image, skip and check the next author and repeat.

Event Timeline

Hello @Bodhisattwa , I would like to work on this issue.

Hello @Bodhisattwa , I would like to work on this issue.

We have not included this task for Outreachy yet, so you are requested not to start working on this until that happens. I will let you know, as soon as it is included.

For the tasks which are designated for interns, you can check T405593 where you can find them organized as subtasks.

For this, we have to add the image url of authors in the wsindex API in the authors section. The image url should also be of the lower resolution version from commons (check how we are generating existing book thumbnails for example). And on the app side, use this author image url if thumbnail url is empty in API response.

Hello @Bodhisattwa , I would like to work on this issue.

@Muguro, you can now take up the task, we have included it for Outreachy. Best wishes!

Hello @Bodhisattwa , I would like to work on this issue.

@Muguro, you can now take up the task, we have included it for Outreachy. Best wishes!

@Bodhisattwa Sure, thanks.

For this, we have to add the image url of authors in the wsindex API in the authors section. The image url should also be of the lower resolution version from commons (check how we are generating existing book thumbnails for example). And on the app side, use this author image url if thumbnail url is empty in API response.

Hi @Saiphani02, since we have a method that encodes thumbnail url, could we use the same to use authors url incases where the thumbnail url is empty?

Hi @Saiphani02 @Bodhisattwa,

I'm using the following endpoint https://www.wikidata.org/w/api.php?action=wbgetclaims&entity=Q3116411&property=P18&format=json
to get the data value for passed person_wikidata_qid that is :

Q3116411

Then construct a url to get the entity. This happens only if the book lacks thumbnail_url.

I've opened a PR, kindly have a look https://codeberg.org/ph4ni/wsindex/pulls/5

@Muguro , thanks for the PR. Its a festive season in India and we are celebrating Diwali with our friends and families and it might take a couple of days to be back. Don't worry, the PRs you have submitted will be reviewed as soon as we return. Thanks for your understanding.

I totally understand. Happy Diwali! Enjoy the celebrations and have a wonderful time!

@Saiphani02 has merged the PR. Closing the issue. @Muguro, Thanks for the contribution.