From: satomichan <...@...>
Date: Wed, 18 Mar 2026 06:54:59 +0000 (+0900)
Subject: コード整形(余分な空白を除去).
X-Git-Url: https://satomichan.jp/gitweb/?a=commitdiff_plain;h=1b0087eb1565f324d536088840a90f48e29bed29;p=rec-radiko.git
コード整形(余分な空白を除去).
---
diff --git a/get-nhk-title.pl b/get-nhk-title.pl
index 656c583..18aab9c 100755
--- a/get-nhk-title.pl
+++ b/get-nhk-title.pl
@@ -51,7 +51,7 @@ NHKãªã³ã©ã¤ã³ ããã¹ãç (https://k.nhk.jp/) ã§æä¾ããã¦ãã
è¤æ°æå®ãããã¨ãåºæ¥ã¾ã. ä¾) --li 3,4
Shortåºåã¢ã¼ã ã®ã¨ãã« --shinyabin ãæå®ããã¨,
- çªçµã ã©ã¸ãªæ·±å¤ä¾¿ ã ã£ãå ´åã«, çªçµã¿ã¤ãã«ã ãã©ã¸ãªæ·±å¤ä¾¿ã+
+ çªçµã ã©ã¸ãªæ·±å¤ä¾¿ ã ã£ãå ´åã«, çªçµã¿ã¤ãã«ã ãã©ã¸ãªæ·±å¤ä¾¿ã+
2,3è¡ç®ãçµã¿åãããæååã«ãã¾ã (1è¡ç®ã®ã¿ã ã¨ç¹éå
容ããã
ããªããã).
@@ -124,7 +124,7 @@ if ($program) {
if ($option{short}) {
#Short 表示ã¢ã¼ã
print "$program->{minutes} " unless $option{nominutes};
-
+
my $title = '';
#ã©ã¸ãªæ·±å¤ä¾¿å¯¾ç
@@ -132,13 +132,13 @@ if ($program) {
$title = 'ã©ã¸ãªæ·±å¤ä¾¿';
$option{li} = '2,3';
}
-
+
#ã¿ã¤ãã«åå¾ã»ã¨ã¹ã±ã¼ã
$title .= $program->{list}[$_ -1] for split(/,/, $option{li});
$title = escape($title) if $option{escape};
-
+
print "$title";
-
+
}else{
#Long 表示ã¢ã¼ã
print $option{nominutes} ? "" : "$program->{minutes}åé\n";
@@ -154,25 +154,25 @@ exit;
sub get_timetable {
my ($area, $ch, $tt_ymd, $d, $h, $m) = @_;
# âçªçµè¡¨ã®å¹´ææ¥, âæ¦æ¥
-
+
my $kanji_time = kanji_time($d, $h, $m);
my $url = "https://k.nhk.jp/timetable/read/c.html?a=$area&c=$ch&d=$tt_ymd&f=top";
my $resp = HTTP::Tiny->new->get($url);
-
+
if ($resp->{success}) {
my $body = Encode::decode('UTF-8', $resp->{content});
-
- my ($minutes, $entry) =
+
+ my ($minutes, $entry) =
$body =~ m|
${kanji_time}ãã.+?åï¼æ¾éæé(\d{1,3})åéï¼ |
or die "Cannot get program info starting at the specified date-time. TIME: ${kanji_time} URL: $url";
$entry = HTML::Entities::decode_entities($entry); #HTMLæåå®ä½åç
§(&xxxx;) ãã³ã¼ã
$entry =~ s/
/\n/g;
-
+
my @list = $entry=~ m|(.+?)|sg;
return {minutes => $minutes, list => \@list};
-
+
}else{
die "Not success GET : $url";
}
@@ -186,19 +186,19 @@ sub kanji_time {
my $day = '';
my $ampm;
-
+
if ($h < 5) {
$day = sprintf('%iæ¥', $d);
$ampm = 'åå';
-
+
}elsif ($h <= 11) {
$ampm = 'åå';
-
+
}else{
$ampm = 'åå¾';
$h -= 12;
}
-
+
return sprintf("%s%s%iæ%02iå", $day, $ampm, $h, $m);
}
@@ -207,11 +207,11 @@ sub kanji_time {
#ã¨ãªã¢ã³ã¼ãã»ãã£ã³ãã«ã³ã¼ã
sub station2area_channel {
my ($station) = @_;
-
+
return ['001','06'] if $station eq 'r2';
-
+
my ($base, $channel) = $station =~ /^(.\w+)-(r1|fm)$/ or die "'$station' : Unknown station.";
-
+
my %area_code = (
sapporo => '700',
sendai => '600',
@@ -222,7 +222,7 @@ sub station2area_channel {
matsuyama => '800',
fukuoka => '501',
);
-
+
die "'$station' : Unknown area." unless $area_code{$base};
@@ -230,10 +230,10 @@ sub station2area_channel {
r1 => '05',
fm => '07',
);
-
+
die "'$station' : Unknown area." unless $channel_code{$channel};
-
-
+
+
return [$area_code{$base}, $channel_code{$channel}];
}
@@ -242,7 +242,7 @@ sub station2area_channel {
#ãã¡ã¤ã«åä¸é©è¨å·é¡ãå
¨è§æåå
sub escape {
my($str) = @_;
-
+
#ç©ºç½ -> _ ã«ãã
$str =~ s/\s+/_/g;
$str =~ s/ã+/_/g;
diff --git a/radiru2-dl.pl b/radiru2-dl.pl
index 9bee35c..642e9dc 100755
--- a/radiru2-dl.pl
+++ b/radiru2-dl.pl
@@ -182,7 +182,7 @@ sub sec2duration {
sub gen_filename {
my($orig_name, $num) = @_;
-
+
return $orig_name if $num == 0;
my $base = $orig_name;
diff --git a/rec-nhk-radio.pl b/rec-nhk-radio.pl
index f4f24a8..63a336b 100755
--- a/rec-nhk-radio.pl
+++ b/rec-nhk-radio.pl
@@ -6,16 +6,16 @@
# ä½¿ãæ¹ã¯å¼æ°ãªãã§å®è¡ããã¨è¡¨ç¤ºããã¾ã.
#
# Copyright 2024-2025 FUKUDA Satomi (https://satomichan.jp/)
-#
+#
# Licensed under the Apache License, Version 2.0 (the âLicenseâ);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an âAS ISâ BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
+#
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -114,9 +114,9 @@ unless (@ARGV) {
<é²é³é·(å)> <ã¿ã¤ãã«> ãçç¥ããã¨ãã«ã¯, get-nhk-title.pl ã使ç¨ãã¦åå¾ãã¾ã.
<é²é³éå§æ¥> ãçç¥ããã¨ãã«ã¯, ç¾å¨æå»ä»¥éã®ç´è¿ã® <é²é³éå§æå»> ããé²é³ãéå§ãã¾ã.
-
+
EOM_USAGE
-
+
print STDERR $usage;
exit;
}