Mirakurun + EPGStation on ArchLinuxで録画鯖を作る

by mohemohe 2019-01-04 15:10

Spinel + TVRock + RecTask on WindowsServer 2012 R2で運用していたけど、Windowsのお守りをするのはしんどくなったので移行した
そのときのメモ

前提

チューナーは KTV-FSPCIE を使用した
泡除去 & R19破壊済み
B-CASカードがはみ出るのが嫌いだからB-CASカードを切断済み

ArchLinuxをインストールする

インストールガイド - ArchWiki

yayを突っ込む(オプション)

sudo pacman -S --noconfirm wget jshon
wget https://raw.githubusercontent.com/oshazard/apacman/master/apacman
chmod +x apacman
./apacman -S --noconfirm yay-bin
rm -f ./apacman

前提パッケージを突っ込む

yay -S nodejs-lts-dubnium npm pm2 python2 ffmpeg

recfsusb2n

sudo mkdir -p /opt/bin /opt/src
sudo chown -R $(id -u):$(id -g) /opt/bin /opt/src
cd /opt/src
git clone -b patch https://github.com/oddmutou/recfsusb2n.git
cd /opt/src/recfsusb2n/src
make
ln -s /opt/src/recfsusb2n/src/recfsusb2n /opt/bin/recfsusb2n

ラッパースクリプト

recfsusb2nとmirakurun連携メモ – 大ちゃんのいろいろ雑記

/opt/bin/recfspcie

#!/bin/bash

PID=$$
trap '[ "`ps -h -o pid --ppid $PID`" ] && kill `ps -h -o pid --ppid $PID`' 0 1 2 3 9 15

/opt/bin/recfsusb2n $@ &

wait

Mirakurun

インストール

sudo npm install mirakurun -g --unsafe-perm --production

設定

sudo mirakurun config tuners
- name: KTV-FSPCIE
  types:
    - GR
  command: /opt/bin/recfspcie --b25 <channel> - -
sudo mirakurun config channels
(空にする)

起動

sudo mirakurun start
sudo pm2 save
sudo pm2 startup

チャンネル設定

curl -X PUT 'http://localhost:40772/api/config/channels/scan'

EPGStation

ユーザー作成

sudo useradd -G sudo,video chinachu #歴史的経緯 sudo要らんくね?
sudo passwd chinachu

インストール

sudo -u chinachu -i
git clone https://github.com/l3tnun/EPGStation.git
cd EPGStation
npm install
npm run build

設定

cp config/config.sample.json /config/config.json
cp config/operatorLogConfig.sample.json /config/operatorLogConfig.json
cp config/serviceLogConfig.sample.json /config/serviceLogConfig.json

ffmpegとffprobeのパスだけ書き換える

/home/chinachu/EPGStation/config/config.json

{
  "ffmpeg": "/usr/bin/ffmpeg",                                                                                                                                                                                                                                                                                           
  "ffprobe": "/usr/bin/ffprobe", 
  ...
}

起動

pm2 start dist/server/index.js --name "epgstation"
pm2 save
pm2 startup
sudo env PATH=$PATH:/usr/local/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u chinachu --hp /home/chinachu

アクセスしてみる

http://172.16.33.3:8888