vitunes 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/NOTES +216 -0
- data/README.markdown +65 -0
- data/Rakefile +69 -0
- data/bin/vitunes +9 -0
- data/bin/vitunes-help +11 -0
- data/bin/vitunes-install +9 -0
- data/iTunes.h +507 -0
- data/lib/plugin.erb +10 -0
- data/lib/vitunes/version.rb +3 -0
- data/lib/vitunes-tool-objc +0 -0
- data/lib/vitunes.rb +29 -0
- data/lib/vitunes.vim +344 -0
- data/vitunes/main.m +277 -0
- data/vitunes/vitunes-Prefix.pch +7 -0
- data/vitunes/vitunes.1 +79 -0
- data/vitunes.gemspec +26 -0
- data/vitunes.xcodeproj/project.pbxproj +233 -0
- data/vitunes.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- metadata +87 -0
data/.gitignore
ADDED
data/NOTES
ADDED
@@ -0,0 +1,216 @@
|
|
1
|
+
|
2
|
+
should put a max results limit
|
3
|
+
|
4
|
+
|
5
|
+
we need to keep the tracks recently foudn in the search list in memory?
|
6
|
+
|
7
|
+
Then that means keeping the process alive in memory. But we can also
|
8
|
+
just run the search again and find the track by index.
|
9
|
+
|
10
|
+
Tried Macruby but it is too hard to get either multithreaded DRb or
|
11
|
+
sinatra working
|
12
|
+
|
13
|
+
Vimscript can remember the last command send to system() and just append
|
14
|
+
an index number to it
|
15
|
+
|
16
|
+
Store lists like in Vmail
|
17
|
+
Put databaseID off screen and use it to look up anything
|
18
|
+
|
19
|
+
|
20
|
+
https://bitbucket.org/kamitchell/itunesbridged
|
21
|
+
|
22
|
+
https://github.com/mislav/itunes/blame/master/itunes.rb
|
23
|
+
|
24
|
+
https://github.com/mislav/itunes
|
25
|
+
|
26
|
+
ITunesManager.app.run
|
27
|
+
|
28
|
+
# start playing at the beginning
|
29
|
+
ITunesManager.music.playOnce(false)
|
30
|
+
|
31
|
+
ITunesManager.player_state #=> :playing
|
32
|
+
|
33
|
+
ITunesManager.app.playpause
|
34
|
+
ITunesManager.player_state #=> :paused
|
35
|
+
|
36
|
+
track = ITunesManager.current_track
|
37
|
+
|
38
|
+
# for more properties, see iTunes.h under "@interface iTunesTrack"
|
39
|
+
track.name
|
40
|
+
track.artist
|
41
|
+
track.album
|
42
|
+
|
43
|
+
# playlist management
|
44
|
+
favorites = ITunesManager.find_or_create_playlist 'Favorites'
|
45
|
+
|
46
|
+
track = ITunesManager.music.fileTracks.first
|
47
|
+
favorites << track
|
48
|
+
|
49
|
+
favorites.add ITunesManager.music.search('daft punk')
|
50
|
+
favorites.add ITunesManager.music.search('pendulum', :artists)
|
51
|
+
favorites.add ITunesManager.music.search('easy rider', :albums)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
[choi spartan~/p/vitunes]$ /Users/choi/projects/vitunes/build/Release/vitunes search rush
|
56
|
+
2011-06-30 02:08:59.516 vitunes[68007:903] args: (
|
57
|
+
"/Users/choi/projects/vitunes/build/Release/vitunes",
|
58
|
+
search,
|
59
|
+
rush
|
60
|
+
)
|
61
|
+
1746 P56/Brushstroking Fingerstyle Blues Guitar Arnie Berle and Mark Galbo (1993) Religious
|
62
|
+
1400 Cold Fire Counterparts Rush (2004) Rock
|
63
|
+
1402 Mystic Rhythms Retrospective, Vol. 2 (1981-1987) Rush (1997) Rock
|
64
|
+
1404 The Big Money Rush: Spirit of Radio - Greatest Hits 1974-1987 Rush (2003) Rock
|
65
|
+
[choi spartan~/p/vitunes]$ /Users/choi/projects/vitunes/build/Release/vitunes playTrackID 1404
|
66
|
+
2011-06-30 02:09:09.536 vitunes[68010:903] args: (
|
67
|
+
"/Users/choi/projects/vitunes/build/Release/vitunes",
|
68
|
+
playTrackID,
|
69
|
+
1404
|
70
|
+
)
|
71
|
+
2011-06-30 02:09:09.646 vitunes[68010:903] playing track: The Big Money
|
72
|
+
[choi spartan~/p/vitunes]$ fg
|
73
|
+
vim vitunes.rb
|
74
|
+
|
75
|
+
[1]+ Stopped vim vitunes.rb
|
76
|
+
|
77
|
+
|
78
|
+
------------------------------------------------------------------------
|
79
|
+
getting all artists in applescript
|
80
|
+
|
81
|
+
tell application "iTunes"
|
82
|
+
set myList to get artist of (every track of library playlist 1 whose
|
83
|
+
artist is not missing value)
|
84
|
+
end tell
|
85
|
+
set oldDelim to AppleScript's text item delimiters
|
86
|
+
set AppleScript's text item delimiters to ASCII character 10
|
87
|
+
set allArtists to myList as text
|
88
|
+
set AppleScript's text item delimiters to oldDelim
|
89
|
+
do shell script "echo " & (quoted form of allArtists) & " | sort -u "
|
90
|
+
|
91
|
+
|
92
|
+
** BUILD SUCCEEDED **
|
93
|
+
|
94
|
+
[choi spartan~/p/vitunes]$ /Users/choi/projects/vitunes/build/Release/vitunes match "artist == 'U2'"
|
95
|
+
2011-06-30 02:35:27.146 vitunes[68774:903] tracks: (
|
96
|
+
"Beautiful Day",
|
97
|
+
"Stuck In A Moment You Can't Get Out Of",
|
98
|
+
Elevation,
|
99
|
+
"Walk On",
|
100
|
+
Kite,
|
101
|
+
"In A Little While",
|
102
|
+
"Wild Honey",
|
103
|
+
"Peace On Earth",
|
104
|
+
"When I Look At The World",
|
105
|
+
"New York",
|
106
|
+
Grace,
|
107
|
+
"Pride (In The Name Of Love)",
|
108
|
+
"With Or Without You",
|
109
|
+
"Even Better Than the Real Thing",
|
110
|
+
"Mysterious Ways",
|
111
|
+
"Electrical Storm (William Orbit Mix)",
|
112
|
+
One,
|
113
|
+
"Stay (Faraway, so Close!)",
|
114
|
+
"Zoo Station",
|
115
|
+
Magnificent,
|
116
|
+
Always
|
117
|
+
)
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
Use contains instead of LIKE
|
122
|
+
|
123
|
+
tell application "iTunes"
|
124
|
+
set myList to get artist of (every track of library playlist 1 whose artist is not missing value)
|
125
|
+
end tell
|
126
|
+
set oldDelim to AppleScript's text item delimiters
|
127
|
+
set AppleScript's text item delimiters to ASCII character 10
|
128
|
+
set allArtists to myList as text
|
129
|
+
set AppleScript's text item delimiters to oldDelim
|
130
|
+
do shell script "echo " & (quoted form of allArtists) & " | sort -u "
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
------------------------------------------------------------------------
|
135
|
+
Thu Jun 30 07:44:42 EDT 2011
|
136
|
+
|
137
|
+
|
138
|
+
Don't do any playlist management (writing) for the first release. Stick
|
139
|
+
to navigation, search, playing
|
140
|
+
|
141
|
+
|
142
|
+
Let user use Mac stop key? No, what if this is via remote?
|
143
|
+
|
144
|
+
|
145
|
+
Some commands
|
146
|
+
|
147
|
+
playTrackID 1423
|
148
|
+
itunes playpause
|
149
|
+
itunes currentPlaylist => prints current playlist name
|
150
|
+
predicate "name contains 'love'"
|
151
|
+
itunes currentTrack => print current track with smae formatting for
|
152
|
+
listed tracks
|
153
|
+
|
154
|
+
playPlaylist Purchased
|
155
|
+
playlistTracks Purchased
|
156
|
+
|
157
|
+
group artist
|
158
|
+
group name
|
159
|
+
# NOT group year because year involves int, not NSString
|
160
|
+
|
161
|
+
------------------------------------------------------------------------
|
162
|
+
|
163
|
+
TODO
|
164
|
+
- maybe show iTunesPlaylist properties:
|
165
|
+
- duration (total length of playlist in secs)
|
166
|
+
- shuffle BOOL
|
167
|
+
- songRepeat (a constant)
|
168
|
+
- time <= MM:SS
|
169
|
+
|
170
|
+
Try adding a track to a playlist (LATER)
|
171
|
+
|
172
|
+
Try creating a playlist (LATER)
|
173
|
+
|
174
|
+
Rename command line tool itunes-unix since it is general
|
175
|
+
|
176
|
+
UI playOnce a track
|
177
|
+
play a playlist
|
178
|
+
forward and next (already ready to bind to vimscript)
|
179
|
+
|
180
|
+
DO IN LATER RELEASE:
|
181
|
+
create a playlist
|
182
|
+
move tracks to a playlist
|
183
|
+
|
184
|
+
Stick with search, navigation and playing functions for first release.
|
185
|
+
Release earlier this way. The simpler function set is useful enough.
|
186
|
+
|
187
|
+
TODO -- all on Vim side
|
188
|
+
|
189
|
+
artists, genre, album --> these will open Vim autocomplete dropdown
|
190
|
+
selectors
|
191
|
+
|
192
|
+
choose an item from the completion window, then we show the standard
|
193
|
+
tracks list
|
194
|
+
|
195
|
+
- tracks list will either be a playlist, a search result, or a predicate
|
196
|
+
filter (e.g. all tracks with artist == or album ==
|
197
|
+
|
198
|
+
|
199
|
+
------------------------------------------------------------------------
|
200
|
+
|
201
|
+
- select a track to play. if IN playlist, start playing continuously
|
202
|
+
|
203
|
+
TODO
|
204
|
+
- documentation - ruby command in gem
|
205
|
+
- screenshots
|
206
|
+
|
207
|
+
------------------------------------------------------------------------
|
208
|
+
LATER
|
209
|
+
|
210
|
+
- use sortTitle -- not urgent
|
211
|
+
- handle case of missing Track (not on disk); e.g. ATB
|
212
|
+
- remove from playlist
|
213
|
+
- put last seen Playlist on top of Playlist drop down
|
214
|
+
- compile vitunes tool and put in bin/
|
215
|
+
|
216
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# ViTunes
|
2
|
+
|
3
|
+
ViTunes lets you control and navigate iTunes from the comfort of Vim.
|
4
|
+
|
5
|
+
## Prerequisites
|
6
|
+
|
7
|
+
* Ruby 1.8.6 or higher (developed on Ruby 1.9.2)
|
8
|
+
* OS X (tested on Snow Leopard 10.6)
|
9
|
+
* Vim 7.2 or higher (tested on Vim 7.3)
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
gem install vitunes
|
14
|
+
|
15
|
+
vitunes-install
|
16
|
+
|
17
|
+
`vitunes-install` installs a Vim plugin into your ~/.vim/plugin
|
18
|
+
directory.
|
19
|
+
|
20
|
+
## How to use it
|
21
|
+
|
22
|
+
### General commands
|
23
|
+
|
24
|
+
* `,i` invoke or dismiss ViTunes (if not, it might be `\i` on your system)
|
25
|
+
* `?` show help and commands
|
26
|
+
|
27
|
+
### Navigation
|
28
|
+
|
29
|
+
* `,s` search iTunes library by search query
|
30
|
+
* `,p` select playlist
|
31
|
+
* `,a` select artist
|
32
|
+
* `,g` select genre
|
33
|
+
* `,A` select album
|
34
|
+
* `ENTER` start playing a track under cursor
|
35
|
+
|
36
|
+
The query and selection drop downs make Vim autocompletion. Start typing
|
37
|
+
the first few letters of what you want. For example, if you want to jump
|
38
|
+
to all artists that start with the letter 'P', type 'P' and you'll see
|
39
|
+
the drop down items update.
|
40
|
+
|
41
|
+
`CTRL-p` and `CTRL-n` let you navigate the matches. Press `ENTER` to select
|
42
|
+
one.
|
43
|
+
|
44
|
+
Press `ENTER` or `ESC` to exit drop down selection mode.
|
45
|
+
|
46
|
+
### Volume Control
|
47
|
+
|
48
|
+
* `+` louder
|
49
|
+
* `-` softer
|
50
|
+
* `=` softer
|
51
|
+
|
52
|
+
### Playhead
|
53
|
+
|
54
|
+
* `SPACEBAR` play/pause
|
55
|
+
* `>` next track
|
56
|
+
* `<` previous track
|
57
|
+
* `.` show current track and playlist, if any
|
58
|
+
|
59
|
+
### Copying tracks
|
60
|
+
|
61
|
+
* `,c` copy track(s) to a playlist
|
62
|
+
|
63
|
+
To copy tracks, put the cursor on a track or select a range of tracks,
|
64
|
+
and then hit `,c` to select a playlist to copy them to. The tracks will be
|
65
|
+
added to the end of the playlist.
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
|
7
|
+
|
8
|
+
desc "release and build and push new website"
|
9
|
+
task :push => [:release, :web]
|
10
|
+
|
11
|
+
desc "Bumps version number up one and git commits"
|
12
|
+
task :bump do
|
13
|
+
basefile = "lib/vitunes/version.rb"
|
14
|
+
file = File.read(basefile)
|
15
|
+
oldver = file[/VERSION = '(\d.\d.\d)'/, 1]
|
16
|
+
newver_i = oldver.gsub(".", '').to_i + 1
|
17
|
+
newver = ("%.3d" % newver_i).split(//).join('.')
|
18
|
+
puts oldver
|
19
|
+
puts newver
|
20
|
+
puts "Bumping version: #{oldver} => #{newver}"
|
21
|
+
newfile = file.gsub("VERSION = '#{oldver}'", "VERSION = '#{newver}'")
|
22
|
+
File.open(basefile, 'w') {|f| f.write newfile}
|
23
|
+
`git commit -am 'Bump'`
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "build and push website"
|
27
|
+
task :web => :build_webpage do
|
28
|
+
puts "Building and pushing website"
|
29
|
+
Dir.chdir "../project-webpages" do
|
30
|
+
`scp out/vitunes.html zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
|
31
|
+
`rsync -avz out/images-vitunes zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
|
32
|
+
`rsync -avz out/stylesheets zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
|
33
|
+
`rsync -avz out/lightbox2 zoe2@instantwatcher.com:~/danielchoi.com/public/software/`
|
34
|
+
end
|
35
|
+
`open http://danielchoi.com/software/vitunes.html`
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "build webpage"
|
39
|
+
task :build_webpage do
|
40
|
+
`cp README.markdown ../project-webpages/src/vitunes.README.markdown`
|
41
|
+
Dir.chdir "../project-webpages" do
|
42
|
+
puts `ruby gen.rb vitunes #{Vmail::VERSION}`
|
43
|
+
#`open out/vitunes.html`
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
desc "git push and rake release bumped version"
|
49
|
+
task :bumped do
|
50
|
+
puts `git push && rake release`
|
51
|
+
Rake::Task["web"].execute
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Run tests"
|
55
|
+
task :test do
|
56
|
+
$:.unshift File.expand_path("test")
|
57
|
+
require 'test_helper'
|
58
|
+
Dir.chdir("test") do
|
59
|
+
Dir['*_test.rb'].each do |x|
|
60
|
+
puts "requiring #{x}"
|
61
|
+
require x
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
MiniTest::Unit.autorun
|
66
|
+
end
|
67
|
+
|
68
|
+
task :default => :test
|
69
|
+
|
data/bin/vitunes
ADDED
data/bin/vitunes-help
ADDED