From 9d54b045af033621a8766804ea9870249e8b63a1 Mon Sep 17 00:00:00 2001 From: satomichan Date: Wed, 25 Sep 2024 20:56:09 +0900 Subject: [PATCH] =?utf8?q?=E9=8C=B2=E9=9F=B3=E3=81=95=E3=82=8C=E3=81=9F?= =?utf8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AB=E3=82=A2=E3=82=AF?= =?utf8?q?=E3=82=BB=E3=82=B9=E6=A8=A9=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=99?= =?utf8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- rec-radiko.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rec-radiko.pl b/rec-radiko.pl index 3d2a9c6..15c38ab 100644 --- a/rec-radiko.pl +++ b/rec-radiko.pl @@ -43,6 +43,7 @@ my $BASH = `which bash | tr -d '\n'`; my $ECHO = `which echo | tr -d '\n'`; my $SLEEP = `which sleep | tr -d '\n'`; my $RM = `which rm | tr -d '\n'`; +my $CHMOD = `which chmod | tr -d '\n'`; @@ -55,9 +56,10 @@ die "保存先 $DIR_SAVE_TO に書き込み権限がありません." # 動作モード -my $is_check_mode = 0; -my $is_conv_to_mp3 = 1; -my $SLEEP_TIME_SEC = 5; +my $is_check_mode = 0; +my $is_conv_to_mp3 = 1; +my $SLEEP_TIME_SEC = 5; +my $FILE_PERMISSION = 644; @@ -103,9 +105,10 @@ my $mp3 = "${file_name_base}.mp3"; # コマンド構築 -my $rec_cmd = "cd $ENV{RADIKO_SAVE_TO} ; $RADISH -t radiko -s $station -d $min -o $m4a ; "; +my $rec_cmd = "cd $ENV{RADIKO_SAVE_TO}; $RADISH -t radiko -s $station -d $min -o $m4a; $CHMOD $FILE_PERMISSION $m4a; "; if ($is_conv_to_mp3) { - $rec_cmd .= "$FFMPEG -i $m4a $mp3 &> /dev/null ; $SLEEP $SLEEP_TIME_SEC ; if [ -s $mp3 ]; then $RM $m4a; fi"; + $rec_cmd .= "$FFMPEG -i $m4a $mp3 &> /dev/null; $SLEEP $SLEEP_TIME_SEC; ". + "if [ -s $mp3 ]; then $RM $m4a; $CHMOD $FILE_PERMISSION $mp3; fi"; } my $at_time = sprintf('%d:%02d %02d.%02d.%02d', $time_h, $time_m, $d, $m, ($y - int($y/100)*100 ) ); -- 2.43.0