I had just entered the DS216+II, explored various new features, looked at various posts and looked at how to play NAS. However, it was mentioned that it was used as a reptile, remotely under the American drama and the like, which gave me the idea of ​​an automatic download. Various searches have people in this area, but there is no tool to find this code.
As I had previously played the airline ticket hotel and had done price monitoring in this area, as long as I found a suitable website, it would be natural to crawl the new drama to get the link. In order to achieve automatic download, I took a look at Thunder's remote download, first because I have his members, and on the other hand he is also very convenient to use after installing DSM through docker.
Source code This code needs to run python2 and python3 coexist, but fortunately DSM is already a linux system, comes with python2, and suite center can directly install python3.5, so it is convenient.
The code of Thunder Remote Interface that can be found on the Internet is already many years old. I found one and found that the login part was invalid and rewritten. I've been using python3 to write scripts before, so python2's code hasn't been converted to python3. If there is a big god, it's best to turn around.
The principle of the code is to analyze the subtitle group weekly rankings, and to show the intersection of the collections on the list and the flow of up to two lists, and to add the downloaded parts of the series to the Thunder remote.
download link
Consumption processThe following process may require a certain amount of Linux or Python basics.
1, remote Thunder installed and configured, the center installed Python suite, installed should be Python3.5 version;
2. Enable SSH and SFTP, use WINSCP to connect NAS, and open it with puTTY;
3, put the code into a directory you think is appropriate (use winscp it), and create a new record empty directory in the code directory (used to store the downloaded US drama data);
4, change the config.py user name password and code storage path settings, more settings please refer to the readme file;
5. Run the following command to install the lxml library for python3:
Wget https://bootstrap.pypa.io/get-pip.py
Python3 get-pip.py
Python3 -m pip install lxml
6, run python3 scan.py start script
Advanced useIn accordance with the above process can be achieved link crawl and add to the remote Thunder, but once the console window is closed, the process is over, a simple way is to use the nohup command to achieve the background running process, but the script if the error process Stopped, and you need to restart the command again.
Here is the supervisor to manage the process:
1. Install pip for python2 and install supervisor using pip
Wget https://bootstrap.pypa.io/get-pip.py
Python get-pip.py
Python -m pip install supervisor
2, generate supervisor configuration file
Echo_supervisord_conf > /etc/supervisord.conf
3, open the configuration file generated in the previous step, and add the following content in the file
[program:drama_scan]
# Start command entry
Command=python3 /your/path/to/scan.py
#username of the running command
User=admin
Autostart=true
Autorestart=true
4, enter the command supervisorctl, then enter start drama_scan to start the script, and you can enter the status to view the script status
5, to achieve supervisor boot from start
Haha this is for everyone's homework ~
to sum upThis is a small game for NAS. In fact, some people mentioned it but there are too few tools left. As a person who learns to mechanically write NC code, I hope that everyone likes to write this code through my own exploration of Python. The place where the code is not rigorous, I hope God can take over and optimize.
The current setting is to view the leaderboard every 6 hours. After the task list is calculated, it is added to the Thunder remote every 10 seconds. The first run may add many, many download links.
In addition, a competent friend may wish to add a function to add a download and push it to his own mobile phone. This is equivalent to reminding himself that he can watch a new drama when he returns home today.
Well, lazy once again promote the productivity, and once again liberate your hands ~
Nanjing Jisu Shitong Technology Co., Ltd , https://www.netairs.com