GUI file converter app and its commands

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
TimothySimon
Posts: 93
Joined: Fri Sep 10, 2021 2:16 am

Re: Batch convert PDF to JPG (or X file format to Y)

#21 Post by TimothySimon »

file-converter

A simple app to convert between various file formats.

- Supports batch conversion of multiple files
- Drag N Drop functionality
- Works on almost any Linux distro

These formats and their equivalents are supported:
1) PDF
- Can be converted (page-by-page) to jpg, png, tiff
- Can also be converted to jpg's containing only the first page
- Uses pdftoppm
2) Images: jpg png tiff bmp heic
- Any of these can be interconverted
- Uses convert-im6.q16
3) Audio: aiff aiffc au amr-nb amr-wb cdda flac gsm mp3 ogg opus sln voc vox wav wv 8svx
- Any of these can be interconverted
- Uses sox
4) Video: 3g2 3gp asf avi m4v mkv mov mp4 nsv rm roq vob webm
- Any of these can be interconverted
- Uses ffmpeg

AppImage at:
https://github.com/TimothySimon123/file ... 4.AppImage

I stopped working on jpg2pdf and I'm now working on file-converter.

Source code and instructions to build AppImage at:
https://github.com/TimothySimon123/file-converter
Let's call this file-converter 0.1 alpha.

Please give your valuable comments and suggestions.
Huckleberry Finn wrote: Fri Sep 17, 2021 10:55 am Yes, of course.. Step by step .. Once you make it almost perfect for this one (appearance etc, buttons, showing the list when files dragged etc.) the rest wouldn't be difficult.. Just find more commands for more file types and add .. (imho) :)
Made major improvements in appearance.
Huckleberry Finn wrote: Fri Sep 17, 2021 11:09 am Meanwhile, for the drag & drop thing: You can gain some time till you do it: You can just change the echo message to something like" Please drag files here then click ok" (Or something like that) that the user knows/guesses that it's normal it shows a blank window and they can just go on ignoring that ...
Implemented that.
Huckleberry Finn wrote: Fri Sep 17, 2021 11:53 am Just remembered one more thing about that (though that function is not even necessary for me.. just people may want to see):

I don't know which's easier but rather than showing a list of the dropped files (or till then) this may be simpler and lighter:

Just the number of files.. Say: " 18 files will be converted " appears in the window. Then it'll do the job and the user will know that stage is ok... Then you click either to "Convert all" or to "Convert Just 1st Pages" (in place of OK) or "Cancel".
Implemented that too.

BTW: Should this be moved to a new thread ?

Huckleberry Finn

Re: Batch convert PDF to JPG (or X file format to Y)

#22 Post by Huckleberry Finn »

TimothySimon wrote: Sat Sep 18, 2021 3:03 pmBTW: Should this be moved to a new thread ?
If you ask for it turned into "file converter" from just pdf to jpg .. Maybe just editing the title (clicking the pencil on 1st post) would be enough ..

SwampRabbit
Posts: 3602
Joined: Tue Jun 14, 2016 2:02 pm

Re: Batch convert PDF to JPG (or X file format to Y)

#23 Post by SwampRabbit »

Looking good!

Something that might be helpful is using --tooltip with DND
https://man.archlinux.org/man/community ... ox_options

Its just preference, but you don't have to type "function" for each one, you can use say:

Code: Select all

# some functions
file-converter-pdf2jpg(){
pdftoppm -jpeg "$1" "$(echo "$2" | sed 's/\.jpg$//g')"
}
I believe Jerry and Fehlix use this form, so I've started using it too.

I'll start the Debian packaging for this later, when its packaged all the needed file format dependencies will get installed, that can let you remove those IF statements checking for all that if you want.
NEW USERS START HERE FAQS, MX Manual, and How to Break Your System - Don't use Ubuntu PPAs! Always post your Quick System Info (QSI) when asking for help.

TimothySimon
Posts: 93
Joined: Fri Sep 10, 2021 2:16 am

