Posts Tagged ‘linux’

exaile豆瓣电台插件(exaile-doubanfm-plugin)

07月 2, 2010

豆瓣电台一直是flash客户端,嵌入浏览器,出于对flash的厌恶,本人开发了这个exaile插件,让广大linux同学在exaile里享受豆瓣电台一目了然桌面集成和全部豆瓣电台功能。

exaile-doubanfm-plugin features:

  • 登录豆瓣,获取豆瓣电台播放列表
  • 持续下载电台播放列表,实现不重复的持续播放
  • 标记/取消“喜爱”、标记“回收站”、跳过
  • 显示歌曲信息

screenshot_001

screenshot_002

screenshot_002

项目地址:
http://github.com/sunng87/exaile-doubanfm-plugin

下载页:
http://github.com/sunng87/exaile-doubanfm-plugin/downloads

使用:

  1. 激活插件,填写用户名密码
  2. 重启exaile
  3. 文件菜单,open douban.fm,选择频道
  4. 点击播放开始
  5. 将rating设置为5 标记喜欢
  6. rating设置2 豆瓣标准跳过
  7. rating设置1 豆瓣删除

The post is brought to you by lekhonee v0.7

Exaile-Douban-Covers 0.0.3 Released

06月 30, 2010

一眨眼有大半年没有维护这个插件了,Exaile从0.3.0升级到了0.3.2。严重的是这三个版本的插件接口各不相同,0.3.1新增了cover providers管理, 修改了track获得相应字段的api,简化了CoverSearchMethod的职责(去掉了缓存管理,只负责find_convers和get_conver_data两个功能)。而0.3.2至少也修改了配置管理界面的API,所以可以在0.3.1上工作的版本也不能在0.3.2上工作。

这次升级维护把插件升级到0.0.3,兼容目前Ubuntu仓库里的Exaile 0.3.1.1。0.3.1.1新提供了一个cover provider的配置界面,可以调整cover provider的优先级,如果你听中文歌比较多,建议可以把douban cover放在第一位。

下载页面(doubancovers-0.0.3.exz ):
http://bitbucket.org/sunng/exailedoubancovers/downloads

新版本和0.3.0已经无法兼容,0.3.0的用户可以继续使用0.0.2 。而兼容0.3.2的版本预计要等到10月份之后推出了,用Archlinux和其他自己安装的用户要稍等一阵了。

The post is brought to you by lekhonee v0.7

Python获取本机IP

06月 5, 2010

除了用inetface库和分析ifconfig输出以外,一个比较简单的获取本机IP的方法:
[cc lang="python"]
import socket
def get_local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((“sdo.com”,80))
return s.getsockname()[0]
[/cc]

参考 http://stackoverflow.com/questions/166506/finding-local-ip-addresses-in-python

Reset default cursor theme and web browser after installing kubuntu

04月 3, 2010

If you installed kubuntu parallel to ubuntu, you might find that the default browser is set to konqueror and cursor theme is oxygen which cannot modified by “gnome-default-applications-properties” and “gnome-appearance-properties”.

To fix this, use Debian update-alternatives tool:
update-alternatives –config x-www-browser
update-alternatives –config x-cursor-theme

All configurable options are listed at /var/lib/dkpg/alternatives

Get your conky location aware

02月 19, 2010

2010-02-19-225826_188x44_scrot

