環境:
- centos6.4
- FUJITSU TX100 S3 (G550 mem:2GB)
- PT3
- CSR3310(ICカードリーダー)
参考:
- http://investnora.blog7.fc2.com/blog-entry-130.html
- http://d.hatena.ne.jp/sona-zip/20110203/p1
- http://www.mda.or.jp/epgrec/index.php/epgrec%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%A8%E8%A8%AD%E5%AE%9A#ze214f13
centosのISOをダウンロードする
ここの「CentOS-6.4-x86_64-minimal.iso」をダウンロード。md5はお好きにチェックしてください(爆
CD-RWにImgBurnを使って上記ISOファイルを書き込む
あれ?IP取得しない?と思ってたら、最初はNICの設定がonboot=noになってた・・・orz
[bash]
[root@recorder ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
onboot=yes
[/bash]
1.ICカードリーダー導入
[bash]
[root@recorder ~]# cd /usr/local/src
[root@recorder src]# yum install ccid pcsc-lite pcsc-lite-devel
[root@recorder src]# yum -y install pcsc-lite-libs ←やらなくてもよかたよ
[root@recorder src]# yum -y install yum-priorities
[root@recorder src]# rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
[root@recorder src]# wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
-bash: wget: コマンドが見つかりません
[/bash]
Σ(゚◇゚;)マジデッ!?
[bash]
[root@recorder src]# yum install wget
[/bash]
再度!
[bash]
[root@recorder src]# wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[root@recorder src]# rpm -ivh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[root@recorder src]# sed -ie ‘s/enabled = [01]/enabled = 0/’ /etc/yum.repos.d/rpmforge.repo
[root@recorder src]# yum install –enablerepo=rpmforge -y perl-Gtk2
[root@recorder src]# wget ftp://ftp.kddlabs.co.jp/033/Linux/packages/fedora.archive/releases/13/Everything/x86_64/os/Packages/pcsc-perl-1.4.8-2.fc13.x86_64.rpm
[root@recorder src]# wget ftp://ftp.kddlabs.co.jp/033/Linux/packages/fedora.archive/releases/13/Everything/x86_64/os/Packages/pcsc-tools-1.4.16-1.fc13.x86_64.rpm
[root@recorder src]# rpm -ivh pcsc-perl-1.4.8-2.fc13.x86_64.rpm
[root@recorder src]# rpm -ivh pcsc-tools-1.4.16-1.fc13.x86_64.rpm
[root@recorder src]# /etc/init.d/pcscd start
PC/SC スマートカードデーモン (pcscd) を起動中: [ OK ]
[root@recorder ~]# pcsc_scan
[/bash]
あれ?怒られたwwww
ICカードリーダーのLEDも光らないし。こんなときはreboot
リブートしたら認識おk
[bash]
[root@recorder ~]# pcsc_scan
~省略
Japanese Chijou Digital B-CAS Card (pay TV) ←こんなの出る。Ctrl+Cで抜ける。
[/bash]
2.arib25
[bash]
[root@recorder src]# wget http://hg.honeyplanet.jp/pt1/archive/c44e16dbb0e2.zip
[root@recorder src]# unzip c44e16dbb0e2.zip
-bash: unzip: コマンドが見つかりません
[/bash]
またか\(^o^)/
[bash]
[root@recorder src]# yum install unzip
[/bash]
再度!
[bash]
[root@recorder src]# unzip c44e16dbb0e2.zip
[root@recorder src]# cd pt1-c44e16dbb0e2/arib25
[root@recorder arib25]# make
-bash: make: コマンドが見つかりません
[/bash]
\(^o^)/
[bash]
[root@recorder arib25]# yum -y install make
/bin/sh: gcc: コマンドが見つかりません
[/bash]
\(^o^)/
[bash]
[root@recorder arib25]# yum -y install gcc
[root@recorder arib25]# make
[root@recorder arib25]# make install
[/bash]
3.recept1入れます
pt1-drv_20111001.tar.gz ←sourceforgeでダウンロードできる
winscpとかで/usr/local/srcにアップロードでしておく。
[bash]
[root@recorder src]# tar -zxvf pt1-drv_20111001.tar.gz
[root@recorder src]# cd pt1-7662d0ecd74b/recpt1
[root@recorder recpt1]# vi pt1_dev.h
pt1video・・・・となっている部分をpt3video・・・に全部書き換える。
[root@recorder recpt1]# ./autogen.sh
You must have autoconf installed to compile recpt1.
Get ftp://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.62.tar.gz
(or a newer version if it is available)
You must have automake installed to compile recpt1.
Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.10.1.tar.gz
(or a newer version if it is available)
[/bash]
\(^o^)/
[bash]
[root@recorder recpt1]# yum -y install autoconf
[root@recorder recpt1]# yum -y install automake
[/bash]
再度!
[bash]
[root@recorder recpt1]# ./autogen.sh
[root@recorder recpt1]# ./configure -enable-b25
[root@recorder recpt1]# make clean
[root@recorder recpt1]# make
[root@recorder recpt1]# make install
[/bash]
3.pt3ドライバ
[bash]
[root@recorder ~]# echo "blacklist earth-pt1" >> /etc/modprobe.d/blacklist.conf
[root@recorder ~]# cd /usr/local/src
[root@recorder src]# git clone https://github.com/m-tsudo/pt3.git
-bash: git: コマンドが見つかりません
[/bash]
\(^o^)/
[bash]
[root@recorder src]# yum -y install git
[/bash]
再度!
[bash]
[root@recorder src]# git clone https://github.com/m-tsudo/pt3.git
[root@recorder src]# cd pt3/
[root@recorder pt3]# make clean
make -C /lib/modules/`uname -r`/build M=`pwd` V=0 clean
make: *** /lib/modules/2.6.32-358.el6.x86_64/build: そのようなファイルやディレクトリはありません. 中止.
make: *** [clean] エラー 2
[/bash]
\(^o^)/
[bash]
[root@recorder pt3]# yum -y install kernel-devel-`uname -r`
[/bash]
再度!
[bash]
[root@recorder pt3]# make clean
[root@recorder pt3]# make
[root@recorder pt3]# make install
[/bash]
ここでいったんrebootしておく
4.録画チェック
[bash]
[root@recorder ~]# recpt1 –b25 –strip 27 10 /home/share/test.ts
recpt1: error while loading shared libraries: libarib25.so.0: cannot open shared object file: No such file or directory
[/bash]
\(^o^)/
[bash]
[root@recorder ~]# yum -y install ld-linux.so.2
[/bash]
再度!
[bash]
[root@recorder ~]# recpt1 –b25 –strip 27 10 /home/share/test.ts
recpt1: error while loading shared libraries: libarib25.so.0: cannot open shared object file: No such file or directory
[/bash]
えっ?
[bash]
[root@recorder ~]# ldd /usr/local/bin/recpt1
linux-vdso.so.1 => (0x00007fffd92a1000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa43df16000)
libm.so.6 => /lib64/libm.so.6 (0x00007fa43dc92000)
libarib25.so.0 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fa43d8fe000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa43e13a000)
[root@recorder ~]# find /usr/ | grep libarib25.so.0
/usr/local/lib/libarib25.so.0.2.4
/usr/local/lib/libarib25.so.0
[root@recorder ~]# echo "/usr/local/lib" >> /etc/ld.so.conf
[root@recorder ~]# ldconfig
[root@recorder ~]# ldd /usr/local/bin/recpt1
[root@recorder ~]# ldd /usr/local/bin/recpt1
linux-vdso.so.1 => (0x00007fff0f641000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffe5c9bf000)
libm.so.6 => /lib64/libm.so.6 (0x00007ffe5c73b000)
libarib25.so.0 => /usr/local/lib/libarib25.so.0 (0x00007ffe5c532000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffe5c19f000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffe5cbe3000)
libpcsclite.so.1 => /usr/lib64/libpcsclite.so.1 (0x00007ffe5bf93000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ffe5bd8e000)
[/bash]
再度!
[bash]
[root@recorder ~]# recpt1 –b25 –strip 27 10 /home/share/test.ts
using B25…
enable B25 strip
pid = 1616
C/N = 32.759589dB
Recording…
Recorded 11sec
[/bash]
成功・・・・したのかなwww
5.epgdumpr2(録画予約ソフト)
sourceforgeからダウンロード
前回と同じくwinscpで/usr/local/src/pt3に入れます。
[bash]
[root@recorder ~]# cd /usr/local/src/pt3
[root@recorder pt3]# tar zxvf epgdumpr2_20111001.tar.gz
[root@recorder pt3]# cd epgdumpr2
[root@recorder epgdumpr2]# make
make: `all’ に対して行うべき事はありません.
[/bash]
およ?
[bash]
[root@recorder epgdumpr2]# ls
Makefile aribstr.o eit.o epgdump.o sdt.h ts.c ts_ctl.h util.o
aribstr.c eit.c <span style="color: #00ff00;">epgdump</span> readme.txt sdt.o ts.h util.c xmldata.c
aribstr.h eit.h epgdump.c sdt.c tags ts.o util.h
[root@recorder epgdumpr2]# rm epgdump
rm: remove 通常ファイル `epgdump’? y
[root@recorder epgdumpr2]# make
gcc -std=c99 -O2 -Wall -g epgdump.o aribstr.o eit.o ts.o util.o sdt.o -o epgdump
epgdump.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [epgdump] エラー 1
[root@recorder epgdumpr2]# make clean
[root@recorder epgdumpr2]# make
[root@recorder epgdumpr2]# cp epgdump /usr/local/bin
<strong>6.apache</strong>
[root@recorder ~]# yum -y install httpd
[root@recorder ~]# yum -y install php php-cli php-sql php-mysql php-mbstring php-process
[root@recorder ~]# vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www"
[root@recorder ~]# chkconfig –list | grep httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@recorder ~]# chkconfig httpd on
[root@recorder ~]# chkconfig –list | grep httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[/bash]
おk
[bash]
[root@recorder ~]# service httpd start
httpd を起動中: httpd: apr_sockaddr_info_get() failed for recorder
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
<strong>7.mysql</strong>
[root@recorder ~]# yum -y install mysql-server
[root@recorder ~]# service mysqld start
[root@recorder ~]# chkconfig –list | grep mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@recorder ~]# chkconfig mysqld on
[root@recorder ~]# chkconfig –list | grep mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@recorder ~]# mysql -u root
mysql> grant all privileges on PT3.*to <em>username</em>@localhost identified by ‘<em>password</em>’;
mysql> exit
[root@recorder ~]# mysql -u <em>username</em> -p
Enter password:
mysql> create database PT3;
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| PT3 |
| test |
+——————–+
3 rows in set (0.00 sec)
<strong>8.epgrec</strong>
[root@recorder ~]# usermod -s /bin/bash apache
[root@recorder ~]# service atd start
atd: 認識されていないサービスです。
[/bash]
お?
[bash]
[root@recorder ~]# yum -y install at
[root@recorder ~]# chkconfig atd on
[root@recorder ~]# service atd start
[root@recorder ~]# cd /var/www
[root@recorder www]# git clone git://git.sourceforge.jp/gitroot/epgrec/epgrec.git
[root@recorder www]# cd /var/www/epgrec
[root@recorder epgrec]# mv config.php.sample config.php
[/bash]
9.epgrecの設定
参考:
[bash]
[root@recorder epgrec]# cp config.php config.php.bak
[root@recorder epgrec]# vi config.php
[/bash]
※戸塚の場合www
[bash]
// 首都圏用地上デジタルチャンネルマップ
// 識別子 => チャンネル番号
$GR_CHANNEL_MAP = array(
"GR27" => "27", // NHK(sougou)
"GR26" => "26", // NHK(Eテレ)
"GR25" => "25", // 日テレ
"GR22" => "22", // TBS
"GR21" => "21", // フジ
"GR24" => "24", // テレ朝
"GR23" => "23", // テレ東
"GR16" => "16", // MX TV
"GR18" => "18", // テレ神
// "GR30" => "30", // 千葉
// "GR32" => "32", // テレ玉
// "GR28" => "28", // 大学
);
[root@recorder epgrec]# vi /var/www/epgrec/do-record.sh
#!/bin/sh
echo "CHANNEL : $CHANNEL"
echo "DURATION: $DURATION"
echo "OUTPUT : $OUTPUT"
echo "TUNER : $TUNER"
echo "TYPE : $TYPE"
echo "MODE : $MODE"
echo "SID : $SID"
RECORDER=/usr/local/bin/recpt1
# fail safe
case $CHANNEL in
101|102|191|192|193)
if [ $SID = ‘hd’ ]; then
SID=$CHANNEL
fi ;;
esac
if [ -z $SID ]; then
SID=’hd’
fi
if [ ${MODE} = 0 ]; then
# MODE=0では必ず無加工のTSを吐き出すこと
$RECORDER –b25 –strip $CHANNEL $DURATION ${OUTPUT} >/dev/null
elif [ ${MODE} = 1 ]; then
if [ ${CHANNEL} = "23" ] || [ ${CHANNEL} = "24" ]; then
# テレビ朝日とテレビ東京はFullTS
$RECORDER –b25 –strip $CHANNEL $DURATION ${OUTPUT} >/dev/null
else
# 目的のSIDのみ残す
$RECORDER –b25 –strip –sid $SID $CHANNEL $DURATION ${OUTPUT} >/dev/null
fi
fi
[root@recorder epgrec]# chown -R apache.apache /var/www/epgrec
[root@recorder epgrec]# chmod 777 /var/www/epgrec/templates_c
[root@recorder epgrec]# chmod 777 /var/www/epgrec/video
[root@recorder epgrec]# chmod 777 /var/www/epgrec/thumbs
[root@recorder epgrec]# chmod 777 /var/www/epgrec/settings
[root@recorder epgrec]# chmod 777 /var/www/epgrec/cache
[root@recorder epgrec]# chmod 755 /var/www/epgrec/do-record.sh
[/bash]
ここまできたら、http://サーバーアドレス/epgrec/index.phpにアクセスする。
んで、ブラウザから見ようとしてもアクセスできない\(^o^)/
どうせiptablesだろうと思って切ってみたら成功したw
[bash]
[root@recorder ~]# service iptables stop
[/bash]
あとはブラウザで初期設定。mediatomb連携機能もあるんかー
cronで番組表取得する
[bash]
[root@recorder ~]# vi /etc/cron.d/getepg
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
29 */2 * * * apache /var/www/epgrec/getepg.php
[root@recorder ~]# chmod 644 /etc/cron.d/getepg
[/bash]
番組表取得してみる
[bash]
[root@recorder ~]# /var/www/epgrec/getepg.php
[/bash]
番組表にアクセスするには
http://サーバのIPアドレス/epgrec/index.php
あれNHKのEテレとMXTVの番組情報、神奈川TVが取得できねぇ・・・・
追記:2013/04/04
1日置いて番組情報取得してみたら全部問題なく取得できてました!
10.番組取得の負荷軽減
参考:
[bash]
[root@recorder ~]# mysql –version
mysql Ver 14.14 Distrib 5.1.67, for redhat-linux-gnu (x86_64) using readline 5.1
mysql>のプロンプトに入ったら・・・
ALTER TABLE Recorder_programTbl ADD INDEX idx_program_disc(program_disc);
[/bash]
11.SELINUX無効
録画予約しようとしたら「無効なIDなんちゃらかんちゃら」
[bush]
[root@recorder ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=disabled ←ここを変更
# SELINUXTYPE= can take one of these two values:
# targeted – Targeted processes are protected,
# mls – Multi Level Security protection.
SELINUXTYPE=targeted
[/bash]