Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

前提
	奠基於 iMax.Live 韌體 20110401

功能
	Input methods for HiMedia HD300A/B (and possibly other models)
	讓海美迪 HD300A/B (或其他可能機種) 可以使用注音、速成、或使用者自訂輸入法來輸入正簡體字
	自訂的輸入法資料可置於本機或其他網路上可以存取到的位置 (例如: Dropbox)

取得
	由
		https://github.com/ypchen/hdp_input
	下載,或使用 git clone 取得
		git clone git://github.com/ypchen/hdp_input.git

說明
	使用者可以自訂輸入法,可參考目前現有之英文、注音、與速成輸入法之資料與格式.
	若要自訂輸入法,可在 ypInput/ 下創建一個目錄或是放在網路上可以存取的地方
	(例如: Dropbox),而該目錄中至少有以下檔案 (都要用 U8-UNIX 文字檔格式):
	1. 0-keys.txt
		這個檔案定義了螢幕上 48 方塊所顯示的字元/字母
	2. 1-info.txt
		這個檔案定義了輸入法的行為,每行的意義如下:
		Line 1: 除此行外之有效資料行數
		Line 2: 輸入法名稱
		Line 3: 輸入法模式
		Line 4: 是否需要進行選字?(英文輸入就不必)
		Line 5: 是否有字碼上限 (速成就是最多兩碼),若 Line 4 為 0 則此項無意義
		Line 6: 輸入法切換用的螢幕按鍵 (要配合 0-keys.txt 中定義的某個按鍵)
		Line 7: 以目前所輸入的字碼進行選字的螢幕按鍵 (要配合 0-keys.txt 中定義的某個按鍵)
		Line 8 之後: 結束輸入之字碼 (和 Line 7 不同,這些按鍵本身也是在字碼之內,可參考注音輸入)
	3. i=*字碼*.txt (有選字的輸入法就需要這些檔案)
		檔名由字碼構成,檔案內容則為該字碼對應的字
		Line 1: 共多少字
		Line 2 之後: 對應的字
	然後再將 keyboard.rss 和 password.rss 中的某一個輸入法,換成自己的目錄即可,例如把
			imPrefix  = pushBackStringArray(imPrefix, "3-PhoneticCHS");
	改成
			imPrefix  = pushBackStringArray(imPrefix, "MyOwnInputMethod");

使用
	1. 直接放在本機使用
		將 ypInput 放在 /usr/local/bin/etc 下
		(也就是 /usr/local/bin/etc/ypInput)
		即可在 menu.rss 或其他地方使用

		正常輸入
			input = doModalRss("rss_file://./etc/ypInput/keyboard.rss", "mediaDisplay", "search", 0);

		密碼輸入 (以 "*" 回應)
			input = doModalRss("rss_file://./etc/ypInput/password.rss", "mediaDisplay", "search", 0);

		來取得使用者輸入的字串 (input)

	2. 建立自己的輸入功能網站 (透過網路比較慢些)
		將 ypInput 裡的 *.php, *.txt, *.rss, 和四個資料目錄放在您所選定的網站目錄下
		(可以不必多一層 "ypInput" 這個目錄) 即可在 menu.rss 或其他地方使用

		正常輸入
			input = doModalRss("http://your.site/your.dir/getFile.php?file=keyboard.rss", "mediaDisplay", "search", 0);

		密碼輸入 (以 "*" 回應)
			input = doModalRss("http://your.site/your.dir/getFile.php?file=password.rss", "mediaDisplay", "search", 0);

		來取得使用者輸入的字串 (input).
		※ 目前已經改成不必去變動 .rss 的內容即可直接放到線上使用 ※

	3. 我直接把這組 code 建立成一個輸入功能網站,有興趣的人可以直接用用看 (透過網路比較慢些)
		這個網站架設在免費的 web hosting 服務上,所以原則上我不會關掉它,
		但是免費的服務連不上的機率也會較高,這點我就無法保證大家能用得順利

		位址在
			http://ims.hostoi.com/ypInput/getFile.php?file=keyboard.rsshttp://ims.hostoi.com/ypInput/getFile.php?file=password.rss

		※ 原先的 input.zzl.org 被站方認為是違反服務條款而被 ban 掉了 ※

	4. 使用者自訂的輸入法資料放在本機或 Dropbox,配合我所提供的輸入功能網站
		首先,為了簡單起見,這一版開始固定成 4 個輸入法,使用者可以在使用輸入功能網站的 URL 裡,
		放進適當的參數,即可用自己自訂的輸入法來進行輸入,以下分別說明輸入法資料放在本機上和
		Dropbox 上的情形. 在此假設我們要把第三個輸入法設成自己本機上的,而第四個是放在
		Dropbox 的 public 目錄裡.
		(0) 自訂輸入法的參數是 p1, p2, p3, p4 四個,分別對應到四個輸入法. 參數格式是
				pN=isOnline,topPrefix,imPrefix
			isOnline 表示資料檔案在本機中 (0) 或在網路上 (1)
			topPrefix 是資料檔案最上層的前置字串
			imPrefix 是這個輸入法資料的目錄
		(1) 把 p3 設定成自己本機上的 /usr/local/bin/etc/ypInput 下的 4-PhoeneticCHT (注音正體)
				p3=0,./etc/ypInput/,4-PhoneticCHT
		(2) 把 p4 設定成 Dropbox 的 public 目錄裡的資料 (這個有點複雜)
			a. 假設是 Dropbox 的這個公開目錄
					http://dl.dropbox.com/u/35344989/hdp_input/ypInput/
				然後我們要用
					6-CJFastCHT
			b. 因為要透過輸入功能網站來存取,所以先做一個 URL 當 topPrefix
					http://ims.hostoi.com/ypInput/getFile.php?file=http://dl.dropbox.com/u/35344989/hdp_input/ypInput/
			c. 告訴 getFile.php 說這個輸入法的檔案資料不在 ims.hostoi.com 的 local,加上 remote=1
					http://ims.hostoi.com/ypInput/getFile.php?remote=1&file=http://dl.dropbox.com/u/35344989/hdp_input/ypInput/
			d. 因為播放機存取 URL 的特性,所以要把 "&" 改成 "&"
					http://ims.hostoi.com/ypInput/getFile.php?remote=1&file=http://dl.dropbox.com/u/35344989/hdp_input/ypInput/
			e. 然後因為要放進另一個 URL 中,所以進行一次 URLEncode 變成
					http%3A%2F%2Fims.hostoi.com%2FypInput%2FgetFile.php%3Fremote%3D1%26amp%3Bfile%3Dhttp%3A%2F%2Fdl.dropbox.com%2Fu%2F35344989%2Fhdp_input%2FypInput%2F
			f. 再組出 p4 參數
					p4=1,http%3A%2F%2Fims.hostoi.com%2FypInput%2FgetFile.php%3Fremote%3D1%26amp%3Bfile%3Dhttp%3A%2F%2Fdl.dropbox.com%2Fu%2F35344989%2Fhdp_input%2FypInput%2F,6-CJFastCHT
		(3) 組出整個 URL
				http://ims.hostoi.com/ypInput/getFile.php?file=keyboard.rss&p3=0,./etc/ypInput/,4-PhoneticCHT&p4=1,http%3A%2F%2Fims.hostoi.com%2FypInput%2FgetFile.php%3Fremote%3D1%26amp%3Bfile%3Dhttp%3A%2F%2Fdl.dropbox.com%2Fu%2F35344989%2Fhdp_input%2FypInput%2F,6-CJFastCHT
		(4) 和步驟 (2)d 一樣,要把 "&" 改成 "&" (有兩個 "&")
				http://ims.hostoi.com/ypInput/getFile.php?file=keyboard.rss&p3=0,./etc/ypInput/,4-PhoneticCHT&p4=1,http%3A%2F%2Fims.hostoi.com%2FypInput%2FgetFile.php%3Fremote%3D1%26amp%3Bfile%3Dhttp%3A%2F%2Fdl.dropbox.com%2Fu%2F35344989%2Fhdp_input%2FypInput%2F,6-CJFastCHT
		(5) 這個 URL 就可以拿來放在 menu.rss 裡面用了:
				input = doModalRss("http://ims.hostoi.com/ypInput/getFile.php?file=keyboard.rss&p3=0,./etc/ypInput/,4-PhoneticCHT&p4=1,http%3A%2F%2Fims.hostoi.com%2FypInput%2FgetFile.php%3Fremote%3D1%26amp%3Bfile%3Dhttp%3A%2F%2Fdl.dropbox.com%2Fu%2F35344989%2Fhdp_input%2FypInput%2F,6-CJFastCHT", "mediaDisplay", "search", 0);
			這樣一來,播放機就會從 ims.hostoi.com 網站上取得 keyboard.rss 然後
				p1 是 ims.hostoi.com 上的 1-EnglishLower
				p2 是 ims.hostoi.com 上的 2-EnglishUpper
				p3 是本機的 /usr/local/bin/etc/ypInput 裡的 4-PhoneticCHT
				p4 是在 Dropbox user 35344989 的公開目錄 hdp_input/ypInput 裡的 6-CJFastCHT
		(6) 以上是比較完整的使用方式,之所以要透過 getFile.php 來存取網路上資料的原因,主要是為了判斷
			"無此字" 這件事. 因為 getFile.php 會注意 "404" (Not Found) 然後傳回 keyboard.rss 可以判斷
			"無此字" 的內容. 而 keyboard.rss 判斷 "無此字" 的方式,是看傳回來內容第的一行是否為空字串.
			以這點而言,Dropbox 剛好符合這個特性,所以如果用的就是 Dropbox 的話,topPrefix 可以簡單地
			設定成
				http://dl.dropbox.com/u/35344989/hdp_input/ypInput/
			經過 URLEncode 後的
				http%3A%2F%2Fdl.dropbox.com%2Fu%2F35344989%2Fhdp_input%2FypInput%2F
			就可以了,並不需通過 getFile.php 的處理.

