Skip to content

Commit

Permalink
Merge pull request #24 from Lich-Corals/dev
Browse files Browse the repository at this point in the history
Apply updates from dev branch
  • Loading branch information
Lich-Corals authored Mar 17, 2024
2 parents c13253e + e2889e4 commit ea0d7c7
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 56 deletions.
96 changes: 61 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

# nautilus-fileconverter-43
# linux-file-converter-addon
[![](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Flichcorals.netlify.app%2Fgnome_look.json)](https://www.gnome-look.org/s/Gnome/p/1965601)

A python script to extend Nautilus using nautilus-python.

![NautilusConverter-1](https://github.com/Lich-Corals/Nautilus-fileconverter-43/assets/111392332/aa7d3d61-8e96-48dd-be10-f3c4ab47ae22) <img src="https://user-images.githubusercontent.com/111392332/226464712-216ef143-6ca7-4c9d-ac15-e51e3a299550.png" alt="drawing" height="256"/>

## 0. ReadMe Contents
1. [Features](#1-features)
2. [Installation](#2-installation)
1. [Install dependencies](#21-install-dependencies)
1. [Install dependencies](#21-dependencies)
2. [Optional dependencies](#22-optional-dependencies)
3. [Install the extension](#23-install-the-extension)
3. [Configuration](#3-configuration)
Expand All @@ -23,7 +21,10 @@ A python script to extend Nautilus using nautilus-python.
8. [Credits](#8-credits)

# 1. Features
This program can convert images, audio files and videos with the help of the default context menu in Nautilus. It works with a single Python script and has few depnendncy programs. It should work with every version of nautilus.
Convert between various image, audio and video formats using the context menu. The addon is written in Python and available for **Nautilus** and **Nemo** file viewers. It adds a new option to the context menu of the file viewer to create an easy way to convert between a huge amount of file types.
The program offers many options to customize the appearance of its context menu. There are also a few extra formats to convert with, which can be added by installing optional dependencies.
The tool has a built-in auto-update function to make sure the newest version is always provided.
Note that the Nemo port is very new and not as well tasted as the Nautilus version. If you experience any bugs, pleas report them on the [issue page](https://github.com/Lich-Corals/linux-file-converter-addon/issues/new/choose).
```mermaid
flowchart TD
A[Supported Image Files]
Expand All @@ -48,24 +49,7 @@ This program can convert images, audio files and videos with the help of the def
*¹ [Needs pyheif](#pyheif-heic-avif).
<br/>*² [Needs jxlpy](#jxlpy-jxl).
# 2. Installation
## 2.1 Install dependencies
The extension has a few dependencies which have to be installed.
###
[nautilus-python](https://github.com/GNOME/nautilus-python) needs to be installed to install extensions:

```bash
Debian based distros:
sudo apt install python3-nautilus

Fedora based distros:
sudo dnf install nautilus-python

Arch based distros:
sudo pacman -Sy python-nautilus
```
###


## 2.1 Dependencies
[pip](https://pypi.org/project/pip/) is a pre-dependency for pillow, it can be installed with the following commands:

```bash
Expand Down Expand Up @@ -98,9 +82,33 @@ Arch based distros:
sudo pacman -S ffmpeg
```

###
## Nautilus specific dependencies
GNOME's file viewer [Nautilus](https://apps.gnome.org/en-GB/app/org.gnome.Nautilus/) should be installed, otherwise it will be hard to install extension to it.

[nautilus-python](https://github.com/GNOME/nautilus-python) needs to be installed to install extensions:

```bash
Debian based distros:
sudo apt install python3-nautilus

Fedora based distros:
sudo dnf install nautilus-python

Arch based distros:
sudo pacman -Sy python-nautilus
```
## Nemo specific dependencies
[Nemo](https://github.com/linuxmint/nemo) needs to be installed.
```bash
Debian based distros:
sudo apt install nemo

Fedora based distros:
sudo dnf install nemo

Arch based distros:
sudo pacman -S nemo
```
## 2.2 Optional dependencies
### pyheif (HEIC, AVIF)
[pyheif](https://pypi.org/project/pyheif/) is needed if you want to convert from **heif** or **avif** format.
Expand All @@ -127,12 +135,13 @@ Note: jxlpy is in a very early state, you may have issues while installing it us
You may need to [install it manually](https://github.com/olokelo/jxlpy#build-it-yourself).

## 2.3 Install the extension
- Download the nautilus-fileconverter.py file from the [release page](https://github.com/Lich-Corals/Nautilus-fileconverter-43/releases).
### Installation for Nautilus
- Download the nautilus-fileconverter.py file from the [release page](https://github.com/Lich-Corals/linux-file-converter-addon/releases).
- Git users can also get the repository with these commands[:](https://bit.ly/3BlS71b)
```bash
git clone https://github.com/Lich-Corals/Nautilus-fileconverter-43
git clone https://github.com/Lich-Corals/linux-file-converter-addon

cd ./Nautilus-fileconverter-43
cd ./linux-file-converter-addon
```
- For a system-wide installation move the file to '/usr/share/nautilus-python/extensions/' using this command in the dictonary with the file:
```bash
Expand All @@ -144,19 +153,34 @@ You may need to [install it manually](https://github.com/olokelo/jxlpy#build-it-
```
- Now you only have to restart Nautilus using the following commands:
```bash
#Quit nautilus
#Quit Nautilus
nautilus -q
#start it again, you can also use the normal launcher.
nohup nautilus & disown
```
### Installation for Nemo
- Download the nautilus-fileconverter.py and the nautilus-fileconverter.nemo_action file from the [release page](https://github.com/Lich-Corals/linux-file-converter-addon/releases).
- Git users can also get the repository with these commands[:](https://bit.ly/3BlS71b)
```bash
git clone https://github.com/Lich-Corals/linux-file-converter-addon
cd ./linux-file-converter-addon
```
- Copy the files into the ~/.local/share/nemo/actions folder:
```bash
mv nautilus-fileconverter.py ~/.local/share/nemo/actions/nautilus-fileconverter.py
mv nautilus-fileconverter.nemo_action ~/.local/share/nemo/actions/nautilus-fileconverter.nemo_action
```
You may need to enable the action in Nemo's settings. To do so, you can open Nemo and go edit>Plugins (or press Alt+P) and check the checkbox labeled with "Convert to..." in the "Actions" area.
# 3. Configuration
The program can be configured using the NFC43-Config.json file, which will be created in the installation dictionary when the script is executed for the first time.
Just modify the file, by changing the 'true' and 'false' values.
If the program is installed in a root location, you need to change the configuration inside the script.
<b>Don't forget to save your changes, and restart nautilus after modifying the configuration!</b>
<b>Don't forget to save your changes, and restart Nautilus after modifying the configuration!</b>
```bash
#Quit nautilus
#Quit Nautilus
nautilus -q
#start it again, you can also use the normal launcher.
Expand All @@ -170,12 +194,14 @@ To <b>manually trigger a self-update</b>, just open the .py file with a text edi
## 3.2 Shown menu items
To turn off the <b>patch note button</b> in the context menu, open the config file with a text editor and set the `showPatchNoteButton` variable to 'false'.
<br/><br/>To turn off the <b>Configure NFC43 button</b> in the context menu, open the config file with a text editor and set the `showConfigHint` variable to 'false'.
Note: This option is not available in Nemo so far.
<br/><br/>To turn off the '<b>convert to square</b>' option, open the config file with a text editor and set the `convertToSquares` variable to 'false'.
<br/><br/>To turn off the '<b>convert to wallpaper</b>' function, open the config file with a text editor and set the `convertToWallpapers` variable to 'false'.
## 3.3 Other options
To turn off the <b>patch note pop-up</b>, open the config file with a text editor and set the `showPatchNotes` variable to 'false'.
To turn off the <b>Double script installation Warning</b>, open the config file with a text editor and set the `checkForDoubleInstallation` variable to 'false'.
Note: This option may be a bit buggy in Nemo, I'll fix it in the future if it appears to be annoying to some users.

# 4. Updating
If the script is installed in the home folder (~/.local/share/nautilus-python/extensions/) or has permissions to write in it's dictionary, it will update automatically as long as the automatic updates aren't disabled.
Expand All @@ -187,7 +213,7 @@ Just right click on an supported file and choose the "Convert to..." option. In

Converting a file can take some time. There is no indicator when the process is done.

If you experience any issues with the extension, please report it on the [issues](https://github.com/Lich-Corals/nautilus-fileconverter/issues) page.
If you experience any issues with the extension, please report it on the [issues](https://github.com/Lich-Corals/linux-file-converter-addon/issues) page.

# 6. Warnings and errors
## WARNING(Nautilus-file-converter)(XXX):
Expand Down Expand Up @@ -229,7 +255,7 @@ The self-update function will not be available.
<br/><br/><b>How to solve?</b><br/>
To remove the release popup, you may disable the corresponding setting. To do this, please follow the instructions on the [configuration page](#3-configuration).
<br/>To get self updates, the script needs the permissions to write to itself. This can be done by changing the file permissions using [chmod](https://www.man7.org/linux/man-pages/man1/chmod.1.html) or by running the script as a privileged user.
<br/>To be able to self-update, the user, who is executing the script (by starting nautilus) needs permissions to edit the script itself.
<br/>To be able to self-update, the user, who is executing the script (by starting Nautilus) needs permissions to edit the script itself.
### (004): No permission to write configuration file
<b>Causes:</b><br/>
Expand All @@ -241,7 +267,7 @@ The self-update function may not be available.
<br/>If self-updating is enabled, the script's configuration will reset when a update is performed.
<br/><br/><b>How to solve?</b><br/>
To fix this, the script needs the permissions to write inside the folder, where it is located. This can be done by changing the folder permissions using [chmod](https://www.man7.org/linux/man-pages/man1/chmod.1.html) or by running the script as a privileged user.
<br/>To use the configuration file, the user, who is executing the script (by starting nautilus) needs permissions create and edit files inside the installation dictionary.
<br/>To use the configuration file, the user, who is executing the script (by starting Nautilus) needs permissions create and edit files inside the installation dictionary.
<br/><br/>To prevent the settings from being reset, you can add a config file to the dictionary. Note that the file will not be update if new configurations are added.

### (005): Double script installation detected
Expand All @@ -262,7 +288,7 @@ If anything is not clear...
<br/>If you have a problem...
<br/>If you need a specific feature...
<br/>If any of your files is not supported...
<br/><b>...feel free to write a [GitHub issue](https://github.com/Lich-Corals/Nautilus-fileconverter-43/issues/new/choose)!</b>
<br/><b>...feel free to write a [GitHub issue](https://github.com/Lich-Corals/linux-file-converter-addon/issues/new/choose)!</b>

# 8. Credits
## Authors
Expand Down
6 changes: 6 additions & 0 deletions nautilus-fileconverter.nemo_action
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Nemo Action]
Name=Convert to...
Comment=Convert file using nautilus-fileconverter
Exec=<nautilus-fileconverter.py %F>
Selection=NotNone
Mimetypes=image/jpeg;image/png;image/bmp;application/postscript;image/gif;image/x-icon;image/x-pcx;image/x-portable-pixmap;image/tiff;image/x-xbm;image/x-xbitmap;video/fli;image/vnd.fpx;image/vnd.net-fpx;windows/metafile;image/x-xpixmap;image/webp;image/avif;image/heif;image/jxl;audio/mpeg;audio/mpeg3;video/x-mpeg;audio/x-mpeg-3;audio/x-wav;audio/wav;audio/wave;audio/x-pn-wave;audio/vnd.wave;audio/x-mpegurl;audio/mp4;audio/mp4a-latm;audio/mpeg4-generic;audio/x-matroska;audio/aac;audio/aacp;audio/3gpp;audio/3gpp2;audio/ogg;audio/opus;audio/flac;audio/x-vorbis+ogg;video/mp4;video/webm;video/x-matroska;video/avi;video/msvideo;video/x-msvideo;video/quicktime;
Loading

0 comments on commit ea0d7c7

Please sign in to comment.