scr/FMプラプラを聞く
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
* きっかけ [#q97938e0]
どうしてもこれを録音したかったのです
- [[燕三条エフエム放送 ラヂオは~と 76.8MHz ; 燕三条系さ...
FMプラプラ(FM++/エフエムプラプラ)はなかなかの強敵のよ...
- [[FM桐生のとある番組をタイムシフトにて聴く: ∵なっから∴...
- [[[Python] fmplapla.py - Pastebin.com>https://pastebin....
てことで、こいつをコンテナ化してみました
** Dockerfile [#y2fc4dd6]
#prism(bash){{{
FROM alpine
MAINTAINER Nobuhiro Oki
ARG http_proxy
RUN apk add tzdata ffmpeg py3-pip \
&& adduser -g '' -h /rec -D rec \
&& pip3 install websocket-client \
&& wget -O- https://pastebin.com/raw/gQ0Ay2aN \
| tr -d '\r' \
| sed '1s/python/&3/' >/usr/local/bin/fmplapla \
&& chmod a+x /usr/local/bin/fmplapla
WORKDIR /rec
USER rec
ENV HISTFILE=''
WORKDIR /usr/local/bin
COPY rec.sh rec
ENTRYPOINT ["sh","/usr/local/bin/rec"]
CMD ["-h"]
}}}
** rec.sh [#vc9904f7]
#prism(bash){{{
#/bin/sh
usage() {
cat <<...
${0##*/} - netwok radio recorder
Parameters:
REC_MIN : recording duration [minute]
REC_SEC : recording dulation [second], override REC...
REC_STATION : radio statuon url (default: radioheart /...
REC_PREFIX : output file prefix (default: radioheart <...
REC_TZ : TimeZone for timestamp of output file nam...
Note:
- all parameters must be given by environment variable.
- recording file is placed on /rec (\$HOME directory of...
- if you use 'root' user in container, output directo...
Example:
rec ラヂオは〜と while 30min, output /tmp directo...
docker run --rm -v /tmp:/rec -e REC_MIN=30 rec-fmplap...
after into the container, execute 'rec' command
docker run -it --rm -v /tmp:/rec sh
(in container's shell)
export REC_MIN=30
export REC_PREFIX=SATOCHIN
rec
same as above, using 'env' command
docker run -it --rm -v /tmp:/rec sh
(in container's shell)
env REC_MIN=30 REC_PREFIX=SATOCHIN sh /usr/local/...
show station list
docker run --rm rec-fmplapla -l
...
}
# station list
station_list() {
wget \
-q \
-O- \
https://fmplapla.com/ \
| grep \
-oE \
'(href|alt)=[^> ]*' \
| awk \
'/^alt=/{print a,$0}{a=$0}' \
| awk \
-F'["/]+' \
'/\/.*\//{printf "%-20s %s\n", $2, $4}'
}
# when 1st parameter is executable...
command -v $1 >/dev/null 2>&1 && exec $@
[ -x $1 ] && exec $@
# station list
[ "$1"_ = "-l_" ] && { station_list; exit 0; }
# help
[ "$1"_ = "-h_" ] && { usage; exit 0; }
# parameters
duration_min=${REC_MIN:-1}
duration_sec=${REC_SEC:-$(expr $duration_min \* 60)}
station_id=${REC_STATION:-radioheart}
file_prefix=${REC_PREFIX:-"$station_id"}
TZ=${REC_TZ:-Asia/Tokyo}
rec_filename=$HOME/${file_prefix}_$(env TZ=$TZ date +%Y%m...
# recording
set -x
fmplapla \
--station "$station_id" \
--time "$duration_sec" \
| \
ffmpeg \
-loglevel quiet \
-i pipe: \
-c libvorbis \
-acodec aac \
-f mp4 \
"$rec_filename"
}}}
** build [#na2b39ef]
#prism(bash){{{
$ podman build . -t rec-fmplapla
(略)
$ podman images rec-fmplapla
REPOSITORY TAG IMAGE ID CREATED ...
localhost/rec-fmplapla latest 2e70db1ce15b 52 minut...
}}}
** crontab [#s5ed4591]
#prism(bash){{{
0 6,20 * * * podman run --rm -v ~/Downloads/rec:/rec -e R...
}}}
** station list [#feae10df]
#prism(bash){{{
$ podman run --rm rec-fmplapla rec -l
fmhanabi FMはなび
fmnemaline FMねまらいん
fmasmo FMあすも
bikkifm Bikki-FM
fmaozora FMあおぞら
radioheart ラヂオは〜と
fmtokamachi FMとおかまち
(略)
}}}
終了行:
* きっかけ [#q97938e0]
どうしてもこれを録音したかったのです
- [[燕三条エフエム放送 ラヂオは~と 76.8MHz ; 燕三条系さ...
FMプラプラ(FM++/エフエムプラプラ)はなかなかの強敵のよ...
- [[FM桐生のとある番組をタイムシフトにて聴く: ∵なっから∴...
- [[[Python] fmplapla.py - Pastebin.com>https://pastebin....
てことで、こいつをコンテナ化してみました
** Dockerfile [#y2fc4dd6]
#prism(bash){{{
FROM alpine
MAINTAINER Nobuhiro Oki
ARG http_proxy
RUN apk add tzdata ffmpeg py3-pip \
&& adduser -g '' -h /rec -D rec \
&& pip3 install websocket-client \
&& wget -O- https://pastebin.com/raw/gQ0Ay2aN \
| tr -d '\r' \
| sed '1s/python/&3/' >/usr/local/bin/fmplapla \
&& chmod a+x /usr/local/bin/fmplapla
WORKDIR /rec
USER rec
ENV HISTFILE=''
WORKDIR /usr/local/bin
COPY rec.sh rec
ENTRYPOINT ["sh","/usr/local/bin/rec"]
CMD ["-h"]
}}}
** rec.sh [#vc9904f7]
#prism(bash){{{
#/bin/sh
usage() {
cat <<...
${0##*/} - netwok radio recorder
Parameters:
REC_MIN : recording duration [minute]
REC_SEC : recording dulation [second], override REC...
REC_STATION : radio statuon url (default: radioheart /...
REC_PREFIX : output file prefix (default: radioheart <...
REC_TZ : TimeZone for timestamp of output file nam...
Note:
- all parameters must be given by environment variable.
- recording file is placed on /rec (\$HOME directory of...
- if you use 'root' user in container, output directo...
Example:
rec ラヂオは〜と while 30min, output /tmp directo...
docker run --rm -v /tmp:/rec -e REC_MIN=30 rec-fmplap...
after into the container, execute 'rec' command
docker run -it --rm -v /tmp:/rec sh
(in container's shell)
export REC_MIN=30
export REC_PREFIX=SATOCHIN
rec
same as above, using 'env' command
docker run -it --rm -v /tmp:/rec sh
(in container's shell)
env REC_MIN=30 REC_PREFIX=SATOCHIN sh /usr/local/...
show station list
docker run --rm rec-fmplapla -l
...
}
# station list
station_list() {
wget \
-q \
-O- \
https://fmplapla.com/ \
| grep \
-oE \
'(href|alt)=[^> ]*' \
| awk \
'/^alt=/{print a,$0}{a=$0}' \
| awk \
-F'["/]+' \
'/\/.*\//{printf "%-20s %s\n", $2, $4}'
}
# when 1st parameter is executable...
command -v $1 >/dev/null 2>&1 && exec $@
[ -x $1 ] && exec $@
# station list
[ "$1"_ = "-l_" ] && { station_list; exit 0; }
# help
[ "$1"_ = "-h_" ] && { usage; exit 0; }
# parameters
duration_min=${REC_MIN:-1}
duration_sec=${REC_SEC:-$(expr $duration_min \* 60)}
station_id=${REC_STATION:-radioheart}
file_prefix=${REC_PREFIX:-"$station_id"}
TZ=${REC_TZ:-Asia/Tokyo}
rec_filename=$HOME/${file_prefix}_$(env TZ=$TZ date +%Y%m...
# recording
set -x
fmplapla \
--station "$station_id" \
--time "$duration_sec" \
| \
ffmpeg \
-loglevel quiet \
-i pipe: \
-c libvorbis \
-acodec aac \
-f mp4 \
"$rec_filename"
}}}
** build [#na2b39ef]
#prism(bash){{{
$ podman build . -t rec-fmplapla
(略)
$ podman images rec-fmplapla
REPOSITORY TAG IMAGE ID CREATED ...
localhost/rec-fmplapla latest 2e70db1ce15b 52 minut...
}}}
** crontab [#s5ed4591]
#prism(bash){{{
0 6,20 * * * podman run --rm -v ~/Downloads/rec:/rec -e R...
}}}
** station list [#feae10df]
#prism(bash){{{
$ podman run --rm rec-fmplapla rec -l
fmhanabi FMはなび
fmnemaline FMねまらいん
fmasmo FMあすも
bikkifm Bikki-FM
fmaozora FMあおぞら
radioheart ラヂオは〜と
fmtokamachi FMとおかまち
(略)
}}}
ページ名: