[分享] Linux 下播放 Hinet 電台的便利工具

常言道:『飲水思源』,在 Open Source 的世界裡,我們常常需要別人的幫助,但是在您有所心得的時候請記得分享給大家,『幫助人是快樂的喔』。歡迎您在使用 debian 的過程中的任何心得分享給大家。

[分享] Linux 下播放 Hinet 電台的便利工具

文章PCMan » 週日 8月 20, 2006 2:30 pm

Hinet Radio http://radio.hinet.net/ 上面有不少網路電台可以聽
但因為是 IE only,使得 linux 使用者難以利用
而電台的網址經過重重轉址,還會經常變更,無法直接抓出網址
之前有些前輩寫出方便自動抓網址呼叫 mplayer 播放的 script
可以用,但是使用上總還是有些不便,於是
小弟我就用 gtk+ 2 寫了個非常小的程式,常駐在系統列
按下圖示就拉出選單,裡面是各種可選的 hinet 電台
點選就直接呼叫 mplayer 播放,不聽的時候也隨時可以停止或換台
這樣就可以輕鬆的在 linux 下聽 hinet radio 的各個電台了

程式下載網址:
可使用網友 jac 包的 deb,直接 dpkg -i 安裝
http://myweb.ncku.edu.tw/~n9694113/hine ... 3_i386.deb

或者從程式碼 tarball 自己編譯
http://pcman.sayya.org/hinet_radio.tar.bz2
以 root 權限執行 make install 就可以安裝完成
編譯本程式需要 libgtk2-dev 和 mplayer套件

執行 hinet_radio 後,可以看到系統列多出一個三角形圖示
用滑鼠點下去即可拉出選單,選擇想要的電台播放 :)
PCMan
榮譽學長
榮譽學長
 
文章: 217
註冊時間: 週六 7月 02, 2005 10:46 am

文章chihchun » 週二 8月 22, 2006 8:37 am

嗨,我做了 radio.hinet.net plugin for streamtuner。:-)
http://people.debian.org.tw/~chihchun/2 ... reamtuner/
-Rex, geek by nature linux by choice
http://people.debian.org.tw/~chihchun
頭像
chihchun
摩托學園!學園長們
摩托學園!學園長們
 
文章: 185
註冊時間: 週三 11月 27, 2002 10:17 am
來自: KaLUG

文章洪瑞興 » 週二 8月 22, 2006 11:06 pm

Script /usr/share/streamtuner/python/scripts/radio.hinet.net.py could not be loaded: 'module' object has no attribute 'gdk'.

今天2006/08/23更新streamtuner就解決了.
最後由 洪瑞興 於 週三 8月 23, 2006 11:08 am 編輯,總共編輯了 1 次。
洪瑞興
懵懂的國中生
懵懂的國中生
 
文章: 180
註冊時間: 週四 5月 27, 2004 7:09 pm

文章chihchun » 週三 8月 23, 2006 11:06 am

Sorry, but I try to load images by Python/GTK+ API. Would you please install python-gtk2 (2.8.6-5). If you are not using Debian, please get pygtk from http://www.pygtk.org/.

If that does not work, please tell me which version of streamtuner or distribution you are using. Thanks
-Rex, geek by nature linux by choice
http://people.debian.org.tw/~chihchun
頭像
chihchun
摩托學園!學園長們
摩托學園!學園長們
 
文章: 185
註冊時間: 週三 11月 27, 2002 10:17 am
來自: KaLUG

文章訪客 » 週三 8月 23, 2006 4:55 pm

my distribution don't have python dir at all? archlinux.
訪客
 

文章chihchun » 週三 8月 23, 2006 5:21 pm

Hi, I don't use archlinux at all, and I have no idea if your streamtuner is compiled with Python plugin enabled. Please check your build options before install my plugin. 8-)
-Rex, geek by nature linux by choice
http://people.debian.org.tw/~chihchun
頭像
chihchun
摩托學園!學園長們
摩托學園!學園長們
 
文章: 185
註冊時間: 週三 11月 27, 2002 10:17 am
來自: KaLUG

文章訪客 » 週三 8月 23, 2006 5:26 pm

chihchun 寫:Hi, I don't use archlinux at all, and I have no idea if your streamtuner is compiled with Python plugin enabled. Please check your build options before install my plugin. 8-)

thanks anyway

and I can not found any libgtk2-dev liked package in archlinux current extra testing...etc, any other pkg name could be?
訪客
 

文章chihchun » 週三 8月 23, 2006 6:21 pm

All right.

Unfortunately, the package maintainer does not put python in the dependencies list of streamtuner. That means you have to rebulid the package by yourself. (maybe he can fix the problem after you submit a bugreport ?)

You will need python, gtk2 and pygtk, before you rebulid the package.

Have fun. ;-)
-Rex, geek by nature linux by choice
http://people.debian.org.tw/~chihchun
頭像
chihchun
摩托學園!學園長們
摩托學園!學園長們
 
文章: 185
註冊時間: 週三 11月 27, 2002 10:17 am
來自: KaLUG

