fixed(mover-script): fixed inaccuracies and update qbittorrent (#1648)

pull/1658/head
zakary 1 year ago committed by GitHub
parent 339fe13a43
commit 69d980761e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -220,7 +220,7 @@ Click on the cogwheel of the new script in the list.
![!Select user script](images/Unraid-settings-user-scripts-edit-deluge-mover.png)
Copy/Paste the following in the new window that opens, then click `SAVE CHANGES`.
Choose your method (select a tab) and copy/paste the script in the new window that opens, then click `SAVE CHANGES`.
=== "Python (Native)"
``` bash
@ -238,7 +238,7 @@ Copy/Paste the following in the new window that opens, then click `SAVE CHANGES`
#!/bin/bash
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "Deluge Mover" -d "Deluge Mover starting @ `date +%H:%M:%S`."
echo "executing script to pause torrents and run mover."
/mnt/user/data/scripts/venv/bin/python3 /mnt/user/data/scripts/deluge-mover.py
/mnt/user/data/scripts/.venv/bin/python3 /mnt/user/data/scripts/deluge-mover.py
echo "deluge-mover completed and resumed all paused torrents."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "Deluge Mover" -d "Deluge Mover completed @ `date +%H:%M:%S`."
```
@ -263,5 +263,3 @@ You can generate your scheduling [HERE](https://crontab.guru/)
![!Set Run Time](images/Unraid-settings-user-scripts-deluge-mover-cron.png)
{! include-markdown "../../../../includes/support.md" !}
<!-- --8<-- "includes/support.md" -->

@ -1,27 +1,27 @@
# How to run the unRaid mover for qBittorent seeding torrents
# unRAID Mover and qBittorrent
When you make use of the unRaid cache drive for your `/data/torrents` share and the torrents in qBittorent are still seeding then the mover can't move files, because they are still in use.
When you make use of the unRAID cache drive for your `/data/torrents` share, and the torrents in qBittorrent are still seeding, the mover can't move files since they are still in use.
Using the following instructions you will be able to move the files with the use of the qBittorrent API.
Using the following instructions will allow you to move the files with the use of the qBittorrent API.
!!! abstract "Workflow Rules - [Click to show/hide]"
!!! abstract "Workflow Rules"
1. Pause torrents older than last x days.
1. Run the mover.
1. Resume the torrents once the mover is completed.
1. Pause torrents in a specified age range that reside on your cache drive.
1. Run the unRAID mover.
1. Resume the torrents after the mover has completed.
!!! warning
The screenshots are just examples to show you how it should look and where you need to place the data that you need to add, they aren't always a 100% reflection of the actual data and not always 100% up to date with the actual data you need to add.
The screenshots below are only **EXAMPLES** to show you how it should look and where you need to place the data that you need to add. They are **NOT** always a 100% reflection of the actual data, and not always the actual values you need to add.
- Always follow the data described in the guide.
- If you got any questions or aren't sure just click the chat badge to join the Discord Channel where you can ask your questions directly.
- Always follow the recommendations described in the guide.
- If you have any questions, or aren't sure, just click the chat badge to join the Discord Channel where you can ask your questions directly.
## Needed
### The Script
### qBit-Mover script
Download the following standalone script.
Download the following standalone Python script.
- [Script (mover.py)](https://raw.githubusercontent.com/StuffAnThings/qbit_manage/master/scripts/mover.py){:target="_blank" rel="noopener noreferrer"}
@ -37,117 +37,109 @@ Install the following Plugins.
- python-setuptools <sup>(*1*)</sup>
- python-pip <sup>(*1*)</sup>
!!! info "<sup>(*1*)</sup> These needs to be installed from the NerdTools."
!!! info "<sup>(*1*)</sup> These need to be installed from NerdTools."
------
## Setup
After you installed the needed Plugins it's time to configure everything.
After you install the needed `Plugins` - it's time to configure everything.
### qBit API
### `qbittorrent-api` module
The script needs the qBit API to work, so we need to make sure it's installed when your unRaid server is booted or when the Array is started the first time.
The script needs the qbittorrent-qpi module to work, so we need to make sure it's installed when your unRAID server starts, or when the Array is started the first time.
You can choose from the following 3 options how you want to install it, depending what you preference.
You can choose one of the following 3 options (select a tab) to install `qbittorrent-api`.
- [User scripts](#user-scripts)
- [Go File](#go-file)
- [Python venv](#python-venv)
=== "User scripts"
With this option, we're going to install the `qbittorrent-api` module when the Array is started the first time.
#### User scripts
In your unRAID Dashboard, go to your `Settings` tab and select `User Scripts` in the `User Utilities` section at the bottom.
With this option we're going to install the qBit API when the Array is started the first time.
![!User Scripts](images/Unraid-settings-user-scripts-icon.png)
Go to your unRaid Dashboard to your settings tab and select in the `User Utilities` at the bottom the new plugin you installed `User Scripts`.
At the bottom of the `User Scripts` page select the `ADD NEW SCRIPT` button.
![!User Scripts](images/Unraid-settings-user-scripts-icon.png)
Select at the bottom `ADD NEW SCRIPT`.
![!Add New Script](images/Unraid-user-scripts-add-new-script-icon.png)
![!Add New Script](images/Unraid-user-scripts-add-new-script-icon.png)
A popup will appear where you can give it a name, for this example we're going to use `Install qBittorrent API` and then click on `OK`.
A popup will appear asking you to name the script. For this example, we're going to use `Install qBittorent-API` and then click on `OK`.
![!Install qBittorrent API](images/Unraid-user-scripts-add-new-script-enter-name.png)
![!Install qBittorrent API](images/Unraid-user-scripts-add-new-script-enter-name.png)
Click in the list on the cogwheel of the new user scrip you made.
Click on the cogwheel of the new script in the list, and select `Edit Script`.
![!Select user script](images/Unraid-settings-user-scripts-list-select-qbit-api.png)
![!Select user script](images/Unraid-settings-user-scripts-list-select-qbit-api.png)
Copy/Paste in the new windows that opens the following bash command followed by `SAVE CHANGES`.
Copy/Paste the following in the new window that opens, then click `SAVE CHANGES`.
```bash
#!/bin/bash
pip3 install qbittorrent-api
```
```bash
#!/bin/bash
pip3 install qbittorrent-api
```
![!Bash script](images/Unraid-settings-user-scripts-qbit-api.png)
![!Bash script](images/Unraid-settings-user-scripts-qbit-api.png)
Select in the schedule list when the script should run, and choose `At First Array Start Only`.
Select in the schedule list when the script should run, and choose `At First Array Start Only`.
![!Set Run Time](images/Unraid-settings-user-scripts-qbit-api-schedule.png)
![!Set Run Time](images/Unraid-settings-user-scripts-qbit-api-schedule.png)
Click on `RUN IN BACKGROUND` or restart your unRaid server so the qBit API is installed.
Click on `Apply`.
![!RUN IN BACKGROUND](images/Unraid-settings-user-scripts-qbit-api-run-background.png)
Finally, you will need to choose `RUN IN BACKGROUND` or restart your unRAID server to install the `qbittorrent-api` module.
------
![!RUN IN BACKGROUND](images/Unraid-settings-user-scripts-qbit-api-run-background.png)
#### Go File
=== "Python venv"
With this option, we're going to create a [Python virtual environment](https://docs.python.org/3/library/venv.html) on our disk. We will use this to run and store dependencies (`qbittorrent-api`) for this specific environment.
With this option we're going to install the qBit API when the unRaid server is started.
By doing this, we will **only need to configure this once** and it will be persistent after reboots *(this differs from the previous steps)*.
On your USB stick/key go to `/boot/config` and open the `go` file with your favorite editor ([VSCode](https://code.visualstudio.com/){:target="_blank" rel="noopener noreferrer"}/[Notepad++](https://notepad-plus-plus.org/downloads/){:target="_blank" rel="noopener noreferrer"}) and copy/paste the following command.
```bash
pip3 install qbittorrent-api
```
Restart your unRaid Server, or run the above command from the terminal.
------
First, you need to choose a location to start a new Python environment.
#### Python venv
!!! info
In the next steps, you will be asked to choose a [location to store the script](#copy-script-to-your-preferred-location), try to be consistent.
With this option we're going to create a [Python virtual environment](https://docs.python.org/3/library/venv.html) on our disks to run and store isolated dependencies for this specific environment.
Suggestions:
By doing so, we **only need to setup this step once** and it will be persistent after reboots _(this differs from the previous steps)_.
- `/mnt/user/appdata/qbittorrent/scripts/.venv`
- `/mnt/user/data/scripts/.venv`
First, you need to choose a location to start a clear python environment.
Run the following command in unRAID's terminal in the directory you chose:
!!! info
In the next steps, you will be ask to choose a [location to place the script](#copy-script-to-your-preferred-location), try to be consistent.
```bash
python3 -m venv --clear /mnt/user/data/scripts/.venv
```
Suggestions:
We now need to enter this new environment and install our dependency (`qbittorrent-api`) in it, run:
- `/mnt/user/appdata/qbittorrent/scripts/.venv`
- `/mnt/user/data/scripts/.venv`
```bash
source /mnt/user/data/scripts/.venv/bin/activate
pip3 install qbittorrent-api
deactivate # to leave the environment
```
Run the following command on Unraid terminal within the location you chose:
!!! info
Replace `/mnt/user/data/scripts/.venv` with the path you have chosen.
=== "Go File"
With this option, we're going to install the `qbittorrent` module when the unRAID server is started.
```bash
python3 -m venv --clear /mnt/user/data/scripts/.venv
```
On your USB stick/key go to `/boot/config` and open the `go` file with your text editor ([VSCode](https://code.visualstudio.com/){:target="_blank" rel="noopener noreferrer"}/[Notepad++](https://notepad-plus-plus.org/downloads/){:target="_blank" rel="noopener noreferrer"}).
We now need to enter into this new environment to install our dependencies (`qbittorrent-api`) on there, run:
Copy/paste the following command
```bash
source /mnt/user/data/scripts/.venv/bin/activate
pip3 install qbittorrent-api
deactivate # to leave the environment
```
```bash
pip3 install qbittorrent-api
```
!!! info
Replace the `/mnt/user/data/scripts/.venv` to the chosen path before.
Restart your unRAID Server or run the above command from the terminal.
------
### Script
Edit the script with your favorite editor ([VSCode](https://code.visualstudio.com/){:target="_blank" rel="noopener noreferrer"}/[Notepad++](https://notepad-plus-plus.org/downloads/){:target="_blank" rel="noopener noreferrer"}) you downloaded at the beginning of the guide [HERE](#the-script).
Now, using your favorite text editor ([VSCode](https://code.visualstudio.com/){:target="_blank" rel="noopener noreferrer"}/[Notepad++](https://notepad-plus-plus.org/downloads/){:target="_blank" rel="noopener noreferrer"}) edit the script you downloaded at the beginning of the guide ([HERE](#qbit-mover-script)).
You only need to edit a few options in the script
You only need to change a few options at the top of the script.
```python
# --DEFINE VARIABLES--#
@ -177,9 +169,9 @@ qbt_pass = None
- If you use `Mover Tuning` but **don't** want to use it for the script, do not change **line 68**
- If you use `Mover Tuning` and **do** want to use it for the script, change **line 68** from `os.system('/usr/local/sbin/mover.old start')` to `os.system('/usr/local/sbin/mover start')`. For this option, inside the `Mover Tuner` options you will also need to set `Move Now button follows plugin filters` to `Yes` and `Disable Mover running on a schedule` to `No`.
#### Copy script to your preferred location
#### Copy the script to your preferred location
Now it's time to place the script you just edited somewhere easy to access/remember.
Place the script you just edited somewhere easy to access/remember.
Suggestions:
@ -188,58 +180,64 @@ Suggestions:
#### Final steps
Now it's time to setup the scheduler when the mover should run.
Set up the scheduler for when the mover should run.
Go to your unRaid Dashboard to your settings tab and select in the `User Utilities` at the bottom the new plugin you installed `User Scripts`.
In your unRAID Dashboard, go to your `Settings` tab and select `User Scripts` in the `User Utilities` section at the bottom.
![!User Scripts](images/Unraid-settings-user-scripts-icon.png)
Select at the bottom `ADD NEW SCRIPT`.
At the bottom of the `User Scripts` page select the `ADD NEW SCRIPT` button.
![!Add New Script](images/Unraid-user-scripts-add-new-script-icon.png)
A popup will appear where you can give it a name, for this example we're going to use `qBittorrent Mover` and then click on `OK`.
A popup will appear asking you to name the script. For this example, we're going to use `qBittorrent Mover` and then click on `OK`.
![!qBittorrent Mover](images/Unraid-user-scripts-add-new-script-enter-name-qbt.png)
Click in the list on the cogwheel of the new user scrip you made.
Click on the cogwheel of the new script in the list.
![!Select user script](images/Unraid-settings-user-scripts-list-select-qbit-mover.png)
Copy/Paste in the new windows that opens the following bash command followed by `SAVE CHANGES`.
```bash
#!/bin/bash
#source /mnt/user/data/scripts/.venv/bin/activate
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "qBittorrent Mover" -d "qBittorrent Mover starting @ `date +%H:%M:%S`."
echo "executing script to pause torrents and run mover."
python3 /mnt/user/data/scripts/mover.py
echo "qbittorrent-mover completed and resumed all paused torrents."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "qBittorrent Mover" -d "qBittorrent Mover completed @ `date +%H:%M:%S`."
```
Choose your method (select a tab) and copy/paste the script in the new window that opens, then click `SAVE CHANGES`.
=== "Python (Native)"
``` bash
#!/bin/bash
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "qBittorrent Mover" -d "qBittorrent Mover starting @ `date +%H:%M:%S`."
echo "executing script to pause torrents and run mover."
python3 /mnt/user/data/scripts/mover.py
echo "qbittorrent-mover completed and resumed all paused torrents."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "qBittorrent Mover" -d "qBittorrent Mover completed @ `date +%H:%M:%S`."
```
=== "Python (venv)"
``` bash
#!/bin/bash
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "qBittorrent Mover" -d "qBittorrent Mover starting @ `date +%H:%M:%S`."
echo "executing script to pause torrents and run mover."
/mnt/user/data/scripts/.venv/bin/python3 /mnt/user/data/scripts/mover.py
echo "qbittorrent-mover completed and resumed all paused torrents."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "qBittorrent Mover" -d "qBittorrent Mover completed @ `date +%H:%M:%S`."
```
!!! info
Replace the `/mnt/user/data/scripts/mover.py` path to the path where you placed your python script.
!!! danger
**Only** if you are using the [Python venv](#python-venv) method:
- Uncomment **line 2** (remove just the `#` character)
- Replace the `/mnt/user/data/scripts/.venv` part to the path where you created the python env, **keep the rest**
Replace `/mnt/user/data/scripts/` in the script with the path you have chosen for the Python script.
![!Bash script](images/Unraid-settings-user-scripts-qbit-mover.png)
Select in the schedule list when the script should run, and choose `Custom`
Click the schedule dropdown to choose when the script should run. We want to select `Custom`.
![!Set Run Time](images/Unraid-settings-user-scripts-qbit-mover-schedule.png)
After changing to `Custom` you get on the right a extra option where you can setup your cron schedule when it should be run.
After changing to `Custom` you will get an extra text field on the right where you can set your schedule (cron).
For this example, we're going to tell the script to run every day at 4 AM.
For this example we're going to let the script run a 4am at night. `0 4 * * *`
`0 4 * * *`
Setup your own schedule [HERE](https://crontab.guru/)
You can generate your scheduling [HERE](https://crontab.guru/)
![!Set Run Time](images/Unraid-settings-user-scripts-qbit-mover-cron.png)
--8<-- "includes/support.md"
{! include-markdown "../../../../includes/support.md" !}

Loading…
Cancel
Save