Skip to content

Fix file path of deduplicated images for 8ch#114

Open
lstyrtmrnbd wants to merge 1 commit intomiku-nyan:masterfrom
lstyrtmrnbd:8ch-fix
Open

Fix file path of deduplicated images for 8ch#114
lstyrtmrnbd wants to merge 1 commit intomiku-nyan:masterfrom
lstyrtmrnbd:8ch-fix

Conversation

@lstyrtmrnbd
Copy link
Copy Markdown

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

@khajvahmac
Copy link
Copy Markdown

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
Copy Markdown
Author

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

@kwong93
Copy link
Copy Markdown

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