Lich-Corals / linux-file-converter-addon

Convert between various image, audio and video formats.
GNU General Public License v3.0
15 stars 6 forks source link

Nemo files adaption #21

Closed Username23453 closed 8 months ago

Username23453 commented 9 months ago

Just wanted you guys to know I gave you guys a shout out and said good things about you guys in the Zorin OS forum.

https://forum.zorin.com/t/nemo-file-manager-wont-thumbnail-preview-avif-files

Thanks again for creating this tool! its a life saver in linux based OS's!

@derVedro , @Lich-Corals

One last think I'll say is that i like Nemo better than nautilus, because you can double click a file or folder and rename it, which is quickest, and which you cant do in nautilus. And it would be cool to be able to use your tool in Nemo. Its more time consuming having to switch to Nautilus. But I'm still glad I can do it in Nautilus! And I use your tool all the time.

Lich-Corals commented 9 months ago

Thanks for the feedback, I always appreciate if someone is recommending our program.

I'll take a look at Nemo and it's extending abilities. I can't say if I'm capable of adapting the program for it, but I'll definitely try to.

k2d222 commented 9 months ago

@Username23453 FYI the F2 key is the standard "rename" key, it works in Nautilus and probably Nemo too :)

Username23453 commented 9 months ago

@Lich-Corals , "I can't say if I'm capable of adapting the program for it, but I'll definitely try to."

--Try to ask the various A.I.'s for advice, there are quite a few A.I.'s that are good with code also. And even better when you feed them Python code for dummies pdf's, or linux for dummies pdf's. I have tons of research notes on this.

The free A.I.'s though are very buggy, and I dont have the money to pay for better A.I. nor do I have the coding knowledge to fix the buggy prototype scripts/code they create for me.

Username23453 commented 9 months ago

@k2d222 , yeah i know, 🙂 i just strongly prefer to use double left click to rename. Always have. I like it better and feel its quicker & more convenient. Thats how Windows does it. Windows, despite all its spyware, backdoors, bloatware,tracking telemetry, shady close source code, it does have a billion dollar user friendly design.

Lich-Corals commented 9 months ago

@Lich-Corals , "I can't say if I'm capable of adapting the program for it, but I'll definitely try to."

--Try to ask the various A.I.'s for advice, there are quite a few A.I.'s that are good with code also. And even better when you feed them Python code for dummies pdf's, or linux for dummies pdf's. I have tons of research notes on this.

The free A.I.'s though are very buggy, and I dont have the money to pay for better A.I. nor do I have the coding knowledge to fix the buggy prototype scripts/code they create for me.

I'll first try to look at their docs; if I'm lucky, there is a well documented API for Nemo... Just hope I don't have to do it in Java, but this should be very unlikely. :D

Username23453 commented 9 months ago

@Lich-Corals , oh, also, i should share with you my notes on image converting/batch converting and right click menu batch converting. Maybe you can look at how these other tools do it and borrow something from them.

1.) (this only does one image at a time) sucks, no batch. https://brushingupscience.com/2017/02/28/image-conversion-with-a-right-click/

2.) https://flathub.org/apps/io.gitlab.adhami3310.Converter

https://gitlab.com/adhami3310/Switcheroo/-/issues

3.) https://www.fosslinux.com/3381/how-to-resize-convert-images-from-right-click-menu-in-ubuntu.htm

4.) This is too hard for me to do: https://askubuntu.com/questions/156484/how-do-i-install-python-imaging-library-pil

5.) "In Ubuntu 20.04, users can build a right-click option for converseen by installing Arc-menu Gnome Shell extension (sudo apt install gnome-shell-extension-arc-menu) and reinstalling Grub2 (sudo apt install grub) using the Terminal in the live environment.0"

6.) https://atareao.es/ubuntu/convertir-archivos-svg-a-png-de-forma-masiva-en-ubuntu/

7.) https://github.com/cytopia/thunar-custom-actions this works, but only in terminal, not sure if it has a pull down menu feature. & only one image at a time.

8.) https://www.ubuntubuzz.com/2016/05/how-to-install-kim-kde-image-menu-in.html

9.) https://www.howtogeek.com/116807/how-to-easily-add-custom-right-click-options-to-ubuntus-file-manager/

