├── .dockerignore ├── LICENSE ├── README.md ├── chinachu-user.service ├── chinachu ├── Dockerfile ├── conf │ ├── config.json │ └── rules.json ├── config.sample.json ├── data │ └── .gitignore └── services.sh ├── docker-compose.yml ├── mirakurun-chinachu.service ├── mirakurun-user.service ├── mirakurun ├── Dockerfile ├── conf │ ├── channels.yml │ ├── server.yml │ └── tuners.yml ├── db │ └── .gitignore ├── mirakurun_status.js └── services.sh └── recorded └── .gitignore /.dockerignore: -------------------------------------------------------------------------------- 1 | recorded 2 | chinachu/conf/rules.json 3 | chinachu/data/* 4 | mirakurun/data/* 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 h-mineta@0nyx.net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-mirakurun-chinachu 2 | Mirakurun と Chinachu をDockerコンテナに閉じ込めました 3 | 4 | ## Constitution 5 | ### Mirakurun 6 | - Alpine Linux 3.8(node:10-alpine) 7 | - [Mirakurun](https://github.com/Chinachu/Mirakurun) 8 | - branch: master 9 | 10 | ### Chinachu 11 | - Alpine Linux 3.8(node:10-alpine) 12 | - [Chinachu](https://github.com/Chinachu/Chinachu) 13 | - branch: gamma 14 | 15 | ## 動作確認環境 16 | > OS 17 | >>CentOS Linux release 7.2.1511 (Core) 18 | >> Linux 3.10.0-327.22.2.el7.x86_64 19 | > 20 | >>Fedora release 25 (Twenty Five) 21 | >> Linux 4.9.4-201.fc25.x86_64 22 | > 23 | >>Fedora release 27 (Twenty Seven) 24 | >> Linux 4.18.12-100.fc27.x86_64 25 | > 26 | >>Fedora release 30 (Thirty) 27 | >> Linux 5.2.18-200.fc30.x86_64 28 | 29 | >Docker 30 | >>version 1.11.2, build b9f10c9 31 | >>version 17.03.0-ce, build 60ccb22 32 | >>version 1.13.1, build 9c9378f-unsupported 33 | >>version 1.13.1, build 47e2230/1.13.1 34 | 35 | >Tuner 36 | >>ISDB-S, ISDB-T Tuner PT3 37 | 38 | >Smart card reader 39 | >>USB SmartCard Reader NTT Communications Corp. SCR3310-NTTCom 40 | 41 | ## 利用方法 42 | - 最新のdocker & docker-compose がインストール済 43 | - SELinuxの無効化 44 | - ホストマシンにPT3 Driverがインストール済 45 | ``` 46 | $ ls -l /dev/pt*video* 47 | crw-rw-rw- 1 root video 246, 0 Jun 26 16:07 /dev/pt3video0 48 | crw-rw-rw- 1 root video 246, 1 Jun 26 16:07 /dev/pt3video1 49 | crw-rw-rw- 1 root video 246, 2 Jun 26 16:07 /dev/pt3video2 50 | crw-rw-rw- 1 root video 246, 3 Jun 26 16:07 /dev/pt3video3 51 | ``` 52 | - B-CAS 用に利用するスマートカードリーダーはMirakurunコンテナ内で管理しますので 53 | ホストマシン上のpcscdは停止してください 54 | ``` 55 | sudo systemctl stop pcscd.socket 56 | sudo systemctl disable pcscd.socket 57 | ``` 58 | 59 | - docker-composeを利用しておりますので、プロジェクトディレクトリ内で下記コマンドを実行してください 60 | プロジェクトディレクトリ名はビルド時のレポジトリ名になりますので、適当に短いフォルダ名が推奨です 61 | 62 | ### 取得例 63 | ```shell 64 | git clone https://github.com/Chinachu/docker-mirakurun-chinachu.git tvs 65 | cd tvs 66 | ``` 67 | ### 起動 68 | ```shell 69 | docker-compose up -d 70 | ``` 71 | ### 停止 72 | ```shell 73 | docker-compose down 74 | ``` 75 | 76 | ### デーモン化(systemd) 77 | 初期では「WorkingDirectory」が「/usr/local/projects/tvs/」となっています 78 | 設置した箇所に応じて、書き換えてください 79 | ```shell 80 | vi mirakurun-user.service 81 | vi chinachu-user.service 82 | ``` 83 | 84 | ユーザ固有サービスとして動かすため、設定します 85 | ```shell 86 | mkdir -p ~/.config/systemd/user/ 87 | mv mirakurun-user.service ~/.config/systemd/user/ 88 | mv chinachu-user.service ~/.config/systemd/user/ 89 | ## 永続化(次回OS起動時に自動で起動) 90 | systemctl --user enable mirakurun-user.service 91 | systemctl --user enable chinachu-user.service 92 | sudo loginctl enable-linger `whoami` 93 | 94 | # 手動起動 95 | systemctl --user start mirakurun-user.service 96 | systemctl --user start chinachu-user.service 97 | 98 | # 動作確認 99 | systemctl --user status mirakurun-user.service 100 | systemctl --user status chinachu-user.service 101 | 102 | # 手動停止 103 | systemctl --user stop mirakurun-user.service 104 | systemctl --user stop chinachu-user.service 105 | ``` 106 | 107 | ## 設定 108 | エリア、環境によって変更が必要なファイルは下記の通りとなります 109 | ### Mirakurun 110 | - ポート番号 : 40772 111 | - mirakurun/conf/tuners.yml 112 | チューナー設定 113 | - mirakurun/conf/channels.yml 114 | チャンネル設定 115 | 116 | ### Chinachu 117 | - ポート番号 : 10772, 20772(local network only), 5353/udp(mDNS) 118 | - chinachu/conf/config.json 119 | チューナー設定 120 | チャンネル設定 121 | 122 | ### 録画ファイル保存先 123 | また録画ファイルはプロジェクトフォルダ内の./recordedに保存されます 124 | > 保存先を別HDDにしたい場合は、docker-compose.ymlの 125 | >> ./recorded:/usr/local/chinachu/recorded 126 | > 127 | > の./recordedを変更することで保存先を変更可能 128 | 129 | ## License 130 | This software is released under the MIT License, see LICENSE. 131 | -------------------------------------------------------------------------------- /chinachu-user.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Chinachu 3 | Requires=mirakurun-user.service 4 | After=mirakurun-user.service 5 | 6 | [Service] 7 | Type=simple 8 | RemainAfterExit=yes 9 | Restart=on-failure 10 | WorkingDirectory=/usr/local/projects/tvs 11 | ExecStart=/usr/local/bin/docker-compose up -d chinachu 12 | ExecStop=/usr/local/bin/docker-compose stop chinacnu 13 | 14 | [Install] 15 | WantedBy=default.target 16 | -------------------------------------------------------------------------------- /chinachu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10-alpine 2 | LABEL maintainer "h-mineta " 3 | 4 | ENV DOCKER="YES" 5 | ARG REPOSITORY="https://github.com/Chinachu/Chinachu.git" 6 | ARG BRANCH="master" 7 | 8 | ARG WORK_DIR="/usr/local/chinachu" 9 | 10 | #node container default value 11 | ARG USER_NAME="node" 12 | 13 | RUN set -x \ 14 | && apk upgrade --update \ 15 | && apk add \ 16 | bash \ 17 | coreutils \ 18 | curl \ 19 | procps \ 20 | ca-certificates \ 21 | \ 22 | && apk add --virtual .build-deps \ 23 | git \ 24 | make \ 25 | gcc \ 26 | g++ \ 27 | autoconf \ 28 | automake \ 29 | wget \ 30 | curl \ 31 | sudo \ 32 | tar \ 33 | xz \ 34 | libc-dev \ 35 | musl-dev \ 36 | eudev-dev \ 37 | libevent-dev \ 38 | perl-utils \ 39 | \ 40 | && mkdir -p ${WORK_DIR} \ 41 | && git clone ${REPOSITORY} ${WORK_DIR} \ 42 | && chown -R ${USER_NAME} ${WORK_DIR} \ 43 | && cd ${WORK_DIR} \ 44 | && git checkout ${BRANCH} \ 45 | && echo 2 | sudo -u ${USER_NAME} ./chinachu installer \ 46 | && echo 4 | sudo -u ${USER_NAME} ./chinachu installer \ 47 | && echo 5 | sudo -u ${USER_NAME} ./chinachu installer \ 48 | && sudo -u ${USER_NAME} ./chinachu service operator initscript | tee /tmp/chinachu-operator \ 49 | && sudo -u ${USER_NAME} ./chinachu service wui initscript | tee /tmp/chinachu-wui \ 50 | && sudo -u ${USER_NAME} mkdir log \ 51 | \ 52 | && chmod u+x /tmp/chinachu-operator /tmp/chinachu-wui \ 53 | && mv /tmp/chinachu-operator /etc/init.d/ \ 54 | && mv /tmp/chinachu-wui /etc/init.d/ \ 55 | \ 56 | # cleaning 57 | && cd / \ 58 | && npm cache verify \ 59 | && apk del --purge .build-deps \ 60 | && rm -rf /var/cache/apk/* 61 | 62 | COPY services.sh /usr/local/bin 63 | COPY config.sample.json ${WORK_DIR} 64 | 65 | WORKDIR ${WORK_DIR} 66 | CMD ["/usr/local/bin/services.sh"] 67 | EXPOSE 10772 20772 5353 68 | -------------------------------------------------------------------------------- /chinachu/conf/config.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chinachu/docker-mirakurun-chinachu/a9a34cdbec84302aed7aa409ce454702ad52a2cb/chinachu/conf/config.json -------------------------------------------------------------------------------- /chinachu/conf/rules.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /chinachu/config.sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "uid" : "node", 3 | "recordedDir" : "/usr/local/chinachu/recorded/", 4 | "temporaryDir": "/tmp/", 5 | 6 | "wuiUsers": [ 7 | "akari:bakuhatsu" 8 | ], 9 | "wuiAllowCountries": ["JP"], 10 | 11 | "wuiPort" : 10772, 12 | "wuiHost" : "::", 13 | "wuiTlsKeyPath" : null, 14 | "wuiTlsCertPath" : null, 15 | "wuiOpenServer" : false, 16 | "wuiOpenPort" : 20772, 17 | "wuiXFF" : false, 18 | "wuiPreviewer" : true, 19 | "wuiStreamer" : true, 20 | "wuiFiler" : true, 21 | "wuiConfigurator" : true, 22 | "wuiMdnsAdvertisement": true, 23 | 24 | "mirakurunPath": "http://container-mirakurun:40772/", 25 | 26 | "recordedFormat": "[][][].m2ts", 27 | 28 | "storageLowSpaceAction": "remove" 29 | } 30 | -------------------------------------------------------------------------------- /chinachu/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /chinachu/services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -s config.json ]; then 3 | cat config.sample.json > config.json 4 | fi 5 | 6 | rm -f /var/run/chinachu-operator.pid > /dev/null 2>&1 7 | rm -f /var/run/chinachu-wui.pid > /dev/null 2>&1 8 | 9 | countdown_max=300 10 | run_countdown=0 11 | while [ ${run_countdown} -le ${countdown_max} ] 12 | do 13 | http_status=`curl -s container-mirakurun:40772/api/status -o /dev/null -w '%{http_code}'` 14 | if [ "${http_status}" = "200" ]; then 15 | run_countdown=0 16 | echo "mirakurun is run complete!" 17 | break 18 | fi 19 | run_countdown=`expr ${run_countdown} + 1` 20 | echo "wait for mirakurun to run...(${run_countdown}sec)" 21 | sleep 1 22 | done 23 | 24 | if [ ${run_countdown} -ge ${countdown_max} ]; then 25 | echo "mirakurun is timeout" 26 | fi 27 | 28 | /etc/init.d/chinachu-operator start 29 | /etc/init.d/chinachu-wui start 30 | 31 | tail -f /dev/null 32 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | mirakurun: 4 | build: 5 | context: mirakurun 6 | container_name: mirakurun 7 | privileged: true 8 | ports: 9 | - "40772:40772" 10 | volumes: 11 | - /etc/localtime:/etc/localtime:ro 12 | - ./mirakurun/conf:/usr/local/etc/mirakurun 13 | - ./mirakurun/db:/usr/local/var/db/mirakurun 14 | 15 | chinachu: 16 | build: 17 | context: chinachu 18 | args: 19 | - REPOSITORY=https://github.com/Chinachu/Chinachu.git 20 | - BRANCH=gamma 21 | container_name: chinachu 22 | ports: 23 | - "10772:10772" 24 | - "20772:20772" 25 | - "5353:5353/udp" 26 | volumes: 27 | - /etc/localtime:/etc/localtime:ro 28 | - ./chinachu/conf/config.json:/usr/local/chinachu/config.json 29 | - ./chinachu/conf/rules.json:/usr/local/chinachu/rules.json 30 | - ./chinachu/data:/usr/local/chinachu/data 31 | - ./recorded:/usr/local/chinachu/recorded 32 | links: 33 | - mirakurun:container-mirakurun 34 | -------------------------------------------------------------------------------- /mirakurun-chinachu.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=All in one Mirakurun & Chinachu 3 | Requires=docker.service 4 | After=docker.service network.target 5 | Conflicts=shutdown.target reboot.target halt.target 6 | 7 | [Service] 8 | Type=simple 9 | RemainAfterExit=yes 10 | Restart=on-failure 11 | WorkingDirectory=/usr/local/projects/tvs/ 12 | ExecStart=/usr/local/bin/docker-compose up -d 13 | ExecStop=/usr/local/bin/docker-compose stop 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /mirakurun-user.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mirakurun 3 | 4 | [Service] 5 | Type=simple 6 | RemainAfterExit=yes 7 | Restart=on-failure 8 | WorkingDirectory=/usr/local/projects/tvs 9 | ExecStart=/usr/local/bin/docker-compose up -d mirakurun 10 | ExecStop=/usr/local/bin/docker-compose stop mirakurun 11 | 12 | [Install] 13 | WantedBy=default.target 14 | -------------------------------------------------------------------------------- /mirakurun/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10-alpine 2 | LABEL maintainer "h-mineta <h-mineta@0nyx.net>" 3 | 4 | ENV DOCKER="YES" 5 | 6 | RUN set -x \ 7 | && apk upgrade --update \ 8 | && apk add \ 9 | bash \ 10 | coreutils \ 11 | libusb \ 12 | pcsc-lite \ 13 | pcsc-lite-libs \ 14 | curl \ 15 | ca-certificates \ 16 | util-linux \ 17 | \ 18 | && apk add --virtual .build-deps \ 19 | git \ 20 | make \ 21 | gcc \ 22 | g++ \ 23 | gzip \ 24 | autoconf \ 25 | automake \ 26 | libc-dev \ 27 | musl-dev \ 28 | eudev-dev \ 29 | libevent-dev \ 30 | pcsc-lite-dev \ 31 | libusb-dev \ 32 | libtool\ 33 | flex\ 34 | \ 35 | && npm install pm2 -g \ 36 | \ 37 | && npm install arib-b25-stream-test -g --unsafe \ 38 | \ 39 | # mirakurun 40 | && npm install mirakurun@latest -g --unsafe --production \ 41 | \ 42 | # recpt1 43 | && git clone https://github.com/stz2012/recpt1 /tmp/recpt1 \ 44 | && cd /tmp/recpt1/recpt1 \ 45 | && ./autogen.sh \ 46 | && ./configure \ 47 | && sed -i '/#include <sys\/msg.h>/d' recpt1core.h \ 48 | && sed -i -E 's!(#include <sys/msg.h>)!#undef _GNU_SOURCE\n#undef _BSD_SOURCE\n\1!' recpt1.c \ 49 | && sed -i -E 's!(#include <sys/msg.h>)!#undef _GNU_SOURCE\n#undef _BSD_SOURCE\n\1!' recpt1ctl.c \ 50 | && sed -i -E 's!(#include <sys/msg.h>)!#undef _GNU_SOURCE\n#undef _BSD_SOURCE\n\1!' checksignal.c \ 51 | && sed -i -E 's!(#include <ctype.h>)!\1\n#include <event.h>!' tssplitter_lite.c \ 52 | && sed -i 's#-I../driver#-I../driver -I/usr/local/include#' Makefile \ 53 | && make \ 54 | && make install \ 55 | \ 56 | # ccid 57 | && cd /tmp \ 58 | && git clone --recursive https://salsa.debian.org/rousseau/CCID.git \ 59 | && cd CCID \ 60 | && ./bootstrap \ 61 | && ./configure \ 62 | && make \ 63 | && make install \ 64 | \ 65 | # cleaning 66 | && cd / \ 67 | && npm cache verify \ 68 | && apk del --purge .build-deps \ 69 | #&& rm -rf /tmp/* \ 70 | && rm -rf /tmp/recpt1 \ 71 | && rm -rf /tmp/ccid-* \ 72 | && rm -rf /var/cache/apk/* 73 | 74 | # forward request and error logs to docker log collector 75 | #&& ln -sf /dev/stdout /usr/local/var/log/mirakurun.stdout-0.log \ 76 | #&& ln -sf /dev/stderr /usr/local/var/log/mirakurun.stderr-0.log 77 | 78 | COPY services.sh /usr/local/bin 79 | 80 | WORKDIR /usr/local/lib/node_modules/mirakurun 81 | CMD ["/usr/local/bin/services.sh"] 82 | EXPOSE 40772 83 | -------------------------------------------------------------------------------- /mirakurun/conf/channels.yml: -------------------------------------------------------------------------------- 1 | - name: THK 2 | type: GR 3 | channel: '21' 4 | 5 | - name: NHK E 6 | type: GR 7 | channel: '13' 8 | 9 | - name: NHK G 10 | type: GR 11 | channel: '20' 12 | 13 | - name: CTV 14 | type: GR 15 | channel: '19' 16 | 17 | - name: CBC 18 | type: GR 19 | channel: '18' 20 | 21 | - name: NBN 22 | type: GR 23 | channel: '22' 24 | 25 | - name: TVA 26 | type: GR 27 | channel: '23' 28 | 29 | - name: MTV 30 | type: GR 31 | channel: '27' 32 | 33 | - name: BS Asahi 34 | type: BS 35 | channel: 'BS1_0' 36 | serviceId: 151 37 | isDisabled: false 38 | 39 | - name: BS-TBS 40 | type: BS 41 | channel: 'BS1_1' 42 | serviceId: 161 43 | isDisabled: false 44 | 45 | - name: WOWOW Prime 46 | type: BS 47 | channel: 'BS3_0' 48 | serviceId: 191 49 | isDisabled: false 50 | 51 | - name: BS Japan 52 | type: BS 53 | channel: 'BS3_1' 54 | serviceId: 171 55 | isDisabled: false 56 | 57 | - name: WOWOW Live 58 | type: BS 59 | channel: 'BS5_0' 60 | serviceId: 192 61 | isDisabled: false 62 | 63 | - name: WOWOW Chinema 64 | type: BS 65 | channel: 'BS5_1' 66 | serviceId: 193 67 | isDisabled: false 68 | 69 | - name: Star channel 2,3 70 | type: BS 71 | channel: 'BS7_0' 72 | serviceId: 201 73 | isDisabled: false 74 | 75 | - name: Star channel 2,3 76 | type: BS 77 | channel: 'BS7_0' 78 | serviceId: 202 79 | isDisabled: false 80 | 81 | - name: Animax 82 | type: BS 83 | channel: 'BS7_1' 84 | serviceId: 236 85 | isDisabled: false 86 | 87 | - name: Disney 88 | type: BS 89 | channel: 'BS7_2' 90 | serviceId: 256 91 | isDisabled: false 92 | 93 | - name: BS11 94 | type: BS 95 | channel: 'BS9_0' 96 | serviceId: 211 97 | isDisabled: false 98 | 99 | - name: Star channel 1 100 | type: BS 101 | channel: 'BS9_1' 102 | serviceId: 200 103 | isDisabled: false 104 | 105 | - name: TwellV 106 | type: BS 107 | channel: 'BS9_2' 108 | serviceId: 222 109 | isDisabled: false 110 | 111 | - name: FOX 112 | type: BS 113 | channel: 'BS11_0' 114 | serviceId: 238 115 | isDisabled: false 116 | 117 | - name: BS Skyperfect 118 | type: BS 119 | channel: 'BS11_1' 120 | serviceId: 241 121 | isDisabled: false 122 | 123 | - name: BS NIPPON 124 | type: BS 125 | channel: 'BS13_0' 126 | serviceId: 141 127 | isDisabled: false 128 | 129 | - name: BS FUJI 130 | type: BS 131 | channel: 'BS13_1' 132 | serviceId: 181 133 | isDisabled: false 134 | 135 | - name: NHKBS1 136 | type: BS 137 | channel: 'BS15_0' 138 | serviceId: 101 139 | isDisabled: false 140 | 141 | - name: NHKBS Premium 142 | type: BS 143 | channel: 'BS15_1' 144 | serviceId: 103 145 | isDisabled: false 146 | 147 | - name: Green channel 148 | type: BS 149 | channel: 'BS19_0' 150 | serviceId: 234 151 | isDisabled: false 152 | 153 | - name: J SPORTS 1 154 | type: BS 155 | channel: 'BS19_1' 156 | serviceId: 242 157 | isDisabled: false 158 | 159 | - name: J SPORTS 2 160 | type: BS 161 | channel: 'BS19_2' 162 | serviceId: 243 163 | isDisabled: false 164 | 165 | - name: IMAGICA 166 | type: BS 167 | channel: 'BS21_0' 168 | serviceId: 252 169 | isDisabled: false 170 | 171 | - name: J SPORTS 3 172 | type: BS 173 | channel: 'BS21_1' 174 | serviceId: 244 175 | isDisabled: false 176 | 177 | - name: J SPORTS 4 178 | type: BS 179 | channel: 'BS21_2' 180 | serviceId: 245 181 | isDisabled: false 182 | 183 | - name: BS Fishing 184 | type: BS 185 | channel: 'BS23_0' 186 | serviceId: 251 187 | isDisabled: false 188 | 189 | - name: BS Chinema ch 190 | type: BS 191 | channel: 'BS23_1' 192 | serviceId: 255 193 | isDisabled: false 194 | 195 | - name: D-Life 196 | type: BS 197 | channel: 'BS23_2' 198 | serviceId: 258 199 | isDisabled: false 200 | 201 | - name: ND6 202 | type: CS 203 | channel: CS6 204 | serviceId: 294 205 | isDisabled: false 206 | 207 | - name: ND6 208 | type: CS 209 | channel: CS6 210 | serviceId: 323 211 | isDisabled: false 212 | 213 | - name: ND6 214 | type: CS 215 | channel: CS6 216 | serviceId: 329 217 | isDisabled: false 218 | 219 | - name: ND6 220 | type: CS 221 | channel: CS6 222 | serviceId: 340 223 | isDisabled: false 224 | 225 | - name: ND6 226 | type: CS 227 | channel: CS6 228 | serviceId: 341 229 | isDisabled: false 230 | 231 | - name: ND6 232 | type: CS 233 | channel: CS6 234 | serviceId: 354 235 | isDisabled: false 236 | 237 | - name: ND6 238 | type: CS 239 | channel: CS6 240 | serviceId: 294 241 | isDisabled: false 242 | 243 | - name: ND12 244 | type: CS 245 | channel: CS12 246 | serviceId: 254 247 | isDisabled: false 248 | 249 | - name: ND12 250 | type: CS 251 | channel: CS12 252 | serviceId: 325 253 | isDisabled: false 254 | 255 | - name: ND12 256 | type: CS 257 | channel: CS12 258 | serviceId: 330 259 | isDisabled: false 260 | 261 | - name: ND16 262 | type: CS 263 | channel: CS16 264 | serviceId: 290 265 | isDisabled: false 266 | 267 | - name: ND16 268 | type: CS 269 | channel: CS16 270 | serviceId: 305 271 | isDisabled: false 272 | 273 | - name: ND16 274 | type: CS 275 | channel: CS16 276 | serviceId: 311 277 | isDisabled: false 278 | 279 | - name: ND16 280 | type: CS 281 | channel: CS16 282 | serviceId: 333 283 | isDisabled: false 284 | 285 | - name: ND16 286 | type: CS 287 | channel: CS16 288 | serviceId: 343 289 | isDisabled: false 290 | 291 | - name: ND16 292 | type: CS 293 | channel: CS16 294 | serviceId: 353 295 | isDisabled: false 296 | 297 | - name: ND20 298 | type: CS 299 | channel: CS20 300 | serviceId: 307 301 | isDisabled: false 302 | 303 | - name: ND20 304 | type: CS 305 | channel: CS20 306 | serviceId: 308 307 | isDisabled: false 308 | 309 | - name: ND20 310 | type: CS 311 | channel: CS20 312 | serviceId: 309 313 | isDisabled: false 314 | -------------------------------------------------------------------------------- /mirakurun/conf/server.yml: -------------------------------------------------------------------------------- 1 | path: /var/run/mirakurun.sock 2 | 3 | port: 40772 4 | host: ~ 5 | 6 | logLevel: 2 7 | -------------------------------------------------------------------------------- /mirakurun/conf/tuners.yml: -------------------------------------------------------------------------------- 1 | - name: PT3-S0 2 | types: 3 | - BS 4 | - CS 5 | command: recpt1 --device /dev/pt3video0 <channel> - - 6 | decoder: arib-b25-stream-test 7 | isDisabled: false 8 | 9 | - name: PT3-S1 10 | types: 11 | - BS 12 | - CS 13 | command: recpt1 --device /dev/pt3video1 <channel> - - 14 | decoder: arib-b25-stream-test 15 | isDisabled: false 16 | 17 | - name: PT3-T0 18 | types: 19 | - GR 20 | command: recpt1 --device /dev/pt3video2 <channel> - - 21 | decoder: arib-b25-stream-test 22 | isDisabled: false 23 | 24 | - name: PT3-T1 25 | types: 26 | - GR 27 | command: recpt1 --device /dev/pt3video3 <channel> - - 28 | decoder: arib-b25-stream-test 29 | isDisabled: false 30 | 31 | -------------------------------------------------------------------------------- /mirakurun/db/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /mirakurun/mirakurun_status.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* 3 | Copyright 2016 Yuki KAN 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | /// <reference path="../../typings/index.d.ts" /> 18 | "use strict"; 19 | 20 | const fs = require("fs"); 21 | const path = require("path"); 22 | const http = require("http"); 23 | const execSync = require("child_process").execSync; 24 | const munin = require("../node_modules/munin-plugin"); 25 | 26 | if (process.platform === "linux") { 27 | execSync(`renice -n 19 -p ${ process.pid }`); 28 | execSync(`ionice -c 3 -p ${ process.pid }`); 29 | } 30 | 31 | { 32 | const opt = { 33 | method: "GET", 34 | host: "localhost", 35 | port: 40772, 36 | path: "/api/status", 37 | userAgent: `Mirakurun/docker (munin-plugin) Node/${process.version} (${process.platform})` 38 | }; 39 | 40 | const req = http.request(opt, res => { 41 | 42 | if (res.statusCode !== 200 || res.headers["content-type"] !== "application/json; charset=utf-8") { 43 | console.error("Error: Invalid Response."); 44 | process.exit(1); 45 | } 46 | 47 | let body = ""; 48 | 49 | res.on("data", chunk => { 50 | body += chunk; 51 | }); 52 | 53 | res.once("end", () => { 54 | finalize(JSON.parse(body)); 55 | }); 56 | }); 57 | 58 | req.end(); 59 | } 60 | 61 | function finalize(status) { 62 | 63 | munin.create([ 64 | () => { 65 | const g = new munin.Graph('Mirakurun Memory Usage','Bytes','mirakurun'); 66 | g.setScale(true); 67 | g.args = { 68 | "--base": "1024", 69 | "-l": "0" 70 | }; 71 | g.add(new munin.Model.Default('rss').setDraw("AREA").setValue(status.process.memoryUsage.rss)); 72 | g.add(new munin.Model.Default('heapTotal').setDraw("AREA").setValue(status.process.memoryUsage.heapTotal)); 73 | g.add(new munin.Model.Default('heapUsed').setDraw("AREA").setValue(status.process.memoryUsage.heapUsed)); 74 | return g; 75 | }, 76 | () => { 77 | const g = new munin.Graph('Mirakurun Programs DB','Events','mirakurun'); 78 | g.setScale(true); 79 | g.add(new munin.Model.Default('stored events').setDraw("AREA").setValue(status.epg.storedEvents)); 80 | return g; 81 | }, 82 | () => { 83 | const g = new munin.Graph('Mirakurun Stream','Count','mirakurun'); 84 | g.add(new munin.Model.Default("TunerDevice").setDraw("AREA").setValue(status.streamCount.tunerDevice)); 85 | g.add(new munin.Model.Default("TSFilter").setDraw("STACK").setValue(status.streamCount.tsFilter)); 86 | g.add(new munin.Model.Default("decoder").setDraw("STACK").setValue(status.streamCount.decoder)); 87 | return g; 88 | }, 89 | () => { 90 | const g = new munin.Graph('Mirakurun Error','Count','mirakurun'); 91 | 92 | const uncaughtException = new munin.Model.Default('uncaught exception') 93 | uncaughtException.setDraw("AREA"); 94 | uncaughtException.setType("DERIVE"); 95 | uncaughtException.setMin("0"); 96 | uncaughtException.setValue(status.errorCount.uncaughtException); 97 | 98 | const bufferOverflow = new munin.Model.Default('buffer overflow') 99 | bufferOverflow.setDraw("STACK"); 100 | bufferOverflow.setType("DERIVE"); 101 | bufferOverflow.setMin("0"); 102 | bufferOverflow.setValue(status.errorCount.bufferOverflow); 103 | 104 | const tunerDeviceRespawn = new munin.Model.Default('tuner device respawn') 105 | tunerDeviceRespawn.setDraw("STACK"); 106 | tunerDeviceRespawn.setType("DERIVE"); 107 | tunerDeviceRespawn.setMin("0"); 108 | tunerDeviceRespawn.setValue(status.errorCount.tunerDeviceRespawn); 109 | 110 | g.add(uncaughtException); 111 | g.add(bufferOverflow); 112 | g.add(tunerDeviceRespawn); 113 | 114 | return g; 115 | }, 116 | () => { 117 | const g = new munin.Graph('Mirakurun Timer Accuracy','Microseconds','mirakurun'); 118 | g.add(new munin.Model.Default('avg m1').setDraw("AREA").setValue(status.timerAccuracy.m1.avg)); 119 | g.add(new munin.Model.Default('avg m5').setDraw("LINE1").setValue(status.timerAccuracy.m5.avg)); 120 | g.add(new munin.Model.Default('avg m15').setDraw("LINE1").setValue(status.timerAccuracy.m15.avg)); 121 | return g; 122 | } 123 | ].map(f => f())); 124 | } 125 | -------------------------------------------------------------------------------- /mirakurun/services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -s /usr/local/etc/mirakurun/channels.yml ]; then 3 | cat /usr/local/share/mirakurun/channels.yml > /usr/local/etc/mirakurun/channels.yml 4 | fi 5 | if [ ! -s /usr/local/etc/mirakurun/tuners.yml ]; then 6 | cat /usr/local/share/mirakurun/tuners.yml > /usr/local/etc/mirakurun/tuners.yml 7 | fi 8 | if [ ! -s /usr/local/etc/mirakurun/server.yml ]; then 9 | cat /usr/local/share/mirakurun/server.yml > /usr/local/etc/mirakurun/server.yml 10 | fi 11 | 12 | rm -f /run/pcscd/pcscd.comm >/dev/null 2>&1 13 | 14 | pcscd -f --error & 15 | npm start 16 | -------------------------------------------------------------------------------- /recorded/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | --------------------------------------------------------------------------------