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.
11438 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.
Installation
-
Connect to your slot via SSH.
-
Download Mylar:
git clone https://github.com/MylarComics/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 setuptools -r ~/mylar3/requirements.txtThis 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 = 11438 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 --nolaunchThe first start takes a minute while Mylar creates its database and downloads the weekly pull list.
-
Visit http://server.whatbox.ca:11438 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 Mylar's Discord server, linked from the Mylar website, or open an issue on GitHub.
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 exitSave 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 port11438. -
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:11438.
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 setuptools -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/Mylar are kept. Check the list of changes before updating.
Moving from an older version of this article
Older versions of this article installed Mylar from the original mylar3 project, which is no longer updated. These steps move an existing install in ~/mylar3 to the MylarComics version and keep your settings, database and comics.
-
If you set up automatic restarts, comment out the two
mylar_restart.cronlines in your crontab (EDITOR=nano crontab -e). -
Stop Mylar:
pkill -f mylar3/Mylar.py -
Switch Mylar to the MylarComics version:
cd ~/mylar3 git remote set-url origin https://github.com/MylarComics/mylar3.git git fetch origin git checkout -B stable origin/stable -
If
ls ~/mylar3/config.inishows the file, your settings are still inside~/mylar3(from the version of this article that used~/virtualenv). Move them, with the database, cover cache, logs and backups, to~/.config/Mylar:mkdir -p ~/.config/Mylar cd ~/mylar3 && mv config.ini mylar.db cache logs backup ~/.config/Mylar/ chmod 600 ~/.config/Mylar/config.iniIf
mvsays one of these doesn't exist, that's fine; the others are moved. Skip this step iflssays there is no such file. -
Recreate Mylar's virtual environment:
rm -rf ~/mylar3/venvThen repeat step 3 of Installation.
-
Check the port and login settings:
grep -E '^(http_port|authentication|http_username)' ~/.config/Mylar/config.inihttp_portmust be the port you use, not8090, because the start command doesn't set it. 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. The first start updates your database and settings, which can take a minute.
-
If you use automatic restarts, compare the command in
~/mylar_restart.cronwith step 6 of Installation. If they're the same, uncomment the crontab lines. If not, delete the old lines and follow Automatically Restart from the start; the old script would start a second copy of Mylar.
If nothing else on your slot uses ~/virtualenv, you can delete it with rm -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" sleep 5 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/Comics is 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 11438. Pick a different port for
http_portin~/.config/Mylar/config.iniand start Mylar again. Don't use the default 8090. - Mylar exits right after starting and writes nothing to its log: run the start command from step 6 of Installation without
screen -dmS mylarto see the error. If it listsnatsortunder[MODULES UNAVAILABLE],setuptoolsis missing from Mylar's virtual environment: repeat step 3 of Installation. 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:11438: 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 it,Could not retrieve branch nameorUnable to update readinglist tablein the log: harmless. Mylar logs these on every start when it's installed from git.