10.) https://forum.zorin.com/t/in-order-to-have-a-right-click-menu-png-converter-would-anyone-be-interested-in-helping-me-install-python-imaging-library/25826/2

11.) This script converts all image files to PNG, using nemo, Make sure to open terminal in that folder. I tested this and it works. Just need to add it to right click menu somehow.

for file in .{jpg,jpeg,png,JPG,gif,bmp,tiff}; do if [ -f "$file" ]; then filename=$(basename -- "$file") extension="${filename##.}" filename="${filename%.*}" convert "$file" "$filename.png" fi done

derVedro commented 9 months ago

@Lich-Corals , "I can't say if I'm capable of adapting the program for it, but I'll definitely try to." --Try to ask the various A.I.'s for advice, there are quite a few A.I.'s that are good with code also. And even better when you feed them Python code for dummies pdf's, or linux for dummies pdf's. I have tons of research notes on this. The free A.I.'s though are very buggy, and I dont have the money to pay for better A.I. nor do I have the coding knowledge to fix the buggy prototype scripts/code they create for me.

I'll first try to look at their docs; if I'm lucky, there is a well documented API for Nemo... Just hope I don't have to do it in Java, but this should be very unlikely. :D

From what I can still remember, it would be pretty easy. basically nautilus and nemo are still very similar, and porting our script is just a matter of a couple lines of code like switching nautilus.menuprovider to nemo.menuprovider. unfortunately, right now, I don't have time to read the documentation and do the code and testing.

Lich-Corals commented 9 months ago

@Username23453, thanks for all the links, I'll definitely take a look at them. Maybe I can get some inspiration on how this program can get improved from those other solutions.

@derVedro, also thanks for your reply; I think I could find the time to read the docs in the next few days or on the weekend. I think it's also a good opportunity for me to learn some new stuff.

Lich-Corals commented 8 months ago

A quick status update: I researched a bit in the last few days. So far, it seems like it's much harder to extend Nemo in the way this project would need to.

So far, I mainly tried to create a nemo-action to run the python script with arguments. This solution could possibly work by showing up a pop-up with a further context menu, where the user would be able to choose the file format. For this solution, I'd have to add a new function to the main script, which would run the right converter functions based on arguments given by the nemo-action. The main problem with this solution is, that nemo-actions can't have any complex logic for the conditions when which context menu should be shown. This means, that I had to add a pop-up, which adds the needed UI, which, for nautilus, would be in a dynamically created submenu.

There seems to be another option to extend Nemo, It's called 'Nemo scripts'. I didn't look at it in detail, but the name at least sounds promising.

My main goal is to create a solution, which is as compact and easy to install as possible, while keeping the simple UI of the converter. I'll continue researching and trying out different solutions; if someone has further hints on how to achieve this goal, I'd be happy to know their ideas.

Username23453 commented 8 months ago

@Lich-Corals, thanks for your effort. :)

Since, it appears, you're so close to finishing it, why dont you just create one that has options in the context menu, instead of further in the submenus? Of course the latter is ideal, but why not just do the former for now, until you solve your problem? :)

2.) Also you could make it run like a program that comes up under the "Open with >" submenu.

Lich-Corals commented 8 months ago

@Username23453, I'll continue working on it later. If nothing unexpected interrupts me, I'll hopefully finish the adaption in the next few days or weeks; how soon it'll be depends very strong on how much time I have to work on it.

Thanks for all of your feedback and ideas you shared over the past time; you really help bringing the tool to more people. :)

Lich-Corals commented 8 months ago

Status update: I finally finished the first version of the adaption. You can already import it from the dev branch, but it has no documentation so far. If you have Nautilus still installed, you should be able to use the extension by copying the .py and .nemo_action file into the /home/username/.local/share/nemo/actions/ folder. You may need to enable it in the settings. It's important that the python file is executable as a program, you can achive it py running 'chmod +x filename.py' in a terminal. I'll update the readme soon, but if you want, you can already test it and tell me what you think about it.

Username23453 commented 8 months ago

@Lich-Corals , great job! it works great! :) Thank you! One suggestion for this, an improvement, is that when it creates a new file, I'd recommend telling the script to add more characters to the file name, otherwise, you added multiple PNG output options, if I choose more than one, it will rewrite over themselves, only allowing me to output one PNG file. Also, JPEG is the first option, and i already accidentally clicked it once already, and it converted my jpeg to jpeg, and it lost file size, which i think means it lost quality. And I have no way to "undo" that. I was using it on test images anyway, so I didnt lose anything, but I think adding this feature is a good idea. If you tell it to add to the filename, the jpeg would not have rewritten over itself. I have a script i wrote that is a toolbar button, that converts any clipboard/screenshot image to PNG and auto save to my download folder and renames it random file name characters, however, once i finished this script, someone pointed out that theres no need to tell it to choose a series of random characters for a file name to prevent repetition and error. You can just tell the script to name the file what the current date and time is, as that never repeats itself. I never rewrote the script because it worked fine and I dont have the time to, but let me know if you want my script.

In summary, i recommend (original file name) + (date) + (current time, to the second)

Lich-Corals commented 8 months ago

Thanks for the feedback! I added your recommendation to my to-do list for the project. I will first update the readme, then I can have a look at what to do next.

derVedro commented 8 months ago

Lol, tonight I ported the nautilus script to nemo too. It really wasn't difficult, as I said, only a few trivial changes were necessary. It works exactly like the nautilus extension. I made a nemo branch. Check it out.

Username23453 commented 8 months ago

@derVedro , thanks! thats cool, and it can do audio files and video? I've been looking for that ever since i moved from windows to linux. Also when it converts to video, what bitrate is it using and what scanning method? "interlaced" or "progressive"?

derVedro commented 8 months ago

@Username23453, the script itself is just a wrapper around ffmpeg, look at this line. if you simplify it, what happens there is this: ffmpeg -i INPUT_FILE -strict experimental OUTPUT_FILE.SOME_EXTENTION

Ffmpeg guesses the format by SOME_EXTENTION and uses some default values. I can't tell you what the values for each format are, but you can try running ffmpeg in console for your cases yourself and look for them. Ffmpeg is a very cool and multifaceted tool. In principle you can add some additional parameters to the fileconverter script, so that each format is processed in a special way, but I don't see much reason in that.

Lich-Corals commented 8 months ago

derVedro , thanks! thats cool, and it can do audio files and video? I've been looking for that ever since i moved from windows to linux. Also when it converts to video, what bitrate is it using and what scanning method? "interlaced" or "progressive"?

Is audio conversion not working in my port, @Username23453?

Username23453 commented 8 months ago

@Lich-Corals, i had no idea yours did that? did u mention it did? Thats cool it does. I just checked and your audio conversion does work for me. :) Just like how I often convert to PNG, i often convert files to FLAC for editing purposes.

Lich-Corals commented 8 months ago

@Lich-Corals, i had no idea yours did that? did u mention it did? Thats cool it does. I just checked and your audio conversion does work for me. :) Just like how I often convert to PNG, i often convert files to FLAC for editing purposes.

I think I didn't directly mention it, but it is mentioned in the features section of the readme. The extension by derVedro is a fork of this one; it's also using the same method, so both should return the same results.

Lich-Corals commented 8 months ago

@Lich-Corals , great job! it works great! :) Thank you! One suggestion for this, an improvement, is that when it creates a new file, I'd recommend telling the script to add more characters to the file name, otherwise, you added multiple PNG output options, if I choose more than one, it will rewrite over themselves, only allowing me to output one PNG file. Also, JPEG is the first option, and i already accidentally clicked it once already, and it converted my jpeg to jpeg, and it lost file size, which i think means it lost quality. And I have no way to "undo" that. I was using it on test images anyway, so I didnt lose anything, but I think adding this feature is a good idea. If you tell it to add to the filename, the jpeg would not have rewritten over itself. I have a script i wrote that is a toolbar button, that converts any clipboard/screenshot image to PNG and auto save to my download folder and renames it random file name characters, however, once i finished this script, someone pointed out that theres no need to tell it to choose a series of random characters for a file name to prevent repetition and error. You can just tell the script to name the file what the current date and time is, as that never repeats itself. I never rewrote the script because it worked fine and I dont have the time to, but let me know if you want my script.

In summary, i recommend (original file name) + (date) + (current time, to the second)

@Username23453, I just published a new release with your suggestion to add timestamps to the filename. Should be working if you update the script (or restart the file manager in a few minutes; auto-updates should detect the update by then.). I hope this solution is working for you!

Username23453 commented 8 months ago

@Lich-Corals ,yep time stamps works now! :) awesome!