參考了這篇 《GNOME Nautilus 與 WINE》
不過, Nautilus-Action在傳遞%f參數時,
會以%20取代路徑中的空白字元。
所以,會需要urllib.unquote_plus()將原本的空白字元置換回來。
由於,Linux底下的實在是沒有什麼好用的漫畫閱覽器。
只好花上400多MB空間,把Wine裝上,來跑Windows底下的漫畫瀏覽器。
想想,其實不符合成本效益。Orz...
不知道什麼時候,Linux底下也會有MangaMeeya這類好用的漫畫瀏覽器啊~
--------------------------------------------------------------------------
以後要加入其他的程式只要依照:
Exec_3 = "...."
Exec_4 = "...."
再去修改Nautilus-Action其中command arguments就可以了
--------------------------------------------------------------------------
預設編碼是以UTF-8的話,應該要改成LANG="ja_JP.UTF-8"問題會少很多
已修正了\', \"的問題
Source code:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, os, urllib | |
Exec_1 = "wine c:\\\\Program\ Files/HView3p_en.exe '{0}'" | |
Exec_2 = "LANG='ja_JP.UTF-8' wine c:\\\\Program\ Files/MangaMeeya/MangaMeeya.exe '{0}'" | |
DriveMap = {"/mnt/Drive_E": "E:", | |
"/mnt/Drive_F": "F:", | |
"/mnt/Drive_H": "H:", | |
"/mnt/Drive_R": "R:", | |
"/mnt/Drive_S": "S:", | |
"/mnt/Drive_T": "T:", | |
"/dev/shm/dltemp": "X:"} | |
def main(viewer, filepath): | |
for key in DriveMap: | |
filepath = filepath.replace(key, DriveMap[key]) | |
filepath = urllib.unquote_plus(filepath).replace("/", "\\\\").replace('"', '\\"').replace("'", "\\'") | |
command = globals()["Exec_{0}".format(viewer)].format(filepath) | |
os.system(command) | |
if __name__ == "__main__": | |
main(*sys.argv[1:3]) |
參考文章:
* GNOME Nautilus 與 WINE
沒有留言:
張貼留言