範例
	1. 在原本的 searchVideo.rss 中,將 PPS 搜尋項目中,取得使用者字串輸入部分,
	由
		input = getInput("輸入關鍵字詞");
	改成
		input = doModalRss("rss_file://./etc/ypInput/keyboard.rss", "mediaDisplay", "search", 0);
	就能夠利用本模組以注音或速成輸入簡體字的功能,在 PPS 上進行視訊搜尋
	2. 使用以下的項目,即可利用 HDPfans 或 HAOIMS 的搜尋功能來搜尋 PPTV、優酷等多處網站:
		<item>
			<title>HDPfans: 全網搜索</title>
			<onClick>
				/* input = getInput("Enter a keyword"); */
				input = doModalRss("rss_file://./etc/ypInput/keyboard.rss", "mediaDisplay", "search", 0);
				if (input != null) {
					keyword = urlEncode(input);
					searchUrl = "http://tv.hdpfans.com:80/sp_search.php?name=" + keyword;
					sPath = "/usr/local/etc/dvdplayer/";
					searchPath=sPath+"hdpfans_search.dat";
					searchArray=readStringFromFile(searchPath);
					if (getStringArrayAt(searchArray, 19) != null) {
						searchArray = deleteStringArrayAt(searchArray, 0);
					}
					k=0;
					while (getStringArrayAt(searchArray, k) != null) {
						title=getStringArrayAt(searchArray, k);
						if(title == input){
							searchArray = deleteStringArrayAt(searchArray, k);
						}
						else{
							k=k+1;
						}
					}
					searchArray=pushBackStringArray(searchArray, input);
					writeStringToFile(searchPath,searchArray);
					searchUrl;
				}
				else {
					redrawDisplay();
				}
			</onClick>
			<mediaDisplay />
		</item>
		<item>
			<title>HAOIMS: 我要搜索</title>
			<onClick>
				/* input = getInput("Enter a keyword"); */
				input = doModalRss("rss_file://./etc/ypInput/keyboard.rss", "mediaDisplay", "search", 0);
				if (input != null) {
				    keyword = urlEncode(input);
				    searchUrl = "http://ims.haoims.com/ims/search.php?q=chl-search-word-" + keyword;
					sPath = "/usr/local/etc/dvdplayer/";
					searchPath=sPath+"haoims_search.dat";
					searchArray=readStringFromFile(searchPath);
					if (getStringArrayAt(searchArray, 19) != null) {
						searchArray = deleteStringArrayAt(searchArray, 0);
					}
					k=0;
					while (getStringArrayAt(searchArray, k) != null) {
						title=getStringArrayAt(searchArray, k);
						if(title==input) {
							searchArray = deleteStringArrayAt(searchArray, k);
						}
						else {
							k=k+1;
						}
					}
					searchArray=pushBackStringArray(searchArray, input);
					writeStringToFile(searchPath,searchArray);
					searchUrl;
				}
				else {
				    redrawDisplay();
				}
			</onClick>
			<mediaDisplay />
		</item>

備註
	1. keyboard.rss password.rss 是由 media translate 的 keyboard.rss password.rss 修改而來
	2. 注音表資料來自於 http://sourceforge.net/projects/cce2k/
	3. Unicode 正體轉簡體程式來自於 http://www.php5.idv.tw/sample/dbcconv.zip
	4. 倉頡碼資料來自於 http://www.chinesecj.com/newsoftware/index2.php?Type=code

About

Input methods for HiMedia HD300A/B (and possibly other models) 讓海美迪 HD300A/B (或其他可能機種) 可以使用注音和速成來輸入正體字與簡體字

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages