Install ComicStreamer Raspberry Pi for Comic Server

comicstreamer-with-text-2ComicStreamer can help you view your digital comic collection across your network. It is similar to Ubooquity but written in Python and only supports .cbr and .cbz files. ComicStreamer turns your Raspberry Pi into a comic server that will stream your comic collection to your reading devices so you can sync your library with your e-reader or just view comics in a web browser. Couple ComicStreamer with nag free dynamic DNS and you can access your comics away from home as well. Have a look at Mylar for autofilling gaps in your comic collection.This guide should work on any Ubuntu/Debian based Linux system and was tested on the Raspberry Pi 2 but should work on the B+ and earlier models. I can also confirm it works on the Banana Pi. I will be integrating it into my Media Server Installer in the coming weeks.

If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.

Updated January 3rd 2016 to work with Jessie

Pi Unit
Processor
RAM
RAM Bus
Network
WiFi
USB
SATA
Cost
Raspberry Pi 3
1.2 GHz ARMv8
Quad Core
1 GB DDR2
450 MHz
100 Mbit
Yes
4
No
$35
Raspberry Pi 2
900 MHz ARMv7
Quad Core
1 GB DDR2
450 MHz
100 Mbit
No
4
No
$35.00
Raspberry Pi
700 MHz ARMv6
Single Core
512 MB SDRAM
400 MHz
100 Mbit
No
4
No
$25
Banana Pi
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
No
2
Yes
$36.99
Banana Pi Pro
1 GHz ARMv7
Dual Core
1 GB DDR3
432 MHz
Gigabit
Yes
2
Yes
$45.00

The ComicStreamer interface is not particularly pretty but it is functional, the developer is interested in new CSS so get in touch with him if you want to make ComicStreamer more visually appealing.

comicstreamer main interface

Install ComicStreamer Raspberry Pi

Install the ComicStreamer dependencies, it uses python and some image processing utilities

sudo apt-get update
sudo apt-get install git python-pip python-tornado python-dev python-dateutil libavahi-compat-libdnssd-dev git libtiff*-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms1-dev libwebp-dev build-essential unzip -y

If you get an error that liblcms1-dev is not found it is because the version has changed in the repository, this command will fix it by using liblcms2-dev for Debian Jessie

sudo apt-get install git python-pip python-tornado python-dev python-dateutil libavahi-compat-libdnssd-dev git libtiff*-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev build-essential unzip -y

Install other python dependencies

sudo pip install sqlalchemy watchdog pillow natsort configobj

Install pybonjour (updated link thanks to Jason)

sudo pip install https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz

Build the latest unrar, this grabs the latest version from rarlab, extracts and compiles it

cd /tmp
RARVERSION=$(wget -q http://www.rarlab.com/rar_add.htm -O - | grep unrarsrc | awk -F "[\"]" 'NR==1 {print $2}')
wget $RARVERSION
tar -xvf unrarsrc*.tar.gz
cd unrar
sudo make -j$(ncpu) -f makefile
sudo install -v -m755 unrar /usr/bin

This command clones the latest ComicStreamer into the /opt/comicstreamer location

sudo git clone https://github.com/beville/ComicStreamer.git /opt/comicstreamer

Change ownership of ComicStreamer folder to prevent permission issues

sudo chown -R pi:pi /opt/comicstreamer

Test if ComicStreamer runs at all

python /opt/comicstreamer/comicstreamer

ComicStreamer run on port 32500 so you can go check if it is working by going to a browser and entering http://ip.address:32500.

In the SSH terminal window hit Ctr+C to terminate Comicstreamer for now

Autostart ComicStreamer init.d Script

Let's make ComicStreamer start on boot with an init.d script adapted from here

sudo nano /etc/init.d/comicstreamer

Paste the ComicStreamer init.d script

#!/bin/sh
### BEGIN INIT INFO
# Provides:          ComicStreamer
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: ComicStreamer
# Description:       ComicStreamer shows your cbr and cbz files
### END INIT INFO
 
 
# Documentation available at
# http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html
# Debian provides some extra functions though
. /lib/lsb/init-functions
 
 
DAEMON_NAME="ComicStreamer"
DAEMON_USER="pi"
DAEMON_PATH="/usr/bin/python"
DAEMON_OPTS="/opt/comicstreamer/comicstreamer"
DAEMON_PWD="/opt/comicstreamer"
DAEMON_DESC=$(get_lsb_header_val $0 "Short-Description")
DAEMON_PID="/opt/comicstreamer/${DAEMON_NAME}.pid"
DAEMON_NICE=0
DAEMON_LOG='/var/log/comicstreamer.log'
 
[ -r "/etc/default/${DAEMON_NAME}" ] && . "/etc/default/${DAEMON_NAME}"
 
do_start() {
  local result
 
	pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
	if [ $? -eq 0 ]; then
		log_warning_msg "${DAEMON_NAME} is already started"
		result=0
	else
		log_daemon_msg "Starting ${DAEMON_DESC}" "${DAEMON_NAME}"
		touch "${DAEMON_LOG}"
		chown $DAEMON_USER "${DAEMON_LOG}"
		chmod u+rw "${DAEMON_LOG}"
		if [ -z "${DAEMON_USER}" ]; then
			start-stop-daemon --start --quiet --oknodo --background \
				--nicelevel $DAEMON_NICE \
				--chdir "${DAEMON_PWD}" \
				--pidfile "${DAEMON_PID}" --make-pidfile \
				--exec "${DAEMON_PATH}" -- $DAEMON_OPTS
			result=$?
		else
			start-stop-daemon --start --quiet --oknodo --background \
				--nicelevel $DAEMON_NICE \
				--chdir "${DAEMON_PWD}" \
				--pidfile "${DAEMON_PID}" --make-pidfile \
				--chuid "${DAEMON_USER}" \
				--exec "${DAEMON_PATH}" -- $DAEMON_OPTS
			result=$?
		fi
		log_end_msg $result
	fi
	return $result
}
 
do_stop() {
	local result
 
	pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
	if [ $? -ne 0 ]; then
		log_warning_msg "${DAEMON_NAME} is not started"
		result=0
	else
		log_daemon_msg "Stopping ${DAEMON_DESC}" "${DAEMON_NAME}"
		killproc -p "${DAEMON_PID}" "${DAEMON_PATH}"
		result=$?
		log_end_msg $result
		rm "${DAEMON_PID}"
	fi
	return $result
}
 
do_restart() {
	local result
	do_stop
	result=$?
	if [ $result = 0 ]; then
		do_start
		result=$?
	fi
	return $result
}
 
do_status() {
	local result
	status_of_proc -p "${DAEMON_PID}" "${DAEMON_PATH}" "${DAEMON_NAME}"
	result=$?
	return $result
}
 
do_usage() {
	echo $"Usage: $0 {start | stop | restart | status}"
	exit 1
}
 
case "$1" in
start)   do_start;   exit $? ;;
stop)    do_stop;    exit $? ;;
restart) do_restart; exit $? ;;
status)  do_status;  exit $? ;;
*)       do_usage;   exit  1 ;;
esac

Make the ComicStreamer init.d script executable

sudo chmod +x /etc/init.d/comicstreamer

Update the system to run ComicStreamer on boot

sudo update-rc.d comicstreamer defaults

Start the Comicstreamer service

sudo service comicstreamer start