Posts Tagged ‘foss’

Exaile-doubanfm-plugin 0.0.2

07月 4, 2010

Exaile doubanfm plugin 0.0.2 预览版,目标是在Linux桌面提供豆瓣电台的完整体验。

目前插件只能运行在Exaile 0.3.1版本上。

0.0.2增加了豆瓣电台专用的视图:
screenshot_001

相比第一版通过rating来实现豆瓣电台喜欢、跳过和删除的功能,在专用视图上有专门的按钮来操作。

其他细节更新:

  • 当剩余曲目超过15首时不再增加播放列表
  • 当播放到最后一首歌曲取新播放列表时增加重试机制
  • 修正libdbfm跳过曲目bug一个

安装:
打开Exaile Preference,Plugin页,点击按钮Install Plugin,选择doubanfm.exz即可。如果存在问题,可以执行以下命令:
mv doubanfm.exz douban.tar.gz
tar xf doubanfm.tar.gz
mv doubanfm ~/.local/share/exaile/plugins/

转到doubanfm设置页面,填写用户名密码重启Exaile。
screenshot_002

打开File菜单,选择豆瓣电台频道
screenshot_001

选择曲目就可以开始播放了,选择视图中豆瓣电台视图可以切换到豆瓣电台视图。

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

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

另外,doubancovers插件也有一个针对豆瓣电台的更新可以快速获取豆瓣电台音乐的封面:
http://bitbucket.org/sunng/exailedoubancovers/downloads?highlight=9265

The post is brought to you by lekhonee v0.7

交通游戏OpenTTD

05月 2, 2010

我总是对这种城市建设、交通规划一类的游戏欲罢不能,以前在Linux上一直只是玩Lincity,后来发现了纯交通类的simutrans,最近升级到Ubuntu10.04以后,终于可以玩这个六年磨一剑,精雕细琢的OpenTTD了。

Chindhattan Springs Transport, 19th Dec 1953

可以建造各种客运货运的汽车站、火车站,机场,码头等等,可以建设道路、铁路,可以购买公交车、卡车、火车头、火车车厢等等。可惜我玩了大半天还不知道怎么盈利。。。

Douban provider for Alexandria

04月 30, 2010

Alexandra is a desktop book collection manager on gnome written in ruby. With an extensible architecture, Alexandria uses different sources to retrieve book’s data, including Amazon and many local sites.

Douban.com is considered to be most applicable data source for books published in Chinese. So I write this provider according to Alexandria’s SPI. Now it’s possible to add Chinese books and manage reading lists.

alexandria

Now the code can be found in Alexandria’s bug tracker:
http://rubyforge.org/tracker/index.php?func=detail&aid=28160&group_id=205&atid=865

However, the patch file of book_providers.rb in that list is for svn trunk head version only. To use it with currently stable version of Ubuntu, first, make sure you have Alexandria version 0.6.5-0ubuntu1 and libjson-ruby1.8 installed.

Download douban.rb from rubyforge:
http://rubyforge.org/tracker/download.php/205/865/28160/4923/douban.rb
Copy the file to /usr/lib/ruby/1.8/alexandria/book_providers/ with super user privileges.
Use this patch to /usr/lib/ruby/1.8/alexandria/book_providers.rb
[cc lang="ruby"]
310a311,323
< begin
< begin
< require 'json'
< rescue LoadError
< require 'rubygems'
< require 'json'
< end
< require 'alexandria/book_providers/douban'
< rescue LoadError =< ex
< log.error{ex}
< log.warn {'Fail to load douban as provider'}
< end
<
[/cc]

Feel free to report issue here.

搞定gwibber

03月 22, 2010

升级10.04之后,gwibber2.29开始使用pycurl来处理IO。结果一条更新都拿不下来,为此搜到很多相关、不相关的bug。最后终于自己找到问题,原来是pycurl.setopt方法传入字符串如果是unicode就会报typeerror。而通过gwibber配置界面输入的所有字符都是unicode编码,于是问题也就简单了。做个处理,在 /usr/lib/python2.6/dist-packages/gwibber/microblog/network.py 第18到21行:
[cc lang="python"]
self.curl.setopt(pycurl.URL, str(url).encode(‘ascii’))

if username and password:
self.curl.setopt(pycurl.USERPWD, (“%s:%s” % (username, password)).encode(‘ascii’))
[/cc]

另外,使用StatusNet的Twitter兼容API来做Twitter API代理,需要把代理的目录名设置为api,因为/api这个路径是写死在gwibber代码里的。通过界面输入的,只是代理的domain。

说实在的gwibber还是挺烂的。

https://bugs.launchpad.net/bugs/542501

https://bugs.launchpad.net/bugs/543860

I ♥ Free and Open Source Software

02月 14, 2010

I love Free Software!

使用gnome-dictionary和dictd

02月 7, 2010

最近琢磨字典多一些,以前一直不知道gnome自带的gnome-dictionary如何使用,因为默认的字典源里都没有中文字典,而且离线更是无法使用。其实不然,字典服务可以自架,并且可以使用自己的字典。

在自己的机器上架设dictionary server,以ubuntu为例:

安装dictd / dict
sudo apt-get install dictd dict

前者是字典服务器,后者是字典服务客户端。还可以从仓库里安装已经打包好的字典,如
sudo apt-get install dict-stardic
是一个英汉字典

dictd安装好后会默认自启动,也可以通过
sudo service dictd start
来控制dictd的启动、重启和关闭。

