Limit file types that are converted to PDF

Limit file types that are converted to PDF

by Chris Pratt -
Number of replies: 7

Is there a way to limit the file types that are attempted to be converted to PDF? We have some students who, for IT lessons submit .FLA and .SWF files which unoconv is trying to convert and failing badly at it, so much so it either crashes or ends up in an endless loop.

Average of ratings: -
In reply to Chris Pratt

Re: Limit file types that are converted to PDF

by Chris Pratt -

Had a quick look inside the unoconv.py file and was wondering if I remove the following line would it stop attempting to convert swf files?

fmts.add('graphics', 'swf', 'swf', 'Macromedia Flash (SWF)', 'draw_flash_Export') ### 23

Anyone know if this will work?

In reply to Chris Pratt

Re: Limit file types that are converted to PDF

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Chris,

Since I had just set up another server instance over the past few days, I decided to experiment with this. Note: there are actually two places where SWF is in the unoconv.py file. You spotted the one in the Graphics section, but there is also one further down in the Presentation section:

fmts.add('presentation', 'swf', 'swf', 'Macromedia Flash (SWF)', 'impress_flash_Export') ### 34

Anyway, I tried removing them both.

  • When I went to grade a swf from a graphics drawing (LO Draw), I got a blank pdf page. - OK! I can live with that. Other file types converted okay, still.
  • When I went to grade a swf created from a presentation (LO Impress), I got a blank pdf page. - OK! I can live with that. Other file types converted okay, still.
  • When I went to grade a swf video is when things went BAD. Never ending spinning conversion indicator and the whole page became unresponsive.

I added both lines back in to unoconv.py

  • When I went to grade a swf from a graphics drawing (LO Draw), I got a pdf page with FWS#? on it. - OK! I can live with that. Other file types converted okay, still.
  • When I went to grade a swf created from a presentation (LO Impress), I got a pdf page with FWSx on it.. - OK! I can live with that. Other file types converted okay, still.
  • When I went to grade a swf video is when things went BAD. Never ending spinning conversion indicator and the whole page became unresponsive.

So, it would appear to me that it is best to leave both of the lines in the unoconv.py file as they are for graphics and presentations, and teachers can learn what it means if they see FWS#? or FWSx on the resulting PDF.

Since you also mention .FLA along with .SWF, I think it is probably a video file that is creating the problem for you and since there is nothing in the unoconv.py for handling those types of files, that's where you are running into a problem.

EDIT PS: If the teacher goes ahead and annotates the PDF pages with the FWS.. on them, then Saves changes, the student will get to see the same thing if they click on View annotated PDF...
Average of ratings: Useful (1)
In reply to AL Rachels

Re: Limit file types that are converted to PDF

by Chris Pratt -

I think I'd rather the page be unresponsive when grading the few swf files we get submitted than the whole cron process failing for the entire college. As it is just one teacher who has students submitting swf files then I will be able to communicate the issue easily.

Thanks for the investigation though, saved me a lot of work!

In reply to Chris Pratt

Re: Limit file types that are converted to PDF

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Chris,

Been doing some further testing and it is starting to look like Moodle is the problem when you get "hung up" while trying to convert .swf files.

If I run unoconv in a terminal window and tell it to convert all three types of .swf files, graphic, presentation, and video, it will do as told. Granted, the output files basically just contain garbage, but the conversion does finish. The conversion of a video .swf does take longer to finish, but that is just due to the size of the files.

When converting the exact same three files in Moodle, the graphic and presentation type .swf files will generate a PDF file, with garbage text, but so far, no matter how long I let the video .swf file conversion run in Moodle, I only see a couple of "Loading" icons that spin and never complete.

Average of ratings: Useful (1)
In reply to AL Rachels

Re: Limit file types that are converted to PDF

by Ken Task -
Picture of Particularly helpful Moodlers

I gotta ask ... the conversion of .swf files to .pdf.   Really?   And could anything open the converted .pdf?   

Learning mode ... how does one 'annotate' a video file?   Let's say it was an mp4 file uploaded as the assignment submission.  How can one 'annotate' that?

A few years ago I tinkered with Kaltura's community version.   It handled not only videos but converted documents (or was supposed to - actually found it was better at converting videos than docs).   The big issue with getting that running ... all the 'depends' one had to install to get it to work.  Video conversions used ffmpeg.   But not all LInuxes installed ffmpeg in the same manner/fashion plus one needed other libraries.   Printed out, a 5 pg (8x11) with no pics document ... just steps - which I tried to follow and for the most part successful ... in the command line test.   But not the web interface.    Didn't make that one public. 

Time passes.   I check on Kaltura's community version again.   It's download is now about twice the size+ than the first (around 50Meg if I re-call correctly).  Was curious.   Download and un-archived just  to see.    In the new version a bin directory and contained therein alll the little command line ujtilities that were used behind the scenes to do the conversions ... for videos ... ffmpeg with all the libraries, etc..   Community Kaltura re-programmed to use the bin directory.   But ... other duties kept me from pursuing.

All this to say, maybe unoconv isn't the tool for the job .... all submissions.   Not a programmer, but what if there were (oh, boy, here we go) yet another assignment submissions just for audio/video.   That Poodl?

Hmmmmm ....

2 cents wortth, I know ... :|

'spirit of sharing', Ken

In reply to Ken Task

Re: Limit file types that are converted to PDF

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I have always thought that the assignment needed the ability to limit the type of file submissions on a per assignment basis with defaults set at plugin level.  This would save everyone a lot of headaches and avoid this very issue.

And, if video files are allowed, then it needs to redirect to a different grading interface.

I, too, have played with Kaltura.  Last time was about six months ago and I remember having to manually install all the ffmpeg stuff so they must have just recently come out with that.  I gave up on because I could not figure out how to make it do what I wanted and their support forums are severely lacking.  (We get so spoilt with Moodle forums!!)

Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Limit file types that are converted to PDF

by Chris Pratt -

A bit OT here but I'd like Moodle to have an option within the Assignment settings to say whether you want PDF conversion for grading or not and allow the old grading method. This is a personal preference of the teacher, some like it, some don't. Some want to download and grade, some like to print and grade. Some use a projector in a classroom, some just the whiteboard.

Like we do with student's learning styles, we shouldn't shoehorn teachers into methods of teaching.

Average of ratings: Useful (2)