Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file path of deduplicated images for 8ch #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lstyrtmrnbd
Copy link

Checks length of tim parameter to determine location of image and image thumbnail

@khajvahmac
Copy link

khajvahmac commented Sep 9, 2016

Solving 8chan specific issue in the abstract base class isn't the best solution. What if some other chan changes its image urls too? I suggest you isolate the url construction in another method in AbstractVichanModule and then override it with correct 8chan specific url in InfinityModule. I can do this, if you don't want to.

@lstyrtmrnbd
Copy link
Author

That does seem a cleaner solution, I'll try to get to it when I'm able

@kwong93
Copy link

kwong93 commented Nov 4, 2016

The thumbnails are not always jpg, for example this thread

https://8ch.net/g/res/466.html

The op image ends in .png. I've seen another thread that has a thumb end in .gif as well.

Is there a way to get the correct thumb extension?

Edit: @ctrlcctrlv you mentioned here #4 that the thumb extension matched the original file format before a certain date, do you know that date?

Edit: I looked at Everychan's source and the .jpg extension only applys to videos and tims whose length is not 64

            String thumbLocation = tim.length() == 64 ? "/file_store/thumb/" : "/" + boardName + "/thumb/";
            String fileLocation = tim.length() == 64 ? "/file_store/" : "/" + boardName + "/src/";
            if (tim.length() > 0) {
                if(tim.length()!=64 || (tim.length() == 64 && attachment.type == AttachmentModel.TYPE_VIDEO)){
                    ext = ".jpg";
                }
                attachment.thumbnail = isSpoiler || attachment.type == AttachmentModel.TYPE_AUDIO ? null :
                        (thumbLocation + tim + ext);
                attachment.path = fileLocation + tim + ext;

                return attachment;
            }

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