Re: Batch convert PDF to JPG (or X file format to Y)

#24 Post by TimothySimon »

Created a new release, 0.2 beta.
- Added a GUI progress bar.
- Updated function naming conventions.
- Added deb.
SwampRabbit wrote: Sat Sep 18, 2021 3:28 pm Its just preference, but you don't have to type "function" for each one, you can use say:

I believe Jerry and Fehlix use this form, so I've started using it too..
Yes. I did it.
Its not just preference. AFAIK, removing "function" also increases POSIX sh compatibility.
SwampRabbit wrote: Sat Sep 18, 2021 3:28 pm I'll start the Debian packaging for this later, when its packaged all the needed file format dependencies will get installed, that can let you remove those IF statements checking for all that if you want.
I've packaged a deb and given the packaging script in packaging/deb/build-deb.sh
It works, but it may not be good enough (I'm not experienced with deb packaging).

I think the IF statements should be unchanged (thinking of the AppImage).
Those would be just a few extra lines of code is distributed as a deb.

The AppImage contains a self-contained yad, but it still depends on poppler-utils, imagemagick and ffmpeg installed in the system (I don't want a bloated AppImage).

Please give your valuable comments and suggestions on the new version of file-converter.

Thank you all for your guidance and support.

SwampRabbit
Posts: 3602
Joined: Tue Jun 14, 2016 2:02 pm

Re: GUI file converter app and its commands

#25 Post by SwampRabbit »

@TimothySimon

Its really good and it works very well for everything I tested. Some minor usability recommendations before I get to the good stuff:

- you might want to hunt down an icon to use specifically for file-converter, using update notifier one can be confusing at least those that use it on MX. MAYBE... someone here on the forums would be interested in making you an icon?

- you have some inconsistency of using then not using the "=" equal sign sometimes, I don't know if was affecting some of the tweaks I was trying to do to get the some of the below working or not. Maybe just go back and make sure some of your dialog items are correct and working as expected.

- I tried to get the --image with --image-on-top to work so you could have a download icon image dead center of the dialog, but wouldn't work for some reason.... this kinda goes back to the previous item

- it would be nice to have some sort of notification that files have been dropped, maybe if even visual count in the dialog (see screenshot), its kinda hard to visually see its working initially and it might help first time users a bit

- on the dialog showing how many files will be converted and for selecting the converted output, if you previously didn't drop any files in it tells you to run it again, then both the cancel and ok buttons just close everything out... one might expect one of them, at least the ok button to take you back to the Drag N Drop dialog. Kinda a pain to open the application again

- on the last dialog showing success of conversion, I think you should have a "Close" button and "View" button rather than "Cancel" and "Ok"


Good stuff now!

- I am ready to do a PR for some minor tweaks and created the debian folder and files needed to package file-converter for our repos when you get to that point.
- Do you want it going to your main branch or do you want to create a "development" branch first and I do the PR to that?

Edit I forgot the link to the screenshot
https://imgur.com/yM7IJyK
NEW USERS START HERE FAQS, MX Manual, and How to Break Your System - Don't use Ubuntu PPAs! Always post your Quick System Info (QSI) when asking for help.

TimothySimon
Posts: 93
Joined: Fri Sep 10, 2021 2:16 am

Re: GUI file converter app and its commands

#26 Post by TimothySimon »

SwampRabbit wrote: Tue Sep 21, 2021 12:15 am @TimothySimon

- you have some inconsistency of using then not using the "=" equal sign sometimes, I don't know if was affecting some of the tweaks I was trying to do to get the some of the below working or not. Maybe just go back and make sure some of your dialog items are correcting and working as expected.
I didn't get you. Please explain that inconsistency.

TimothySimon
Posts: 93
Joined: Fri Sep 10, 2021 2:16 am

Re: GUI file converter app and its commands

#27 Post by TimothySimon »

SwampRabbit wrote: Tue Sep 21, 2021 12:15 am @TimothySimon

- I am ready to do a PR for some minor tweaks and created the debian folder and files needed to package file-converter for our repos when you get to that point.
- Do you want it going to your main branch or do you want to create a "development" branch first and I do the PR to that?
I'm not familiar with this. Please explain this too.

SwampRabbit
Posts: 3602
Joined: Tue Jun 14, 2016 2:02 pm

Re: GUI file converter app and its commands

#28 Post by SwampRabbit »

line 103

Code: Select all

--text "Welcome to file-converter version ${APP_VERSION}\n\nPlease DRAG AND DROP files here , then CLICK OK\n\nYou need not do anything in the terminal that just came up." \
line 244

Code: Select all

--text="$FILE_COUNT files will be converted. \n Press OK to proceed" || echo "EXIT NOW")
See what I mean about the equal signs?


You're using quotes for the --image, it doesn't seem to be affecting it, but you don't need the quotes here

Code: Select all

--image="info"
YAD can often take a lot of whatever you throw at it, but it can also do strange things when you don't do something exactly how YAD expects it.


There were a few other things like that that I saw, but I can't remember where or what they were, maybe it was something good, that I just have no clue about too. :p
Last edited by SwampRabbit on Tue Sep 21, 2021 1:07 am, edited 1 time in total.
NEW USERS START HERE FAQS, MX Manual, and How to Break Your System - Don't use Ubuntu PPAs! Always post your Quick System Info (QSI) when asking for help.

SwampRabbit
Posts: 3602
Joined: Tue Jun 14, 2016 2:02 pm

Re: GUI file converter app and its commands

#29 Post by SwampRabbit »

TimothySimon wrote: Tue Sep 21, 2021 12:46 am
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am @TimothySimon

- I am ready to do a PR for some minor tweaks and created the debian folder and files needed to package file-converter for our repos when you get to that point.
- Do you want it going to your main branch or do you want to create a "development" branch first and I do the PR to that?
I'm not familiar with this. Please explain this too.
You can create a "working/development branch" to do anything with, once it is ready you can push it to your "main" or "stable" branches. Some big applications with lots of developers create a branch for each "release".
This helps you organize and segment work and keep people from messing up something you are working on or others are working on.

You can do it using git commands in the terminal or you can do it in the web interface
https://imgur.com/44BQVHK
NEW USERS START HERE FAQS, MX Manual, and How to Break Your System - Don't use Ubuntu PPAs! Always post your Quick System Info (QSI) when asking for help.

TimothySimon
Posts: 93
Joined: Fri Sep 10, 2021 2:16 am

Re: GUI file converter app and its commands

#30 Post by TimothySimon »

SwampRabbit wrote: Tue Sep 21, 2021 1:03 am You can create a "working/development branch" to do anything with, once it is ready you can push it to your "main" or "stable" branches. Some big applications with lots of developers create a branch for each "release".
This helps you organize and segment work and keep people from messing up something you are working on or others are working on.

You can do it using git commands in the terminal or you can do it in the web interface
https://imgur.com/44BQVHK
I'll do that ("development" branch)
SwampRabbit wrote: Tue Sep 21, 2021 12:54 am line 103

Code: Select all

--text "Welcome to file-converter version ${APP_VERSION}\n\nPlease DRAG AND DROP files here , then CLICK OK\n\nYou need not do anything in the terminal that just came up." \
line 244

Code: Select all

--text="$FILE_COUNT files will be converted. \n Press OK to proceed" || echo "EXIT NOW")
You're using quotes for the --image, it doesn't seem to be affecting it, but you don't need the quotes here

Code: Select all

--image="info"
YAD can often take a lot of whatever you throw at it, but it can also do strange things when you don't do something exactly how YAD expects it.
s/--image="info"/--image=info/g
s/--image "info"/--image=info/g
s/--text "/--text="/g

Is this what I'm supposed to do ? ;)

Post Reply

Return to “Tips & Tricks by users (not for help)”