/home/pi/.profile の一番下に、 sudo -u pi perl /home/pi/pi.pl & と書き加えると、ログイン後にデスクトップに自動表示される。その他、使用するスクリプトなどは、 perl-tk aplay-pi.pl mplayer rtmpdump swftools libxml2-utilsplay radiko.sh play_nhk-radio.sh raspA.gif(この下のいやらしいラズベリーの画像) が必要である。インストール方法などは、下にある弊関連ブログの関連リンクでご確認いただける。 追記 MP3再生にmpg321も必要でした・ sudo apt-get install mpg321 pi.pl 下記のスクリプトを pi.pl の名前で /home/pi (ホームディレクトリ)に保存する。 ターミナルで $ sudo chmod 755 pi.pl ↓#!/usr/bin/perlが1行めになるようにする。 #!/usr/bin/perl use Tk; use Encode; ## pi.pl# 初期設定 ################################################### my $msg = "yes";#シャットダウン時にメセージを表示する yes/no my $geometry = "+10+40";#表示位置 my $minsize1 = 400;#サイズW my $minsize2 = 140;#サイズH my $tmGeometry = "42x3+10+210";#gnorm-terminal サイズ/表示位置 my $pVol = "50";#初期ボリューム my $font = "MS ゴシック 12 bold";#フォント my $bt0Img = "./raspA.gif";#aplayボタン 画像 my $bt0Bac = "#fffacd";#aplayボタン 背景色 my $bt0ABac = "#ffff00";#aplayボタン アクティブ背景色 my $nextTxt = "▶";#ネクストボタン テキスト(Aplay 専用) my $nextFont = "MS ゴシック 18 bold";#フォント my $nextFore = "#333333";#ネクストボタン 文字色 my $nextAFore = "#ffffff";#ネクストボタン アクティブ文字色 my $stopTxt = "×";#ストップボタン テキスト(gnorm-terminal を閉じる) my $stopFore = "#333333";#ストップボタン 文字色 my $stopAFore = "#ffffff";#ストップボタン アクティブ文字色 my $stopABase = "#113355";#ストップボタン アクティブ背景色 my $bt1Id = "215936";#SHOUTcast1 ID my $bt1Txt = "Jazz";#ネットラジオボタン1 テキスト my $bt1Fore = "#333333";#ネットラジオボタン1 文字色 my $bt1Bac = "#da70d6";#ネットラジオボタン1 背景色 my $bt1AFore = "#dedede";#ネットラジオボタン1 アクティブ文字色 my $bt1ABac = "#333333";#ネットラジオボタン1 アクティブ背景色 my $bt2Id = "15560";#SHOUTcast2 ID my $bt2Txt = "Cool";#ネットラジオボタン2 テキスト my $bt2Fore = "#333333";#ネットラジオボタン2 文字色 my $bt2Bac = "#ffa500";#ネットラジオボタン2 背景色 my $bt2AFore = "#dedede";#ネットラジオボタン2 アクティブ文字色 my $bt2ABac = "#333333";#ネットラジオボタン2 アクティブ背景色 my $bt3Id = "182137";#SHOUTcast3 ID my $bt3Txt = "Pop";#ネットラジオボタン3 テキスト my $bt3Fore = "#333333";#ネットラジオボタン3 文字色 my $bt3Bac = "#98fb98";#ネットラジオボタン3 背景色 my $bt3AFore = "#dedede";#ネットラジオボタン3 アクティブ文字色 my $bt3ABac = "#333333";#ネットラジオボタン3 アクティブ背景色 my $bt4Id = "TBS";#Radico1 ID (http://www.norikistudio.com/station-id-list) my $bt4Txt = "TBS";#Radico1 テキスト my $bt4Fore = "#333333";#Radico1 文字色 my $bt4Bac = "#40e0d0";#Radico1 背景色 my $bt4AFore = "#dedede";#Radico1 アクティブ文字色 my $bt4ABac = "#333333";#Radico1 アクティブ背景色 my $bt5Id = "FMJ";#Radico2 ID (http://www.norikistudio.com/station-id-list) my $bt5Txt = "FMJ";#Radico2 テキスト my $bt5Fore = "#333333";#Radico2 文字色 my $bt5Bac = "#87cefa";#Radico2 背景色 my $bt5AFore = "#dedede";#Radico2 アクティブ文字色 my $bt5ABac = "#333333";#Radico2 アクティブ背景色 #らじるらじるの再生は、Ubuntu でテストした時は出来たのだが、小生のラズパイではエラーになった。とりあえずSHOUTcastの再生にしておいた。 #と思ったら、単純なスペルミスでした。コメントアウトを変えれば、SHOUTcastにもなります。 my $bt6Id = "r1";#らじるらじる ID=r1:NHKラジオ第1/r2:NHKラジオ第2/fm:NHK FM #my $bt6IdSHOUT = "1074623";#SHOUTcast6 ID my $bt6Txt = "NHK1";#らじるらじる テキスト my $bt6Fore = "#333333";#らじるらじる 文字色 my $bt6Bac = "#ffd700";#らじるらじる 背景色 my $bt6AFore = "#dedede";#らじるらじる アクティブ文字色 my $bt6ABac = "#333333";#らじるらじる アクティブ背景色 my $bt7Txt = "◯";#シャットダウン テキスト my $bt7Font = "MS ゴシック 18 bold";#シャットダウン フォント my $bt7Bac = "#555555";#シャットダウン 背景色 my $bt7ABac = "#b50008";#シャットダウン アクティブ背景色 my $bt7Fore = "#dddddd";#シャットダウン 文字色 my $bt7AFore = "#ffffff";#シャットダウン アクティブ文字色 my $volFore = "#333333";#ボリューム 文字色 my $volBac = "#fff0f5";#ボリューム 背景色 my $volABac = "#da70d6";#ボリューム アクティブ色 my $padxi = 2; my $padyi = 2; ##################################################################### my $bTi = 0; $mw = new MainWindow(); $mw->minsize($minsize1,$minsize2); $mw->geometry("$geometry"); $main = $mw->Frame(); $main->pack( -side => "top", -fill => "both", -expand => "yes", ); $mainL = $main->Frame(); $mainL->pack( -side => "left", ); $image = $mainL->Photo( -file => "$bt0Img" ); $bt0 = $mainL->Button( -image => $image, -relief => "flat", -background => "$bt0Bac", -activebackground => "$bt0ABac", -padx => 0, -pady => 0, -command => \&Ap, ); $bt0->pack( -side => "left", -fill => "both", -expand => "yes", ); $mainL2 = $mainL->Frame(); $mainL2->pack( -side => "left", -fill => "both", -expand => "yes", ); $next = $mainL2->Button( -relief => "flat", -text => decode("utf8", "$nextTxt"), -font => "$nextFont", -activeforeground => "$nextAFore", -foreground => "$nextFore", -background => "$bt0Bac", -activebackground => "$bt0ABac", -padx => 0, -pady => 0, -command => \&Next, ); $next->pack( -side => "top", -fill => "both", -expand => "yes", ); $stop = $mainL2->Button( -relief => "flat", -text => decode("utf8", "$stopTxt"), -font => "$font", -activeforeground => "$stopAFore", -foreground => "$stopFore", -background => "$bt0Bac", -activebackground => "$stopABase", -padx => 0, -pady => 0, -command => \&Chk, ); $stop->pack( -side => "top", -fill => "both", -expand => "yes", ); $mainR = $main->Frame(); $mainR->pack( -side => "left", -fill => "both", -expand => "yes", ); $mainR1 = $mainR->Frame( -padx => $padxi, -pady => $padyi, ); $mainR1->pack( -side => "top", -fill => "both", -expand => "yes", ); $bt1 = $mainR1->Button( -relief => "flat", -text => decode("utf8", "$bt1Txt"), -font => "$font", -activebackground => "$bt1ABac", -activeforeground => "$bt1AFore", -background => "$bt1Bac", -foreground => "$bt1Fore", -padx => $padxi, -pady => $padyi, -command => \&Nr1, ); $bt1->pack( -side => "left", -fill => "both", -expand => "yes", ); $bt2 = $mainR1->Button( -relief => "flat", -text => decode("utf8", "$bt2Txt"), -font => "$font", -activebackground => "$bt2ABac", -activeforeground => "$bt2AFore", -background => "$bt2Bac", -foreground => "$bt2Fore", -padx => $padxi, -pady => $padyi, -command => \&Nr2, ); $bt2->pack( -side => "left", -fill => "both", -expand => "yes", ); $bt3 = $mainR1->Button( -relief => "flat", -text => decode("utf8", "$bt3Txt"), -font => "$font", -activebackground => "$bt3ABac", -activeforeground => "$bt3AFore", -background => "$bt3Bac", -foreground => "$bt3Fore", -padx => $padxi, -pady => $padyi, -command => \&Nr3, ); $bt3->pack( -side => "left", -fill => "both", -expand => "yes", ); $mainR2 = $mainR->Frame( -padx => $padxi, -pady => $padyi, ); $mainR2->pack( -side => "top", -fill => "both", -expand => "yes", ); $bt4 = $mainR2->Button( -relief => "flat", -text => decode("utf8", "$bt4Txt"), -font => "$font", -activebackground => "$bt4ABac", -activeforeground => "$bt4AFore", -background => "$bt4Bac", -foreground => "$bt4Fore", -padx => $padxi, -pady => $padyi, -command => \&Nr4, ); $bt4->pack( -side => "left", -fill => "both", -expand => "yes", ); $bt5 = $mainR2->Button( -relief => "flat", -text => decode("utf8", "$bt5Txt"), -font => "$font", -activebackground => "$bt5ABac", -activeforeground => "$bt5AFore", -background => "$bt5Bac", -foreground => "$bt5Fore", -padx => $padxi, -pady => $padyi, -command => \&Nr5, ); $bt5->pack( -side => "left", -fill => "both", -expand => "yes", ); $bt6 = $mainR2->Button( -relief => "flat", -text => decode("utf8", "$bt6Txt"), -font => "$font", -activebackground => "$bt6ABac", -activeforeground => "$bt6AFore", -background => "$bt6Bac", -foreground => "$bt6Fore", -padx => $padxi, -pady => $padyi, -command => \&Nr6, ); $bt6->pack( -side => "left", -fill => "both", -expand => "yes", ); $mvol = $mw->Frame(); $mvol->pack( -side => "top", -fill => "both", -expand => "yes", ); $sc = $mvol->Scale( -orient => "horizontal", -from => 0, -to => 100, -variable => \$vol, -command => \&Cv, -activebackground => "$volABac", -background => "$volBac", -foreground => "$volFore", ); $sc->set($pVol); $sc->pack( -side => "left", -fill => "both", -expand => "yes", ); $bt7 = $mvol->Button( -text => decode("utf8", "$bt7Txt"), -font => "$bt7Font", -relief => "flat", -text => decode("utf8", "$bt7Txt"), -font => "$font", -activeforeground => "$bt7AFore", -activebackground => "$bt7ABac", -background => "$bt7Bac", -foreground => "$bt7Fore", -padx => 0, -pady => 0, -command => \&Sw, ); $bt7->pack( -side => "left", #-fill => "both", #-expand => "yes", ); MainLoop; ##################################################################### sub Ap{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"perl aplay-pi.pl -def -list\""); } sub Nr1{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=$bt1Id\"");#ID } sub Nr2{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=$bt2Id\"");#ID } sub Nr3{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=$bt3Id\"");#ID } sub Nr4{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"/home/pi/play_radiko.sh $bt4Id\"");#ID } sub Nr5{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"/home/pi/play_radiko.sh $bt5Id\"");#ID } sub Nr6{ if($bt6Id){ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"/home/pi/play_nhk-radio.sh $bt6Id\"");#ID }else{ &Chk; $bTi = 8; system("gnome-terminal --geometry=$tmGeometry -e \"mplayer -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=$bt6IdSHOUT\"");#ID } } sub Cv{ system("amixer -c 1 sset PCM $vol\%");#ヴォリューム USB (ライン出力の場合は 1 を 0 に) } sub Sw{ if($msg eq "yes"){ my $msgbox = $mw->messageBox( -title => "really", -icon => "question", -type => "OkCancel", -default => "Cancel", -message => decode("utf8", "シャットダウン!?"), ); if($msgbox eq 'Ok'){system("sudo shutdown -h now");}else{return; } } else{system("sudo shutdown -h now");}#Stop } sub Chk{ if($bTi){system("killall -s HUP gnome-terminal-server"); $bTi = 0;}; #Terminal Window Close } sub Next{ system("killall -s HUP aplay mpg321"); } ###########/home/pi/pi.pl##################ここまで 5 ラズベリーパイ Perl/TKで操作画面
by digressive
| 2016-09-13 10:21
| プアオーディオ
|
Comments(0)
|
カテゴリ
全体熟年マカー失業録 DTPに花束を すみません、取り乱しました。 マカーはケチだから Ubuntu プアオーディオ ペンタブしよう non6 nuseum リンク
ホームページ作成 WEBデザイン(Perl PHP MySQL) グラフィックデザイン CI 各種印刷物 広告 SP はじめました。 ■□■□■□ RandomReading《読書記録》 通勤電車が私の書斎さ。 ■□■□■□ WEBカラーネーム WEBカラーチャート 植草一秀の『知られざる真実』 頑張れミラーマン 世に倦む日々 無料版です 天木直人.com 多少偏向していそうだが、 文春よりは参考になる きっこのブログ 謎のブログ、リンクしていいのかな? とりまきメモ ブログというより、日記帳ですね。 LINK MEMO 小生の勝手なリンク集 pixiv お気に入りブログ
世に倦む日日絵と音楽のコラボレーショ... ライフログ
検索
タグ
フルレンジ
raspberry pi
ヘッドホン
真空管アンプ
bluetooth
iPhone-color
KOBE
アルニコ
raspbian
iPhone
ハードオフ
ヘッドホン自作
フォノイコライザー
パワーアンプ
i2s
ヘッドホンアンプ
HOLGA-color
インターネットラジオ
学研
木製ヘッドホン
Raspberry Pi
ランダム再生
オペアンプ
usb dac
ポートアイランド
小金井市
YDA138
volumio
ラジオ
infinite painter
yda138
aplay
USB DAC
Raspbian
HyCAA
raspberry pi 3
新年
自作
ダイソー
volumio2
改造
アンプ
ハイレゾ
6j1
Bluetooth
USBダック
se-u33g
カーオーディオ
ES9018K2M
dac
mac mini
山水
Hex3653
ta2020
マイナンバー
マイナンバーカード
ubuntu mate
TVTest
サブウーファー
TvRock
真空管
モノラルアンプ
ES9023
神戸
windows10
fostex
google home mini
スピーカー
きのこ帝国
大人の科学
NFJ
SQ5
ht82v739
レコードプレーヤー
applepencil
電解コンデンサー
SSD
HOLGA
4B-1B
イヤホン
バランス出力
radiko
Volumio2
javascript
TDA2822M
cdプレーヤー
PCスピーカー
PC自作
PD2506Q
Perl/TK
Photoshop
REIYIN DA-DD
RIAA
Radiko
Raspberry
Raspberry Pi 4
RockBox
Rspbian
SD カード
SDGs
ブログパーツ
| |||||||||||||||||||||||||||||||||||||||||||||||||
ファン申請 |
||