Wiki > Mylar
Mylar is an automated comic book (cbr/cbz) downloader for Usenet and BitTorrent users. It keeps a watchlist of series, checks the weekly pull list for new issues, sends them to your download client, then sorts, renames and tags the downloaded files. It can also track story arcs and fill in missing issues from your existing collection.
14063 was randomly generated for this article; you may use any 5-digit port between 10000 and 32767. Mylar's default port, 8090, can't be used on Whatbox.
You will need a free ComicVine API key, which Mylar uses to look up series and issues. Sign in to ComicVine and copy the key from that page before you start.
-
Connect to your slot via SSH.
-
Download Mylar: git clone https://github.com/mylar3/mylar3.git ~/mylar3
-
Create a virtual environment for Mylar and install its requirements: python3 -m venv ~/mylar3/venv ~/mylar3/venv/bin/python -m pip install -r ~/mylar3/requirements.txt
This takes a minute or two.
-
Create the folders for Mylar's settings and your comics, then create the configuration file: mkdir -p ~/.config/Mylar ~/files/Comics touch ~/.config/Mylar/config.ini chmod 600 ~/.config/Mylar/config.ini nano ~/.config/Mylar/config.ini
-
Paste in the following. Replace
YOUR_COMICVINE_API_KEYwith your ComicVine key, and replacechangemewith a unique password for Mylar (do not reuse your Whatbox password). You can change the comic library folder indestination_dirtoo: [Interface] http_port = 14063 http_host = 0.0.0.0 http_username = user http_password = changeme authentication = 2[General] launch_browser = False destination_dir = /home/user/files/Comics [CV] comicvine_api = YOUR_COMICVINE_API_KEYSave with
Ctrl + Sand exit withCtrl + X. Mylar adds the rest of its settings to this file the first time it starts. -
Start Mylar in a screen session: screen -dmS mylar /home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunch
The first start takes a minute while Mylar creates its database and downloads the weekly pull list.
-
Visit http://server.whatbox.ca:14063 and log in with the username and password from step 5. You can watch Mylar's output with
screen -r mylar, and detach again withCtrl + A, thenD.
Configuration
Configure Mylar from its web interface, under the gear icon at the top right. The Mylar documentation covers every setting; these are the first ones to set up:
- Comic Location: under Web Interface → Comic Location. It's already set to
/home/user/files/Comicsby step 5. - Download client: under Download Settings, choose SABnzbd, NZBGet or a torrent client and enter its connection details. Mylar must be able to read the folder your download client saves finished files to.
- Search providers: under Search Providers, add your Usenet indexers and trackers. Prowlarr and Jackett indexers can be added as Newznab or Torznab providers.
- Login: change your username or password under Web Interface → Authentication. Leave the method set to Forms (Login Page).
- Existing collection: to add comics you already have, use Manage → Import a directory. Click Save Changes at the bottom of each page. Settings marked as needing a restart only apply after you restart Mylar, using Restart under the gear icon.
Mylar's settings, database and logs are kept in ~/.config/Mylar, with the logs in ~/.config/Mylar/logs/. For help, read the logs under Logs in the web interface, then ask on the Mylar forum or on Mylar's Discord server, linked from the Mylar website.
Automatically Restart (optional)
-
Create a restart script: touch ~/mylar_restart.cron nano -w ~/mylar_restart.cron
-
Paste in the following: #!/bin/bash if pgrep -fx "/home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunch" > /dev/null then echo "Mylar is running." else echo "Mylar is not running, starting Mylar" screen -dmS mylar /home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunch fi exit
Save and exit.
-
Make the script executable: chmod +x ~/mylar_restart.cron
-
Open your crontab: EDITOR=nano crontab -e
-
Add these lines, then save and exit: @reboot /home/user/mylar_restart.cron >/dev/null 2>&1 */5 * * * * /home/user/mylar_restart.cron >/dev/null 2>&1
HTTPS via Managed Links (optional)
-
On the Manage Links page, click Add a custom app.
-
Name it
mylarand enter port14063. -
Visit https://mylar.example.box.ca and log in.
-
Once the link works, make the plain HTTP port private by setting the bind address to
127.0.0.1. Stop Mylar first, as it can rewriteconfig.iniwhile it's running: pkill -fx "/home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunch" sleep 5 sed -i 's|^http_host = 0.0.0.0|http_host = 127.0.0.1|' ~/.config/Mylar/config.ini screen -dmS mylar /home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunchApps on your slot that talk to Mylar keep working if they use
http://127.0.0.1:14063.
Updating
-
If you set up the restart script, comment out its two lines in your crontab (
EDITOR=nano crontab -e) so it doesn't restart Mylar mid-update. -
Stop Mylar: pkill -fx "/home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunch"
-
Download the latest version and update its requirements: cd ~/mylar3 && git pull ~/mylar3/venv/bin/python -m pip install -r ~/mylar3/requirements.txt
-
Start Mylar again with the command from step 6 of Installation, and uncomment the crontab lines. Your settings and database in
~/.config/Mylarare kept. Check the release notes before updating.
Upgrading from the previous version of this article
The previous instructions used a shared virtualenv in ~/virtualenv and kept Mylar's settings and database inside ~/mylar3. Moving them to ~/.config/Mylar keeps them separate from the program files.
-
If you set up automatic restarts, remove the old
mylar_restart.cronlines from your crontab (EDITOR=nano crontab -e). -
Stop Mylar: pkill -f mylar3/Mylar.py
-
Move your settings, database, cover cache, logs and backups, and update Mylar: mkdir -p ~/.config/Mylar cd ~/mylar3 && mv config.ini mylar.db cache logs backup ~/.config/Mylar/ chmod 600 ~/.config/Mylar/config.ini git pull
If
mvsays one of these doesn't exist, that's fine; move the others. -
Repeat step 3 of Installation to create Mylar's own virtual environment.
-
Check the port and login settings: grep -E '^(http_port|authentication|http_username)' ~/.config/Mylar/config.ini
The new start command no longer sets the port with
-p, sohttp_portmust be the port you use, not8090. If it isn't, change it withnano ~/.config/Mylar/config.ini. Ifauthenticationis0orhttp_usernameis empty, anyone can open your Mylar: add the lines from step 5 of Installation under[Interface]before continuing. -
Start Mylar with the command from step 6 of Installation, and log in as before.
-
If you want automatic restarts, follow Automatically Restart from the start. The old script doesn't match the new command, and would start a second copy of Mylar. If nothing else on your slot uses
~/virtualenv, you can delete it withrm -r ~/virtualenv.
Uninstalling
-
If you set up automatic restarts, remove the two
mylar_restart.cronlines from your crontab (EDITOR=nano crontab -e). -
Stop Mylar and delete its files: pkill -fx "/home/user/mylar3/venv/bin/python /home/user/mylar3/Mylar.py --datadir /home/user/.config/Mylar --nolaunch" rm -rf ~/mylar3 ~/.config/Mylar rm -f ~/mylar_restart.cron
-
If you set up a Managed Link, delete it from the Manage Links page. Your comic library in
~/files/Comicsis left in place; delete it separately if you no longer need it.
Troubleshooting
- Mylar exits immediately complaining that the port is in use: another program is using 14063. Pick a different port for
http_portin~/.config/Mylar/config.iniand start Mylar again. Don't use the default 8090. ModuleNotFoundError: No module named ...: the requirements aren't installed in Mylar's virtual environment, or Mylar was started with the systempython3. Repeat step 3 of Installation and always start Mylar with~/mylar3/venv/bin/python.- The page doesn't load at http://server.whatbox.ca:14063: check
http_hostinconfig.ini. It must be0.0.0.0for direct access;127.0.0.1only allows the Managed Link. - Forgot your Mylar password: stop Mylar, set a new
http_passwordunder[Interface]in~/.config/Mylar/config.ini, and start Mylar again. - Two copies of Mylar are running, or the restart script never starts it: the command in
mylar_restart.cronmust match the command you start Mylar with exactly. Stop both withpkill -f mylar3/Mylar.py, fix the script, and start Mylar once. Output does not look like a hash, not using itin the log: harmless. Mylar logs this on every start when it's installed from git.