Skip to content
This repository was archived by the owner on Jun 9, 2023. It is now read-only.

Support for reddit galleries #312

Merged
merged 30 commits into from
Sep 7, 2020

Conversation

AbsurdlySuspicious
Copy link
Collaborator

This is a pretty large PR since it involved unlinking media albums from imgur.

Regarding new jraw dependency, I think its fork too should be moved in githib org as I proposed in #311.
Changes to jraw: AbsurdlySuspicious/JRAW@master...AbsurdlySuspicious:gallery

Links for testing:

@AbsurdlySuspicious
Copy link
Collaborator Author

There's also problem with cache. Any galleries that were put to cache as external link will still be external links. Should it be cleared?

@AbsurdlySuspicious
Copy link
Collaborator Author

Build fails due to #311

msfjarvis added a commit to msfjarvis/Dawn that referenced this pull request Sep 6, 2020

Verified

This commit was signed with the committer’s verified signature.
williamdes William Desportes
Support for reddit galleries

* github.com:Tunous/Dawn:
  Support thumbs for gallery posts
  Support multi-variant preview in gallery links
  Don't left static image in lq gif urls
  Support image/jpg case
  Support mp4 for gifs
  Full might be absent in media_metadata
  Unlink title/description from ImgurLink
  Captions support
  GIFs support
  Preview with multiple variations for MediaLink
  Add support for media_metadata for ImageWithMultipleVariants
  Generalize ImageWithMultipleVariants
  Move ImageWithMultipleVariants to utils
  RedditGalleryLink
  Rename to MediaAlbumLink
  Generalize media albums
  Superclass for album links
  UrlParser branch
  Update synthetic
  Switch jraw dependency

Signed-off-by: Harsh Shandilya <[email protected]>
Copy link
Owner

@Tunous Tunous left a comment

Choose a reason for hiding this comment

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

There's also problem with cache. Any galleries that were put to cache as external link will still be external links. Should it be cleared?

Yeah I think it's ok to clear it somehow.

Verified

This commit was signed with the committer’s verified signature.
williamdes William Desportes

Verified

This commit was signed with the committer’s verified signature.
williamdes William Desportes

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Copy link
Collaborator Author

@AbsurdlySuspicious AbsurdlySuspicious left a comment

Choose a reason for hiding this comment

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

aebc79f

Since reddit doesn't provide previews for galleries in usual way, use previews from media_metadata for data saver

264d7bd

All failures are now falling back to external link

5d0bf92

Cache clearing happens here. It's also usable for db schema updates in case that'll happen in future

Copy link
Owner

@Tunous Tunous left a comment

Choose a reason for hiding this comment

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

Looking at the cache clearing code I'm not entirely sure how it's supposed to work. Right now it appears like it would clear room database and not the media cache which seems reverse to what I would expect.

@AbsurdlySuspicious
Copy link
Collaborator Author

it would clear room database

It's intended. Room database stores old serialized version of Submission without any gallery-related fields. This is the problem, not media cache.

fallbacks to destructive migration

So the main purpose of this section is clearing database when no migration happened, but it's known that db contains stale/poisoned cache

CLEAR_MEDIA_CACHE_AFTER = -1 will result in nothing being done

I've included routines for clearing media cache too in case that will be needed in future

introduce this class via dependency injection

I don't think it's worth over-complicating it since it's used once during initialization. I used class instead of object just as a convenient way of passing context, but on second thought, given that there is only 2 functions it can be passed as argument without any pain

@Tunous
Copy link
Owner

Tunous commented Sep 7, 2020

Oh, that explains a lot.

@AbsurdlySuspicious
Copy link
Collaborator Author

This way it should be more intuitive

Copy link
Owner

@Tunous Tunous left a comment

Choose a reason for hiding this comment

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

Great, thanks for the changes. Looks good to me now 👍

@Tunous Tunous added this to the 0.11.0 milestone Sep 7, 2020
@Tunous Tunous added the feature New feature label Sep 7, 2020
@Tunous Tunous merged commit 1eae1d2 into Tunous:master Sep 7, 2020
@AbsurdlySuspicious AbsurdlySuspicious deleted the gallery/feature branch January 23, 2021 05:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants