DIY Raspberry Pi Downloadbox
by Jovian_Dsouza in Circuits > Raspberry Pi
2660 Views, 5 Favorites, 0 Comments
DIY Raspberry Pi Downloadbox
Do you often find yourself downloading large files such as movies, torrents, courses, TV series, etc then you come to the right place. In this Instructable, we would be turning our Raspberry Pi zero into a downloading machine. Which can download anything ranging from one click hosters, Youtube videos, games, torrents, anything that is available on the internet.
The best part is that we can run the Raspberry Pi zero 24/7 and even schedule downloads as required. Since the Pi runs only 5v we can even power it on a power bank thereby ensuring that our downloads never stop.
All this magic is possible because of this powerful software called Pyload , and yeah, you guessed it right it's based on Python. Pyload supports multiple protocols such as HTTP, FTP and so on. It has a nice clean web interface. Pyload also has its own mobile clients for Android and iOS. This allows to easily monitor and manage your downloads.
Supplies
So for the hardware we need a Raspberry Pi(obviously), I am using the Pi zero w, since it is the cheapest, but this method can be done using any raspberry pi. We also need a 5v MicroUSB Power supply, normal phone charger will do the job and for the storage, we need a micro SD card. Here I am using a 8 GB SDcard, you might want to choose a higher capacity card if you intend to store the downloaded files on the SDcard or You can also attach a USB flash drive to store the downloaded media. It's all a personal choice.
Installing Raspbian
Now download the latest Raspbian lite and flash it to the micro SDcard, I like to use a free tool called Etcher for this purpose.
Since we are going for a headless setup we need to do some additional settings. For this, we need to add two files to the boot partition of the SDcard. They are wpa_supplicant.conf and ssh, I have attached these files for you simply copy-paste them in your boot partition. Also don't forget to update the wpa_supplicant.conf file with your WiFi username and password.
Eject the card from Your PC and insert it into the Raspberry Pi , Plug in the powersupply and wait for it to connect to your WiFi network. Now to access the PI using SSH we need to find the IP address of your device. The IP address can be found using a tool such as Angry-ip-scanner or you could just lookup for the DNS clients of your router.
Finally, SSH into your device, here I am using Putty.
The default login is pi and password is raspberry. I highly suggest you change the default password
Installing Pyload for Raspberry Pi
Now let's install Pyload. Which simply a matter of copying and pasting the following commands.
First let's create a new system user for running Pyload
sudo adduser -system pyload
Add the following two lines to your /etc/apt/sources.list:
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi deb-src http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
Update the package list and install dependencies that are needed by PyLoad:
sudo apt-get update sudo apt-get -y install git liblept4 python python-crypto python-pycurl python-imaging tesseract-ocr zip unzip python-openssl libmozjs-24-bin sudo apt-get -y build-dep rar unrar-nonfree sudo apt-get source -b unrar-nonfree sudo dpkg -i unrar_*_armhf.deb sudo rm -rf unrar-*
cd /usr/bin ln -s js24 js
Download the current version of PyLoad:
cd /opt sudo git clone https://github.com/pyload/pyload.git cd pyload
Now you can run PyLoad, it will start with a basic configuration menu for the first time.
sudo -u pyload python pyLoadCore.py
If everything is working as expected, You can create a systemd service file in order to start PyLoad when the raspberry pi boots up.
[Unit] Description=Python Downloader After=network.target [Service] User=pyload ExecStart=/usr/bin/python /opt/pyload/pyLoadCore.py [Install] WantedBy=multi-user.target
Then activate this service
sudo systemctl enable pyload.service
Now you can open the web interface and check if it is working as expected
Setting Up Samba Server to Access Our Files
Samba is one of the easiest to set up and configure file servers, which makes it one of the best solutions for setting up a NAS. By using Samba on our Raspberry Pi, we can easily share directories in a way that they can be accessed by any device on the same network.
Download and install the required samba packages
sudo apt-get install samba samba-common-bin
Lets Create a folder where we will store all our downloads
mkdir /home/pi/downloads
Now we have to setup the "smb.conf" configuration file to share this folder using the samba server.
sudo nano /etc/samba/smb.conf
Go to the bottom of this file using the arrow keys and copy and paste this
[downloads] path = /home/pi/downloads writeable=Yes create mask=0777 directory mask=0777 public=no
Then run the following command to set the password for the samba server
sudo smbpasswd -a pi
Finally restart the samba server,
sudo systemctl restart smbd
Adding an OLED Display
What we have done so far is pretty much a very useable setup, but I took an extra step and added an OLED display.
I don't about you, but I have this weird habit to frequently check my download progress. Hence I added this display.
The screen displays the following parameters.
- WiFi network name the Pi is connected
- Download speed
- Download Progress status
- Disk Usage
- IP address
I used an SSD1306 OLED display which uses i2c protocol for communication with the Pi. I found this tutorial which explains how to set up this screen.
Once you are done with the setup, download and run this Python code
git clone https://github.com/Jovian-Dsouza/downloadBox.git cd downloadBox/ sudo chmod +x downloadStats.py sudo python3 downloadStats.py
Make sure to modify the Pyload username and password in the downloadStats.py file in case you changed the default.
The Display should now display the current stats of the Raspberry Pi. If things are working as expected we can create a service to automatically run this python script when the Pi boots up.
First create the service file
sudo nano /etc/systemd/system/downloadStats.service
Then add these following lines
[Unit] Description=Python Downloader Display After=network.target [Service] User=pi ExecStart=/usr/bin/python3 /home/pi/downloadBox/downloadStats.py [Install] WantedBy=multi-user.target
Activate the service using following command:
sudo systemctl enable downloadStats.service