auto-upload-gdrive
Develop a system that can add a torrent on the website, after completing the download it will automatically upload the file to my google drive while showing the upload log to the website so that I can see the procedure of uploading.
- install Qbittorrent command-line version
- Setup after-download-script
- Show real-time log on the website
Install Qbittorrent-nox
In Ubuntu, it's called qBittorrent-nox.
Install qBittorrent-nox
Add the qBittorrent repository:
1 | sudo add-apt-repository -y ppa:qbittorrent-team/qbittorrent-stable |
Install qBittorrent-nox:
1 | sudo apt install -y qbittorrent-nox |
After installation, we can check the qBittorrent-nox version:
1 | qbittorrent-nox --version |
Run qBittorrent-nox as a service
In order to run qBittorrent-nox as a service we need to configure systemd. Create a systemd unit file:
1 | sudo nano /etc/systemd/system/qbittorrent-nox.service |
Add the following content to the file:
1 | [Unit] |
You can change the web interface port if you want.
Start qBittorrent-nox service:
1 | sudo service qbittorrent-nox start |
You can run the following command to make sure that the qBittorrent-nox service is running:
1 | sudo service qbittorrent-nox status |
Also, you can stop or restart the service:
1 | sudo service qbittorrent-nox stop |
To enable qBittorrent-nox to start on boot, run the following command:
1 | sudo systemctl enable qbittorrent-nox |
Testing qBittorrent-nox
Open a browser and enter the URL address
http://<IP_ADDRESS>:8080
, where
<IP_ADDRESS>
is the IP address of your machine. You
can log in to the web UI with the default username (admin
)
and password (adminadmin
).
Setup after-download-script
qbt now doesn't give shell environment by default, you'll either need to specify full path
/usr/bin/rm
or invoke the shell by yourself/usr/bin/sh -c <command>
.
So we need to add /bin/bash /Torrent.bash "%N" "%F"
in
external program field
And create a bash file with content as follows:
1 |
|
Of course, you can add whatever you want into the bash file, I'm just showing my own configuration.
Show real-time log on the website
First, we need to add some blocks to the HTML file:
1 | <p class="log-title">update log</p> |
Then we need to add a new router in the flask code:
1 |
|
The 'ignore' can prevent the system being crashed because of some decoding error...Which is very important
reference
https://lindevs.com/install-qbittorrent-nox-on-ubuntu
https://github.com/qbittorrent/qBittorrent/issues/11042
https://www.reddit.com/r/unRAID/comments/lhilzu/comment/ipckgr1/