文章訪客 » 週三 8月 23, 2006 7:45 pm

chihchun 寫:All right.

Unfortunately, the package maintainer does not put python in the dependencies list of streamtuner. That means you have to rebulid the package by yourself. (maybe he can fix the problem after you submit a bugreport ?)

You will need python, gtk2 and pygtk, before you rebulid the package.

Have fun. ;-)

sorry!

#configure: error: unable to find the GLib library

GLib = glib ?? it installed.
anything else I should take care of?
訪客
 

文章訪客 » 週三 8月 23, 2006 8:36 pm

Anonymous 寫:
chihchun 寫:All right.

Unfortunately, the package maintainer does not put python in the dependencies list of streamtuner. That means you have to rebulid the package by yourself. (maybe he can fix the problem after you submit a bugreport ?)

You will need python, gtk2 and pygtk, before you rebulid the package.

Have fun. ;-)

sorry!

#configure: error: unable to find the GLib library

GLib = glib ?? it installed.
anything else I should take care of?

ok, it's me again, sorry...

pkgconfig is needed, it's all set now, but

Script /usr/local/share/streamtuner/python/scripts/punkcast.com.py could not be loaded: 'module' object has no attribute 'argv'.

it's the same problem with upper 洪兄, but streamtuner is newest one, and had pygtk installed, any idea?
訪客
 

文章洪瑞興 » 週三 8月 23, 2006 9:26 pm

Script /usr/local/share/streamtuner/python/scripts/punkcast.com.py could not be loaded: 'module' object has no attribute 'argv'.

這個問題有也有過而且直到今天8/23昇級streamtuner就自動解決了!
我也不知道為什麼.

以前也是某個套件有問題.
過一陣子再昇級後就ok了!
洪瑞興
懵懂的國中生
懵懂的國中生
 
文章: 180
註冊時間: 週四 5月 27, 2004 7:09 pm

文章訪客 » 週三 8月 23, 2006 10:28 pm

洪瑞興 寫:Script /usr/local/share/streamtuner/python/scripts/punkcast.com.py could not be loaded: 'module' object has no attribute 'argv'.

這個問題有也有過而且直到今天8/23昇級streamtuner就自動解決了!
我也不知道為什麼.

以前也是某個套件有問題.
過一陣子再昇級後就ok了!

這個版本是抓原網站的tarball來編譯的,所以沒得再昇級了

:crying:
訪客
 

文章chihchun » 週四 8月 24, 2006 12:31 am

Hi, I think this patch will fix your problem.
代碼: 選擇全部
--- streamtuner-0.99.99.orig/src/plugins/python/pst-main.c
+++ streamtuner-0.99.99/src/plugins/python/pst-main.c
@@ -94,6 +94,7 @@
 {
   gboolean status = FALSE;
   PyObject *module;
+  char *argv[] = { "" };
 
   if (! check_api_version(err))
     return FALSE;
@@ -109,6 +110,7 @@
     }
 
   Py_Initialize();
+  PySys_SetArgv(G_N_ELEMENTS(argv), argv);
   PyEval_InitThreads();
 
   module = PyImport_AddModule("__main__");


Please let me know if it works. Thank you.
-Rex, geek by nature linux by choice
http://people.debian.org.tw/~chihchun
頭像
chihchun
摩托學園!學園長們
摩托學園!學園長們
 
文章: 185
註冊時間: 週三 11月 27, 2002 10:17 am
來自: KaLUG

文章訪客 » 週四 8月 24, 2006 8:34 am

chihchun 寫:Hi, I think this patch will fix your problem.
代碼: 選擇全部
--- streamtuner-0.99.99.orig/src/plugins/python/pst-main.c
+++ streamtuner-0.99.99/src/plugins/python/pst-main.c
@@ -94,6 +94,7 @@
 {
   gboolean status = FALSE;
   PyObject *module;
+  char *argv[] = { "" };
 
   if (! check_api_version(err))
     return FALSE;
@@ -109,6 +110,7 @@
     }
 
   Py_Initialize();
+  PySys_SetArgv(G_N_ELEMENTS(argv), argv);
   PyEval_InitThreads();
 
   module = PyImport_AddModule("__main__");


Please let me know if it works. Thank you.

It totally damn work, tks a lot.
btw, when you want to sale HP NB anyway?
訪客
 

文章chihchun » 週四 8月 24, 2006 9:20 pm

經過 John 的錯誤回報,我改了一下前一版程式。修正了電台圖示與名稱錯位的問題,並加上音樂、新聞、外語與娛樂等電台分類。所以現在可以列出所有總共七十個網路電台了。

http://people.debian.org.tw/~chihchun/2 ... tuner-002/
-Rex, geek by nature linux by choice
http://people.debian.org.tw/~chihchun
頭像
chihchun
摩托學園!學園長們
摩托學園!學園長們
 
文章: 185
註冊時間: 週三 11月 27, 2002 10:17 am
來自: KaLUG

下一頁

回到 share

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客