Page MenuHomePhabricator

Add option to not create DjVu but just upload PDF
Closed, ResolvedPublic

Description

Moved here from https://github.com/wikisource/ia-upload/issues/15 (to keep all issues in one place):

There should be an option if user not to convert djvu #15
There should be an option if user not to convert djvu, only upload pdf.

Event Timeline

This seems more useful in light of T182470, where PDFs without text layers are not able to be turned into DjVu by the /phetools/pdf_to_djvu_cgi.py tool. It's becoming less clear as time goes on why we want to turn PDFs into DjVus anyway!

I think we could:

  • remove the static '.djvu' extension from the first page of ia-upload;
  • allow the user to submit either .djvu or .pdf filenames;
  • if they submit a .pdf filename, only give them the option of uploading an existing PDF from IA (and show an error if there's no existing PDF, but I think that's reasonably uncommon);
  • for PDFs, don't show the "DjVu file source:" or "Remove first page?" fields (in order to keep things simpler; maybe the latter of these could be added back in, but the advantage of removing it is that the job queue can be bypassed for direct PDF uploads);
  • replace the {{djvu}} template with {{PDF}} in the prefilled wikitext.

I think that'd be about the minimum required to satisfy this task.

(@satdeep_gill does this sound like roughly what we talked about?)

@Samwilson Indeed this does capture our discussion neatly. Thank you

"It's becoming less clear as time goes on why we want to turn PDFs into DjVus anyway!"

Probably just history: https://en.wikisource.org/wiki/Wikisource:DjVu_vs._PDF

I've edited that page a bit, to update the section about advantages of DjVu.

I wonder what it'd take to add a "Get PDF from IA" option to UploadWizard, in a similar vein to the Flickr upload option? Given that PDFs from IA don't need any processing, it might be nicer to make it more integrated into Commons.

PR42 is merged, and the test site updated.

Must be an issue with views/template.twig, where it does this:

{{ 'login-notice'|message( full_url_for( 'oauth-init', [], {'referer': (get_uri().__toString())} ) )|raw }}

It seems to be detecting the URL wrong in both full_url_for and get_uri. See docs at https://github.com/slimphp/Twig-View

I think I see a fix for this, but you'll have to test it on toolforge -- shall I submit another PR on GitHub?

Yep, send a PR. I've also added you as a maintainer on ia-upload-test, so you can log in there and try things out. https://toolsadmin.wikimedia.org/tools/id/ia-upload-test

PR merged, and the staging and prod sites updated. Looks good!