Add this in your conkyrc
[cc lang="text" nowrap="0"]
${exec curl -s “http://api.hostip.info” | xpath -e “//gml:featureMember/Hostip/gml:name/text()” -q} ${exec curl -s “http://api.hostip.info” | xpath -e “//gml:featureMember/Hostip//gml:coordinates/text()” -q}
[/cc]

Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like
[cc lang="xml" nowrap="0"]

This is the Hostip Lookup Service
hostip

inapplicable

58.212.88.212
Nanjing
CHINA
CN

118.883,32.05

[/cc]

Because it uses ip to lookup your address, you cannot expect higher resolution and precision currently.

Using weather

02月 18, 2010

Ubuntu仓库里有个weather-util包,可以用来查看天气信息。weather工具从weather.noaa.gov网站获得天气信息,对美国的城市可以直接用名字查询,其他国家只能使用id查询。id的规则和weather.com不太相同。

中国的天气站点id可以在这个页面上查到。比如南京ZSNJ,上海浦东ZSPD。使用weather工具查询:
weather -i ZSNJ

Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 59%
Wind: from the SSW (210 degrees) at 4 MPH (4 KT)

简化操作,可以在$HOME下创建.weatherrc文件,形如
[cc lang="ini"]
[default]
ID = ZSPD
[nj]
ID = ZSNJ
[/cc]

就可以直接使用
weather

Current conditions at China (ZSPD) 31-07N 121-46E (ZSPD)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 47%
Wind: from the NE (050 degrees) at 7 MPH (6 KT) (direction variable)


weather nj

Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 59%
Wind: from the SSW (210 degrees) at 4 MPH (4 KT)

老物什 / Old Stuff

02月 14, 2010

大年初一翻旧物,找到一些让人颇有感触的旧物件。2004年买的RH9,2005年夏天买的Fedora 4。前者至今还安装在我家最旧的电脑里,虽然我都忘了它的样子了。

包装
00011
00012
00014
00013
00018

手册
00016
00022
00021

CDs
00015
00017
00019
00020

这个代理商里仁软件似乎已经倒闭了。

Virtual Machine Searcher for Gnome Deskbar Applet

02月 12, 2010

Very glad to announce another daily-coding work: an extension for gnome deskbar applet to search and launch virtual machine. There is a plugin for gnome-do that does the same job. That’s what I create the the plugin for. I switched to deskbar because gnome-do’s Do.exe reminds me nightmares when I was a M$ Windows user. The deskbar applet has been a great replacement, however, the virtualbox plugin in Do is really impressive while deskbar doesn’t provide me the same functionality.

You can ignore words above and just take a look at the screenshot:
deskbar-virtualbox

Download

Download the extension from (the highlighted one):
http://bitbucket.org/sunng/daily-coding/downloads/?highlight=5137

You can also trace the development at bitbucket project. However, the repository is mixed with other small code snippets. Currently, mercurial doesn’t support subdirectory pull. So there is no way to grab the deskbar-applet individually.

Installation

copy this file to /usr/lib/deskbar-applet/deskbar-applet/modules-2.20-compatible/ (Ubuntu installation for example) with super user privilege. Right click desktbar applet, select Preference, Searchers tab, hit “Reload” button, then check the Virtualbox Deskbar Module.
deskbar-preference

Issue

Feel free the report issues on bitbucket:
http://bitbucket.org/sunng/daily-coding/issues/

List your installed virtualbox virtual marchines using vbox python xpcom api

02月 12, 2010

I’m sorry for the long title. Due to lack of documentation, it’s not easy to use python xpcom api from virtualbox sdk. The code below is just a sample that lists your installed virtual machines. It works on linux with VirtualBox OSE 2.0.8. Hope useful to you.
[cc lang="python"]
import vboxapi
vmsg = vboxapi.VirtualBoxManager(None, None)
vbox = vmsg.vbox
vmsg.mgr.getSessionObject(vbox)
machs = vbox.getMachines()
names = map(lambda x: (x.name,x.id), machs)
print names
[/cc]
Output:
[cc lang="python" nowrap="false" line_numbers="false"]
[(u'Ubuntu', u'aac3fd46-4f1e-4f6e-8abe-b1a5516abf8c'), (u'Windows', u'fa73952e-f0a6-4bf0-af20-259513d73bc1'), (u'OpenSolaris', u'a951542c-3178-4a6b-8087-f1b0314e283a'), (u'LinuxMint', u'8191f256-1b76-4ce7-a202-93730dae1b33'), (u'Fedora', u'ca250f45-d752-4baf-9281-fb0847dc8287'), (u'Freebsd', u'8322b62a-aed5-4f04-9815-9fadfeba9fe1'), (u'ArchLinux', u'efc1167a-4e06-4c14-aeb0-bfb303c8f5f7'), (u'openSUSE', u'02e18816-311d-420b-99b3-6b4b4cccf7b7'), (u'CentOS', u'ccf0421c-85c4-4123-8722-57abc494c633')]
[/cc]

解决Ubuntu Openbox无法启动的问题

02月 11, 2010

今天在工作用的ArchLinux上安装了用Openbox取代了GNOME桌面,感觉良好,回来尝试一下在Ubuntu上也做同样的事情。不料遇到问题,在完成基本的配置之后,Openbox Session无法启动,总是自动跳回gdm。查看.xsession-errors,是gnome-setting-daemon报错:

(gnome-settings-daemon:2519): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL’ failed

既然是gnome-settings-daemon报错,就在.config/openbox/autostart.sh中注视掉和gnome-settings-daemon相关的部分:

# Make GTK apps look and behave how they were set up in the gnome config tools
#if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
#  /usr/libexec/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null; then
#  gnome-settings-daemon &
# Make GTK apps look and behave how they were set up in the XFCE config tools
#elif which xfce-mcs-manager >/dev/null; then
#  xfce-mcs-manager n &
#fi

进而可以启动Openbox Session了,但是发现Conky仍然无法启动,经过搜索是sleep的时间不够长导致的。而根据launchpad上上的讨论,gnome-settings-daemon也可以在Openbox Session启动后正常运行,于是可以这样设置autostart.sh

(sleep 20 && conky 1>/dev/null 2>/dev/null) &
(sleep 2 && tint) &
(sleep 5 && tilda) &
(sleep 20 && gnome-settings-daemon 1>/dev/null 2>/dev/null) &

tint和tilda对启动顺序没有明确的要求,conky和gnome-settings-daemon需要设置一个较长的等待时间。

这是Ubuntu中Openbox的一个bug,可以在此跟踪:

https://bugs.launchpad.net/ubuntu/+source/openbox/+bug/459005

顺手展示一下我的Openbox桌面
myopenbox

openbox / tint2 / conky / tilda 还没来得及认真配置,呵呵。

再有,Ubuntu源里的的tint2版本很低,问题不少,不支持宽度的百分数配置,不支持systray等配置。建议安装开发版本:

http://code.google.com/p/tint2/wiki/Install#For_Ubuntu_9.10_%28Karmic%29


加关注

Get every new post delivered to your Inbox.