通过dict测试服务的状况
dict -D
命令会列出可用的数据库(即字典)

在gnome-dictionary中添加字典源 Edit->Preference->Source->Add
Name: 自定义的字典名
Transport: Dictionary Source
Hostname: 127.0.0.1
Port: 2628

Close之后可以到主界面打开侧边栏,在Dictionary Source中双击选定此字典,在Aailable Dictionaries里双击选中目标字典,于是就可以在gnome-dictionary里使用本地的字典服务了。

接下来安装自己的字典。stardict的网站上有很多中文字典,上面也都标示了授权协议。要在dictd里使用这些字典,需要进行一个简单的格式转换。安装一个工具
sudo apt-get install dictconv

它的使用方法:
dictconv -o OUTPUT_FILE INPUT_FILE

在input_file指定stardict的.ifo文件,在output_file指定要生成的dictd的.index文件。这个转换非常耗时,需要有足够的耐心。这个操作将会生成.index和.dict文件。对.dict文件进行压缩:
dictzip OUT.dict

转换完成后,编辑/var/lib/dictd/db.list文件,在其中添加一个database定义
database YOUR_DB_NAME{
data PATH_TO_DICT_DZ
index PATH_TO_INDEX
}

其中PATH_TO_DICT_DZ是上一步的.dz文件,PATH_TO_INDEX是到上一步生成的.index文件的路径。编辑完成后,重启dictd服务
sudo service dictd restart

使用dict -D可以查看启用的字典。

建议备份/var/lib/dictd/db.list文件,因为每次从apt-get安装字典后,这个文件都会被覆盖。

dictd服务也可以在fantasdic里访问。

很山寨

02月 3, 2010

经常访问GNU的网站你会发现一些很神奇的东西,比如gNewSense,又比如最新的:
IceCat

怎么样,够震撼啊,GNUzilla套件里的第一个发布,IceCat。IceCat是嘛?你知道Firefox吧,那拉开冰箱门,把Firefox塞进去,带上冰箱门,嗯,那就是IceCat了。当然是开玩笑了,GNU IceCat is the GNU version of the Firefox browser. Its main advantage is an ethical one: it is entirely free software.

现在已经可以在Ubuntu中使用这个病猫,哦不,冰猫了:

sudo add-apt-repository ppa:gnuzilla-team/ppa
sudo apt-get update
sudo apt-get install icecat

Patch for Fantasdic Google Source

02月 2, 2010

I found fantasdic a great powerful dictionary tool with friendly UI and supports multiply sources. Unfortunately, this project seems to be no longer maintained. The latest version is 1.0-beta7.
fantasdic-google

The google translate source was created in 2007. As the google translate service page changed, this module doesn’t work any more, so I just picked up my vim then created this patch for those still want to use it.

This patch has dependency with ruby’s json module, so before you apply it, run:
sudo gem install json
or
sudo apt-get install libjson-ruby1.8

Download the patch at:
https://bugzilla.gnome.org/attachment.cgi?id=152835

Patch it (Ubuntu installation as example):
cd /usr/lib/ruby/1.8/fantasdic/sources/
sudo patch google_translate.rb /home/sun/google_translate.rb.diff

Restart fantasdic, then your get it works! And this bug is tracked at:
https://bugzilla.gnome.org/show_bug.cgi?id=605641

翻译po

01月 31, 2010

翻译一个po文件。确认安装了gettext工具包。

cd到po目录,创建pot
intltool-update –pot

创建相应的语言文件,例如zh_CN
msginit -l zh_CN.utf8

程序会提示选择或输入邮箱,之后就会生成zh_CN.po文件,打开文件,逐条编辑msgstr即可。

手动编辑LINGUAS文件,按顺序将zh_CN添加到其中。

可以通过这个命令查看翻译的进度
msgfmt -cv zh_CN.po

对于更新pot更新的情况,可以使用命令更新po文件
intltool-update zh_CN

参考:

A button by GIMP

12月 9, 2009

Inspired by a “Call to action” tutorial of Photoshop, I’d like to do the same thing with free and open source software, GIMP.

Before we start the journey, it’s better to get well prepared. Take a look at the powerful plugin “Layer Effects“. It provides you complete functionality as “Layer Style” in Photoshop does which is of critical importance in such kind of image manipulation. Follow the installation guide and I won’t spend many words about this step.

Open your gimp, create a new canvas with custom size (which makes you feel comfortable)

New a layer, use selection tool to create a rounded rectangle selection area.

Fill the selection with gradient color.

Resize the canvas. Glow the selection with 3px by menu command “selection->glow”. The crop the canvas by selection using “image->crop by selection”.

Then we apply some layer effects to beauty the button.

  • layer effects: inner glow, white 75% opacity, size 5
  • layer effects: stroke 1px

Place some text on the button such as “Sign Up”. Bold sans font(DejaVu sans or Helvetica bold) is recommended here.

Use gradient overlay effect on the text. As the layer effects plugin doesn’t support gradient overlay on text, we have to do it in a different way. First, create a new layer. Then convert text to selection with context menu command. Gradient fill the selection and hide the original text layer at last. Now we got:

Don’t stop here. Add layer effects on the new layer:

  • inner shadow, black, size 2px, distance 2px, angle 90
  • drop shadow, light, size 2px, distance 2px, angle 90

You can tune the color schema by yourself along the process :)


加关注

Get every new post delivered to your Inbox.