인터넷 방송 리모콘 *^^*
글쓴이: zedai1972 / 작성시간: 목, 2003/06/05 - 9:53오전
집에서 인터넷방송을 자주봅니다. 그래서 url을 기억못하기때문에
case문을 남발한 셀프로그램으로 방송을 보곤했는데 tk를 사용해서
x에서 마우스만으로 조작하고 싶었슴다 .. 문득 -_-;
코드를 카피엔 패이스트 -_- 하면서 이게 아닌데 싶더군요...
좀더 다이너믹하면서.... 꿀꺽
코드는 아래처럼 좀 .. 무식함니다.
but !
하지만 돌아가죠 ^^;;
----------------------------------------------------
기본조건: 인터넷연결, mplayer, tk
실행조건: 위의 기본조건 충족 -> 아래 코드 를 복사해서 화일로 만듬
-> 화일에 실행권한을 줌 -> 실행
방송채널얻어온곳 : http://debianusers.org/DebianWiki/radio
소스코드 출처: Beginning Linux programming .. -_-
개선의 여지가 많은데 .. 가령 연결시 연결이 되는건지...
연결가능한 사이트만 활성화 한다든지...등등..
여러분들이 좀 수정좀 해줘서 알려주세요 ^^;
전 tk를 잘 몰라서여 ....
----------------------------------------------------
#!/usr/bin/wish -f #!/usr/ set channel 0 set ra_state 0 set bt_state 0 set it_state 0 set ct_state 0 # 9,3,2,13 set r_ch_num 10 set bt_ch_num 4 set it_ch_num 3 set ct_ch_num 14 set running 0 set support_mul 0 # # col 0 checkbutton .r -text "라디오" -command {changeState} -relief flat \ -variable r_state -onvalue 1 -offvalue 0 # # col 1 checkbutton .bt -text "공중파 TV" -command {changeState} -relief flat \ -variable bt_state -onvalue 1 -offvalue 0 # # col 2 checkbutton .it -text "위성 TV" -command {changeState} -relief flat \ -variable it_state -onvalue 1 -offvalue 0 # # col 3 checkbutton .ct -text "케이블 TV" -command {changeState} -relief flat \ -variable ct_state -onvalue 1 -offvalue 0 # radio # col =0 radiobutton .r1 -text "FM_서울mbc" -variable channel \ -value mms://liveradio.imbc.com/imbcmfm -justify left radiobutton .r2 -text "AM_서울mbc" -variable channel \ -value mms://liveradio.imbc.com/imbcsfm -justify left radiobutton .r3 -text "FM_kbs1" -variable channel \ -value mmst://live.kbs.co.kr/L_1FM -justify left radiobutton .r4 -text "FM_kbs2" -variable channel \ -value mmst://live.kbs.co.kr/L_2FM -justify left radiobutton .r5 -text "AM_kbs_1radio" -variable channel \ -value mms://liveradio.imbc.com/imbcsfm -justify left radiobutton .r6 -text "AM_kbs_2radio" -variable channel \ -value mms://liveradio.imbc.com/imbcsfm -justify left radiobutton .r7 -text "AM_kbs_3radio" -variable channel \ -value mms://liveradio.imbc.com/imbcsfm -justify left radiobutton .r8 -text "사회교육방송" -variable channel \ -value mms://live.kbs.co.kr/L_SCR -justify left radiobutton .r9 -text "뮤직클럽 *^^*" -variable channel \ -value http://cast1.mukulcast.com:11000 -justify left # broad TV # col =1 radiobutton .bt1 -text "mbc" -variable channel \ -value mms://live.imbc.com/imbctv -justify left radiobutton .bt2 -text "kbs1" -variable channel \ -value mmst://211.106.66.140/H_1TV -justify left radiobutton .bt3 -text "kbs2" -variable channel \ -value mmst://211.233.25.52/H_2TV -justify left # -_- TV # col =2 radiobutton .it1 -text "위성kbs1" -variable channel \ -value mmst://live.kbs.co.kr/S_2TV -justify left radiobutton .it2 -text "BS-1" -variable channel \ -value mms://165.229.11.114/satellite2 -justify left # cable TV # col=3 radiobutton .ct1 -text "YTN" -variable channel \ -value mms://211.115.218.231/YTNLIVE -justify left radiobutton .ct2 -text "동아" -variable channel \ -value mms://vodcast5.korea.com/new_donga_live -justify left radiobutton .ct3 -text "아리랑~" -variable channel \ -value mms://210.124.186.162/arirangtv -justify left radiobutton .ct4 -text "iTV" -variable channel \ -value mms://iTV.dreamxlive.net/iTV -justify left radiobutton .ct5 -text "MBN" -variable channel \ -value mms://mbnlive.dreamxlive.net/mkimbn200 -justify left radiobutton .ct6 -text "KTV" -variable channel \ -value mms://211.216.53.154/KTV -justify left radiobutton .ct7 -text "OBC" -variable channel \ -value mms://211.47.66.174/obci -justify left radiobutton .ct8 -text "SDN(ch35)" -variable channel \ -value mmst://218.50.3.153/ch35 -justify left radiobutton .ct9 -text "KMTV" -variable channel \ -value mms://211.58.56.229/kmtv1818 -justify left radiobutton .ct10 -text "M.Net" -variable channel \ -value mms://vodmusic4.korea.com/mnet -justify left radiobutton .ct11 -text "불교" -variable channel \ -value mms://211.174.60.147/btnlive -justify left radiobutton .ct12 -text "기독교" -variable channel \ -value mms://211.233.71.230/tvlive -justify left radiobutton .ct13 -text "일본m-tv" -variable channel \ -value mms://211.234.191.84/movie-tv -justify left checkbutton .support_m -text "다중채널지원 TV" -command {changeState} -relief flat \ -variable support_mul -onvalue 1 -offvalue 0 button .closeall -text "열린모든mplayer닫기" -command closeall -justify right button .show -text "현재선택된사이트연결" -command showVars -justify right button .exit -text "Exit" -command {fnexit} -justify right # r_row=9 grid .r -row 0 -column 0 -sticky "w" grid .r1 -row 1 -column 0 -sticky "w" grid .r2 -row 2 -column 0 -sticky "w" grid .r3 -row 3 -column 0 -sticky "w" grid .r4 -row 4 -column 0 -sticky "w" grid .r5 -row 5 -column 0 -sticky "w" grid .r6 -row 6 -column 0 -sticky "w" grid .r7 -row 7 -column 0 -sticky "w" grid .r8 -row 8 -column 0 -sticky "w" grid .r9 -row 8 -column 0 -sticky "w" # bt_row=3 grid .bt -row 0 -column 1 -sticky "w" grid .bt1 -row 1 -column 1 -sticky "w" grid .bt2 -row 2 -column 1 -sticky "w" grid .bt3 -row 3 -column 1 -sticky "w" # it_row=2 grid .it -row 0 -column 2 -sticky "w" grid .it1 -row 1 -column 2 -sticky "w" grid .it2 -row 2 -column 2 -sticky "w" # ct_row=13 grid .ct -row 0 -column 3 -sticky "w" grid .ct1 -row 1 -column 3 -sticky "w" grid .ct2 -row 2 -column 3 -sticky "w" grid .ct3 -row 3 -column 3 -sticky "w" grid .ct4 -row 4 -column 3 -sticky "w" grid .ct5 -row 5 -column 3 -sticky "w" grid .ct6 -row 6 -column 3 -sticky "w" grid .ct7 -row 7 -column 3 -sticky "w" grid .ct8 -row 8 -column 3 -sticky "w" grid .ct9 -row 9 -column 3 -sticky "w" grid .ct10 -row 10 -column 3 -sticky "w" grid .ct11 -row 11 -column 3 -sticky "w" grid .ct12 -row 12 -column 3 -sticky "w" grid .ct13 -row 13 -column 3 -sticky "w" # 실행, 종료 grid .support_m -row 14 -column 0 -sticky "w" grid .closeall -row 14 -column 1 -sticky "w" grid .show -row 14 -column 2 -sticky "w" grid .exit -row 14 -column 3 -sticky "w" proc fnexit args { global running if {$running == "1"} { exec killall mplayer set running 0 } exit } proc closeall args { global running if {$running == "1"} { exec killall mplayer set running 0 } } proc changeState args { global r_state global bt_state global it_state global ct_state global r_ch_num global bt_ch_num global it_ch_num global ct_ch_num # 9,3,2,13 if {$r_state == "0"} { catch { .r1 config -state disabled .r2 config -state disabled .r3 config -state disabled .r4 config -state disabled .r5 config -state disabled .r6 config -state disabled .r7 config -state disabled .r8 config -state disabled .r9 config -state disabled } } else { .r1 config -state normal .r2 config -state normal .r3 config -state normal .r4 config -state normal .r5 config -state normal .r6 config -state normal .r7 config -state normal .r8 config -state normal .r9 config -state normal } if {$bt_state == "0"} { catch { .bt1 config -state disabled .bt2 config -state disabled .bt3 config -state disabled } } else { .bt1 config -state normal .bt2 config -state normal .bt3 config -state normal } if {$it_state == "0"} { catch { .it1 config -state disabled .it2 config -state disabled } } else { .it1 config -state normal .it2 config -state normal } if {$ct_state == "0"} { catch { .ct1 config -state disabled .ct2 config -state disabled .ct3 config -state disabled .ct4 config -state disabled .ct5 config -state disabled .ct6 config -state disabled .ct7 config -state disabled .ct8 config -state disabled .ct9 config -state disabled .ct10 config -state disabled .ct11 config -state disabled .ct12 config -state disabled .ct13 config -state disabled } } else { .ct1 config -state normal .ct2 config -state normal .ct3 config -state normal .ct4 config -state normal .ct5 config -state normal .ct6 config -state normal .ct7 config -state normal .ct8 config -state normal .ct9 config -state normal .ct10 config -state normal .ct11 config -state normal .ct12 config -state normal .ct13 config -state normal } } proc showVars args { global r_state bt_state it_state ct_state global channel running support_mul if {$running == "1" & $support_mul =="0"} { exec killall mplayer set running 0 } exec mplayer $channel & set running 1 }
Forums:
#!/usr/bin/wish -f
wish가 무슨 프로그램인가요?
----------------------------
May the F/OSS be with you..
wish 란
음 셀코드에서 #!/bin/sh 처럼 기본 셀을 찾는게 아닌가 싶네요 ^^ ..
p.s : 위의 저의 코드를 카피해서 실행해 보니 tk의 기본 함수를 인식 못하는
에러가 뜨는 군요... 흠 짱나네 .. 영화 봐야하는디 >..<
\\(^^ )^^)// **
wish 란..
man wish 하면 자세하게 나오는데요
TCL/TK 를 이용한 Simple windowing shell 이랍니다.
당신을 위한 수호기사 Knight4u™
댓글 달기