@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

= iCloud Tabsをさぶろー(デジタルペーパー DPT-S1)で見るための挑戦

[2014-08-24 16:17:00]

まず,Chrome拡張でiCloud Tabsを見れる事がわかった
・ThunderCloud (iCloud tabs) - Chrome Web Store
https://chrome.google.com/webstore/detail/thundercloud-icloud-tabs/kdjbkjcmgedoelefbopcifaffcdbehlc
作者のページからGitHubに公開されている事を確認
・jeffrey52/thundercloud
https://github.com/jeffrey52/thundercloud

ここのReadmeから,MaciCloudタブを同期した結果がplistファイルに書き出されている事を確認.

~/Library/SyncedPreferences/com.apple.Safari.plist

Xcodeで内容を確認してみると各デバイスごとにタブ情報が記録されている模様

コマンドラインでこれをJSONに変換しようと思ったけど,バイナリが変換できないと怒られた.

% plutil -convert json -o ~/iCloudTabs.json ~/Library/SyncedPreferences/com.apple.Safari.plist
/Users/peccu/Library/SyncedPreferences/com.apple.Safari.plist: invalid object in plist for destination format

なのでXMLにして,パースする事にする
% plutil -convert xml1 -o ~/iCloudTabs.xml ~/Library/SyncedPreferences/com.apple.Safari.plist

でもこれ結局Macで動かすならObjective-Cでplistのままいじる方が断然楽だよな...とか考えているところ.

一応,XMLをパースして,awkでなんとなくできそうな気がするところまでは想像したんだけども.

・ShellScript - jq、xmllintコマンドさようなら。俺はパイプが好きだから - Qiita
http://qiita.com/richmikan@github/items/e051b5d882c3dd2a39c6

CSV & JSON & XML file scraping tools
https://gist.github.com/richmikan/3251311/#file-parsrx-sh

あ,それかPythonでplistのライブラリがある模様.これもそのままいけるね
・13.6. plistlib — Generate and parse Mac OS X .plist files — Python v2.7.8 documentation
https://docs.python.org/2/library/plistlib.html