Skip to content

Instantly share code, notes, and snippets.

@katsuma
Created November 20, 2011 18:44
Show Gist options
  • Save katsuma/1380680 to your computer and use it in GitHub Desktop.
Save katsuma/1380680 to your computer and use it in GitHub Desktop.
rb-appscript testing
require 'appscript'
include Appscript
its = app "iTunes.app"
# プレイリストの作成
# playlist = its.make(:new => :user_playlist, :with_properties => {:name => "test"})
# ファイルの追加(プレイリスト指定して追加)
#org_track = its.add(MacTypes::FileURL.path(File.expand_path("/path/to/foo.wav")), :to => playlist)
# ファイルの追加(ライブラリに追加)
org_track = its.add(MacTypes::FileURL.path(File.expand_path("/path/to/foo.wav")))
# デフォルトの設定でwavをencode. 配列で返ってくるので注意
current_track = org_track.convert.first
# 各項目の設定
current_track.name.set "タイトル"
current_track.album.set "アルバム名"
curret_track.artist.set "アーティスト名"
# 元のwavを削除
org_track.delete
# ダミープレイリストを削除
playlist.delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment