Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Extend image proxy to work with cover art #171

Merged
merged 12 commits into from
Aug 23, 2021
Merged

Extend image proxy to work with cover art #171

merged 12 commits into from
Aug 23, 2021

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Aug 12, 2021

Fixes

Closes #76

Description

This PR adds endpoints to generate thumbnails for album art associated with audio sets

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb marked this pull request as ready for review August 12, 2021 08:24
@dhruvkb dhruvkb requested a review from a team as a code owner August 12, 2021 08:24
@dhruvkb dhruvkb requested review from zackkrida and krysal and removed request for a team August 12, 2021 08:24
@dhruvkb dhruvkb added 🌟 goal: addition Addition of new feature 🕹 aspect: interface Concerns end-users' experience with the software labels Aug 12, 2021
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

I got it to work by manually adding an audioset, adding the audio_set_id to the audio row, and visiting the thumb url.

INSERT INTO "public"."api_audioset" ("id", "created_on", "updated_on", "identifier", "foreign_identifier", "title", "foreign_landing_url", "creator", "creator_url", "url", "filesize") VALUES (4, '2021-08-13 03:21:57.193204+00', '2021-08-13 03:21:57.193204+00', '40e6215d-b5c6-4896-987c-f30f3678f608', '31', 'Pouce !', 'https://www.jamendo.com/album/31/pouce', 'fake', 'https://fake.com', 'https://usercontent.jamendo.com?type=album&id=31&width=200&trackid=217', 200);

Then added the resulting id as the audio_set_id for audio where identifier is 28c40835-f14d-4b81-8847-bbb091a64f35.

http://localhost:8000/v1/audio/28c40835-f14d-4b81-8847-bbb091a64f35/thumb

CleanShot 2021-08-12 at 23 24 26@2x

My only real feedback is that I don't love the audio_set column names url for the thumbnail url.

I'm also wondering if it makes sense to store the thumbnail url on the individual audio rows as a backup if anything happens to the audio set, or maybe we just need some other protection to make sure audio sets aren't deleted/lost/disconnected in the future.

openverse-api/catalog/api/views/audio_views.py Outdated Show resolved Hide resolved
@dhruvkb dhruvkb marked this pull request as draft August 13, 2021 04:38
@dhruvkb dhruvkb marked this pull request as ready for review August 13, 2021 08:18
Base automatically changed from clean_endpoints to main August 23, 2021 10:53
@dhruvkb dhruvkb requested a review from obulat August 23, 2021 13:23
Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

Thumbnail images work great.
Thank you for adding changes so quickly!

I was wondering how cache works with thumbnails. It seems that many audio files will have the same thumbnail (since the image is the same for all audios in the audio_set, at least on jamendo).

@dhruvkb
Copy link
Member Author

dhruvkb commented Aug 23, 2021

@obulat the image proxy we use has caching functionality built-in, although we have not configured it in the dev environment. The documentation covers most caching setups so it should not pose significant difficulty.

@dhruvkb dhruvkb merged commit 16294e8 into main Aug 23, 2021
@dhruvkb dhruvkb deleted the image_proxy_audio branch August 23, 2021 15:25
dhruvkb added a commit that referenced this pull request Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🌟 goal: addition Addition of new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port thumbnail server to work with images associated with audio
3 participants