Google 公告於 2014/11/17 停止支援 Calendar API v2,請使用 API v3。
As announced by Google, Google Calendar API v2 is a subject to the Deprecation Policy and was shut down on November 17, 2014. Please use APIv3 instead.
所以便試著將 GCALDaemon 提升至 API v3。
So I try to upgrade Google Calendar API to v3 for GCALDaemon.
我只有針對 Google Calendar 和 Rainlendar 同步處理的部分,修改了兩個功能:
1. config-editor 中的檔案同步設定。
2. sync-now (手動同步)
I only modified two function for synchronizing calendar events between Google Calendar & Rainlendar.
1. config-editor for File synchronizer.
2. sync-now (manually sync)
修改後的程式可以在 github 取得。
The modified source can be download from
github.
在 API v3 中,有兩項比較顯著的變更:
1. 授權方式:必須使用 OAuth 2.0,而不支援其他的授權方式。
2. Google 日曆的 private URL:無法透過 API 取得 private URL 了。
For API v3, there are two significant changes:
1. authorize method: Application must use OAuth 2.0 to authorize requests. No other authorization protocols are supported.
2. calendar private URL: We can't fetch calendar private URL from API anymore.
所以在開始使用新版 GCALDaemon 前,需要進行以下步驟。
So we have to follow steps below to use new GCALDaemon.
1. 從
My Google Drive 下載 GCALDaemon 並解壓縮。
1. Download GCALDaemon from
My Google Drive and unzip.
2. 啟用 Google Calendar API。
2. Enable Google Calendar API.
(1) 開啟 Google Develop Console 並新增專案。
(1)
Go to Google Develop Console and create a project.
(2) 啟用 Calendar API。
(2)
Enable Calendar API.
(3) 新增 Client ID。
(3)
Create Client ID.
(4) 下載 JSON,並更名為
client_secrets.json。
(4)
Download JSON and rename to client_secrets.json.
(5) 將
client_secrets.json 放到 GCALDaemon/etc 目錄中。
(5) Put client_secrets.json into GCALDaemon/etc folder.
3. 執行 bin/config-editor-new.bat (或 bin/config-editor-new.sh),點選 "File synchronizer"。直接點選 "+New" 新增欲同步的日曆,不需要做 Account 的新增。
3. Execute bin/config-editor-new.bat (or bin/config-editor-new.sh) and click "File synchronizer", Just click "+New" to add Calendar you want to sync. Don't need to add Google Accounts.
4. 點選 "Refresh" 取得 Google Calendar 清單,此時會開啟瀏覽器,並要求授予管理日曆的權限。同意後,便可在下拉選單中看到你的日曆清單。
4. Click "Refresh" to fetch Google Calendar list from your default logged-in Google Account. There will show authorizing page in browser and you should click accept. Then you can get calendar list into combo box.
5. 選擇要同步的日曆,並指定對應的 iCal 檔案路徑。
5. Select the Calendar you want to sync and specify the iCal file location. Click OK.
6. 取得並複製該日曆的 ICAL 私人網址,只要保留 /calendar/ical/xxxxxxx/private-yyyyyyyy/basic.ics 的部分。
6. Open browser to get Google Calendar private URL. Copy the private address of ICAL and only keep the URL like /calendar/ical/xxxxxxx/private-yyyyyyyy/basic.ics
7. 回到 Config Editor 並修改步驟 5 新增的日曆,修改 Google Calendar 欄位,輸入步驟 6 取得的 URL。
7. Back to Config Editor and edit the calendar created on step 5. Change the Google Calender field to /calendar/ical/xxxxxxx/private-yyyyyyyy/basic.ics from step 6.
8. 儲存並離開 Config Edit。
8. Save and Exit config-editor.
9. 執行 bin/sync-now-new.bat (或 bin/sync-now-new.sh ) 進行同步。
9. Now you can execute bin/sync-now-new.bat (or bin/sync-now-new.sh ) to synchronize Google Calendar and the iCal file for Rainlendar.