vitunes-10.5 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ .DS_Store
2
+ *.swp
3
+ *~.nib
4
+ build/
5
+ *.pbxuser
6
+ *.perspective
7
+ *.perspectivev3
8
+ *.mode1v3
9
+ *.mode2v3
10
+ xcuserdata
11
+ src/
12
+ pkg/
13
+ other/
14
+ dev/
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2011 Daniel Choi, http://danielchoi.com/software/
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/NOTES ADDED
@@ -0,0 +1,246 @@
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
+
217
+
218
+ ------------------------------------------------------------------------
219
+ Fri Jul 1 17:03:25 EDT 2011
220
+
221
+ found out about this project
222
+ http://freshmeat.net/projects/vitunes
223
+ - last change jan 2011
224
+
225
+ Also
226
+ http://www.vim.org/scripts/script.php?script_id=523
227
+
228
+ An old applescript
229
+ http://www-personal.umich.edu/~apape/Post/itunescli/itunes
230
+
231
+
232
+ Sat Jul 2 16:26:56 EDT 2011
233
+
234
+ TODO: you can't add tracks to some playlists ; give user some indication
235
+
236
+
237
+
238
+ ------------------------------------------------------------------------
239
+ Tue Jul 5 13:03:42 EDT 2011
240
+
241
+
242
+ Coverage
243
+
244
+ http://osxdaily.com/2011/07/05/command-line-tunes-player-vitunes/
245
+ http://www.macworld.com/article/160936/2011/07/vitunes.html
246
+
data/README.markdown ADDED
@@ -0,0 +1,195 @@
1
+ # ViTunes
2
+
3
+ ViTunes lets you control and navigate iTunes from the comfort of Vim.
4
+
5
+ [screenshots]
6
+
7
+ Benefits:
8
+
9
+ * Control iTunes without leaving Vim, where one is probably in a state of productive bliss
10
+ * Avoid using the mouse or trackpad; keystrokes get you there faster
11
+ * Zen-minimalist textual UI works better on small screens than iTunes' bulky, multi-paned GUI
12
+ * Control iTunes from another computer over ssh, across the room or across the world
13
+ * Let multiple people control one instance of iTunes over ssh ([how][multi])
14
+ * Control iTunes from a GNU/Linux client computer over ssh
15
+
16
+ [multi]:https://github.com/danchoi/vitunes/wiki
17
+
18
+ ViTunes is pronounced vee-eye-tunes.
19
+
20
+ If you're looking for `vitunes` for MPlayer by Ryan Flannery, click [here](http://freshmeat.net/projects/vitunes).
21
+
22
+ ## Prerequisites
23
+
24
+ * Ruby 1.8.6 or higher (developed on Ruby 1.9.2)
25
+ * OS X (tested on Snow Leopard 10.6)
26
+ * Vim 7.2 or higher (tested on Vim 7.3)
27
+
28
+ ## Install
29
+
30
+ gem install vitunes && vitunes-install
31
+
32
+ `vitunes-install` installs a Vim plugin into your ~/.vim/plugin directory. If
33
+ you don't want to install the Vim plugin and just want to run `vitunes` as a
34
+ stand-alone program, just run `gem install vitunes` and skip `vitunes-install`.
35
+
36
+ If you get an error message saying that vitunes-install is missing, then you
37
+ probably have a `PATH` issue. Try one of these workarounds:
38
+
39
+ * Put the directory where Rubygems installs executables on your `PATH`
40
+ * Try installing with `sudo gem install vitunes && vitunes-install`
41
+
42
+ To upgrade ViTunes to a newer version, just repeat the installation procedure.
43
+
44
+ ## How to use it
45
+
46
+ For all the commands below, the mapleader is just assumed to be a `,`. If your
47
+ mapleader is `\` or something else, use that instead.
48
+
49
+
50
+ ### Starting ViTunes
51
+
52
+ You can run ViTunes in two ways:
53
+
54
+ * within Vim with `,i` or `,I`
55
+ * from the command line with the `vitunes` command
56
+
57
+ ### General commands
58
+
59
+ * `,i` invoke or dismiss ViTunes
60
+ * `,I` invoke ViTunes and go full screen with it
61
+ * `,?` show help and commands
62
+
63
+ `,I` is useful if you want to launch immediately into ViTunes after starting Vim.
64
+
65
+ ### Navigation
66
+
67
+ * `,s` search iTunes library by search query
68
+ * `,p` select playlist
69
+ * `,a` select artist
70
+ * `,g` select genre
71
+ * `,A` select album
72
+ * `ENTER` start playing a track under cursor
73
+
74
+ Playlist, artist, genre, and album navigation (but not search) use make use of
75
+ Vim autocompletion. Start typing the first few letters of what you want. For
76
+ example, if you want to jump to all artists that start with the letter 'P',
77
+ type 'P' and you'll see the drop-down items update. This autocompletion is
78
+ case-sensitive.
79
+
80
+ `CTRL-p` and `CTRL-n` let you navigate the drop-down matches. Press `ENTER` to select
81
+ one.
82
+
83
+ More advanced autocompletion tips:
84
+
85
+ * `CTRL-e` closes the match list and lets you continue typing
86
+ * `CTRL-u`: when the match list is active, cycles forward through the match
87
+ list and what you've typed so far; when the match list is inactive, erases
88
+ what you've typed.
89
+ * both `TAB` and `CTRL-x CTRL-u` reactivates autocompletion if it's gone away
90
+ * `CTRL-y` selects the highlighted match without triggering ENTER
91
+
92
+ To exit the autocompletion or search query mode, press `ENTER` when the query
93
+ line is blank, or try `ESC` then `q`.
94
+
95
+ ### Volume Control
96
+
97
+ * `+` louder
98
+ * `-` softer
99
+ * `=` louder
100
+
101
+ ### Playhead
102
+
103
+ * `SPACEBAR` play/pause
104
+ * `>` next track in ViTunesBuffer
105
+ * `<` previous track in ViTunesBuffer
106
+ * `>>` next track in iTunes current playlist
107
+ * `<<` previous track in iTunes current playlist
108
+ * `.` show current track and playlist, if any
109
+
110
+ One thing to note: if you start playing a track that you've gotten to by going
111
+ through the playlist dropdown, iTunes will play in continuous mode, where the
112
+ next track in the playlist will automatically start playing after the current
113
+ one ends.
114
+
115
+ But if you start playing a track you found some other way (e.g. via search
116
+ query), iTunes will stop playing after that track ends.
117
+
118
+ If you want to use ViTunes to find and queue a bunch of tracks and have them play
119
+ in automatic succession, use the next feature...
120
+
121
+ ### Copying and deleting tracks
122
+
123
+ * `,c` copy track(s) to a playlist
124
+ * `BACKSPACE` deletes track(s) from the playlist
125
+
126
+ To copy tracks, put the cursor on a track or select a range of tracks,
127
+ and then hit `,c` to select a playlist to copy them to. The tracks will be
128
+ added to the end of the playlist.
129
+
130
+ If this target playlist is already playing, you can keep queuing tracks to it
131
+ and let the mix play out automatically.
132
+
133
+ To delete tracks from a playlist, put the cursor on a track or select a range
134
+ of tracks, and then hit `BACKSPACE` (the Apple delete key) to remove them from
135
+ the playlist that you are looking at.
136
+
137
+ ### Managing playlists
138
+
139
+ * `,P` goes to the current playlist, if there is one
140
+ * `:NewPlaylist [new playlist name]` creates a new playlist
141
+
142
+ ### Tips
143
+
144
+ If you want to see your entire library in a Vim buffer, load the `Library`
145
+ playlist. It may take a few seconds to load your entire iTunes library. But
146
+ once it's loaded you'll be able to page through it at blazing speed and play
147
+ any tracks you want. The list will be sorted by artist.
148
+
149
+ If you have cheap Linux netbooks, they make good ViTunes controllers. I
150
+ control the iTunes on my Mac Mini from two Linux Asus 1015PEM netbooks that I
151
+ move around the apartment.
152
+
153
+ ### History and future
154
+
155
+ I've been interested in designing alternative user interfaces to iTunes since
156
+ 2008, when I was working out of the creative hacker cooperative [Betahouse](http://betahouse.org/).
157
+
158
+ * My first experiment was [itunes-rails](http://code.google.com/p/itunes-rails/).
159
+ * My second experiment was [itunes-command](http://danielchoi.com/software/itunes-command.html).
160
+ * ViTunes is the third experiment.
161
+
162
+ If you run a coffeeshop or coworking space where you'd like to let people use a
163
+ common iTunes library like a jukebox, **please let me know**, because I'm
164
+ interested in making something convenient for this kind of environment. This
165
+ will probably require interaction via mobile devices.
166
+
167
+ ### Buy more music, support the ViTunes project
168
+
169
+ * `,z` opens Amazon's MP3 Store in your web browser
170
+
171
+ At no additional cost to you, Amazon will give the ViTunes developer a small
172
+ referral bonus (around 6%) when you buy MP3s via `,z`. Thank you for your support!
173
+
174
+
175
+ ## Bug reports and feature requests
176
+
177
+ Please submit these at either of these places:
178
+
179
+ * <https://github.com/danchoi/vitunes/issues>
180
+ * <http://groups.google.com/group/vitunes-users>
181
+
182
+ ## About the developer
183
+
184
+ My name is Daniel Choi. I specialize in Ruby, Rails, MySQL, PostgreSQL, and iOS
185
+ development. I am based in Cambridge, Massachusetts, USA, and the little
186
+ software company I run with Hoony Youn is called [Kaja Software](http://kajasoftware.com).
187
+
188
+ * Company Email: info@kajasoftware.com
189
+ * Twitter: [@danchoi][twitter]
190
+ * Personal Email: dhchoi@gmail.com
191
+ * My Homepage: <http://danielchoi.com/software>
192
+
193
+ [twitter]:http://twitter.com/#!/danchoi
194
+
195
+
data/Rakefile ADDED
@@ -0,0 +1,70 @@
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
+ `cp coverage.markdown ../project-webpages/src/vitunes.coverage.markdown`
42
+ Dir.chdir "../project-webpages" do
43
+ puts `ruby gen.rb vitunes #{ViTunes::VERSION}`
44
+ `open out/vitunes.html`
45
+ end
46
+ end
47
+
48
+
49
+ desc "git push and rake release bumped version"
50
+ task :bumped do
51
+ puts `git push && rake release`
52
+ Rake::Task["web"].execute
53
+ end
54
+
55
+ desc "Run tests"
56
+ task :test do
57
+ $:.unshift File.expand_path("test")
58
+ require 'test_helper'
59
+ Dir.chdir("test") do
60
+ Dir['*_test.rb'].each do |x|
61
+ puts "requiring #{x}"
62
+ require x
63
+ end
64
+ end
65
+
66
+ MiniTest::Unit.autorun
67
+ end
68
+
69
+ task :default => :test
70
+
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ TODO
2
+ - for true ssh integration, allow user to specify vitunes command as a
3
+ ssh user@host '/path/to/vitunes-objc'
4
+
data/bin/vitunes ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require 'vitunes'
4
+ rescue LoadError
5
+ require 'rubygems'
6
+ require 'vitunes'
7
+ end
8
+
9
+ vimscript_file = File.join(File.dirname(__FILE__), '..', 'lib', 'vitunes.vim')
10
+ exec("vim -S #{vimscript_file} -c ':call ViTunes()' -c ':only'")
data/bin/vitunes-help ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'vitunes'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'vitunes'
8
+ end
9
+
10
+
11
+ puts ViTunes.help
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ require 'vitunes'
4
+ rescue LoadError
5
+ require 'rubygems'
6
+ require 'vitunes'
7
+ end
8
+
9
+ ViTunes.install_vim_plugin
data/coverage.markdown ADDED
@@ -0,0 +1,5 @@
1
+ * [Hacker News](http://news.ycombinator.com/item?id=2836883)
2
+ * [Macworld](http://www.macworld.com/article/160936/2011/07/vitunes.html)
3
+ * [OSXDaily](http://osxdaily.com/2011/07/05/command-line-tunes-player-vitunes/)
4
+ * [One Thing Well](http://onethingwell.org/post/7341797630/vitunes)
5
+ * [tweets](http://twitter.com/#!/search/vitunes)