vitunes 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -11,3 +11,4 @@ xcuserdata
11
11
  src/
12
12
  pkg/
13
13
  other/
14
+ dev/
@@ -11,7 +11,7 @@ Benefits:
11
11
  * Zen-minimalist textual UI works better on small screens than iTunes' complicated, multi-paned GUI
12
12
  * Control iTunes from another computer over ssh, across the room or across the world
13
13
  * Let multiple people control one instance of iTunes over ssh ([how][multi])
14
- * Control iTunes from GNU/Linux computers over ssh (I control the iTunes on my Mac Mini from two Linux Asus netbooks that I move around the apartment)
14
+ * Control iTunes from a GNU/Linux client computer over ssh
15
15
 
16
16
  [multi]:https://github.com/danchoi/vitunes/wiki
17
17
 
@@ -118,9 +118,10 @@ query), iTunes will stop playing after that track ends.
118
118
  If you want to use ViTunes to find and queue a bunch of tracks and have them play
119
119
  in automatic succession, use the next feature...
120
120
 
121
- ### Copying tracks
121
+ ### Copying and deleting tracks
122
122
 
123
123
  * `,c` copy track(s) to a playlist
124
+ * `BACKSPACE` deletes track(s) from the playlist
124
125
 
125
126
  To copy tracks, put the cursor on a track or select a range of tracks,
126
127
  and then hit `,c` to select a playlist to copy them to. The tracks will be
@@ -129,6 +130,11 @@ added to the end of the playlist.
129
130
  If this target playlist is already playing, you can keep queuing tracks to it
130
131
  and let the mix play out automatically.
131
132
 
133
+ To delete tracks from the currently displayed playlist, put the cursor on a
134
+ track or select a range of tracks, and then hit `BACKSPACE` (the Apple delete
135
+ key) to remove them from the playlist that you are looking at.
136
+
137
+
132
138
  ### Managing playlists
133
139
 
134
140
  * `,P` goes to the current playlist, if there is one
@@ -137,17 +143,21 @@ and let the mix play out automatically.
137
143
  ### Tips
138
144
 
139
145
  If you want to see your entire library in a Vim buffer, load the `Library`
140
- playlist. If might take a few seconds to load your entire iTunes library, but
146
+ playlist. It may take a few seconds to load your entire iTunes library. But
141
147
  once it's loaded you'll be able to page through it at blazing speed and play
142
148
  any tracks you want. The list will be sorted by artist.
143
149
 
150
+ If you have cheap Linux netbooks, they make good ViTunes controllers. I
151
+ control the iTunes on my Mac Mini from two Linux Asus 1015PEM netbooks that I
152
+ move around the apartment.
153
+
144
154
 
145
155
  ### Buy more music, support the ViTunes project
146
156
 
147
157
  * `,z` opens Amazon's MP3 Store in your web browser
148
158
 
149
159
  At no additional cost to you, Amazon will give the ViTunes developer a small
150
- referral bonus (around 6%) when you buy MP3s via `,z`.
160
+ referral bonus (around 6%) when you buy MP3s via `,z`. Thank you for your support!
151
161
 
152
162
 
153
163
  ## Bug reports and feature requests
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ task :bump do
20
20
  puts "Bumping version: #{oldver} => #{newver}"
21
21
  newfile = file.gsub("VERSION = '#{oldver}'", "VERSION = '#{newver}'")
22
22
  File.open(basefile, 'w') {|f| f.write newfile}
23
- `git commit -am 'Bump'`
23
+ #`git commit -am 'Bump'`
24
24
  end
25
25
 
26
26
  desc "build and push website"
@@ -1,3 +1,4 @@
1
+ * [Hacker News](http://news.ycombinator.com/item?id=2836883)
1
2
  * [Macworld](http://www.macworld.com/article/160936/2011/07/vitunes.html)
2
3
  * [OSXDaily](http://osxdaily.com/2011/07/05/command-line-tunes-player-vitunes/)
3
4
  * [One Thing Well](http://onethingwell.org/post/7341797630/vitunes)
Binary file
@@ -8,7 +8,7 @@ if exists("g:vitunes_tool")
8
8
  let s:vitunes_tool = g:vitunes_tool
9
9
  else
10
10
  " This is the development version (specific to D Choi's setup)
11
- let s:vitunes_tool = '/Users/choi/projects/vitunes/build/Release/vitunes '
11
+ let s:vitunes_tool = 'dev/vitunes '
12
12
  " Maybe I should make this a relative path
13
13
  endif
14
14
  if !exists("g:mapleader")
@@ -73,6 +73,7 @@ function! ViTunes()
73
73
  noremap <buffer> <Leader>g :call <SID>openGenreDropdown()<cr>
74
74
  noremap <buffer> <Leader>A :call <SID>openAlbumDropdown()<cr>
75
75
  noremap <buffer> <Leader>c :call <SID>openAddToPlaylistDropDown()<cr>
76
+ noremap <buffer> <BS> :call <SID>deleteTracksFromPlaylist()<CR> "
76
77
  noremap <buffer> <Leader>P :call <SID>gotoCurrentPlaylist()<cr>
77
78
 
78
79
  noremap <buffer> > :call <SID>nextTrack()<cr>
@@ -87,8 +88,6 @@ function! ViTunes()
87
88
  noremap <buffer> + :call <SID>changeVolume("volumeUp")<cr>
88
89
  noremap <buffer> = :call <SID>changeVolume("volumeUp")<cr>
89
90
 
90
- " Not working yet
91
- " noremap <buffer> <BS> :call <SID>deleteTracksFromPlaylist()<CR> "
92
91
  noremap <buffer> <Leader>i :close<CR>
93
92
  noremap <buffer> <Leader>? :call <SID>help()<CR>
94
93
  noremap <buffer> <Leader>z :call <SID>musicStore()<CR>
@@ -334,20 +333,19 @@ function! s:submitQueryOrSelection(command)
334
333
  endif
335
334
  endfunction
336
335
 
337
- " TODO does not work yet
338
- function! s:deleteTracksFromPlaylist() range
339
- if (s:currentPlaylist == '')
340
- echom "You can't delete tracks unless you're in a playlist"
341
- return
342
- endif
336
+ function! s:deleteTracksFromPlaylist() range
343
337
  let s:selectedTrackIds = s:collectTrackIds(a:firstline, a:lastline)
344
338
  let trackIds = join(s:selectedTrackIds, ',')
345
- let bcommand = s:vitunes_tool.'rmTracksFromPlaylist '.trackIds." ".s:currentPlaylist
339
+ let playlist = s:lastPlaylist
340
+ let bcommand = s:vitunes_tool."deleteTracksFromPlaylist ".trackIds." ".shellescape(playlist)
341
+ let res = s:runCommand(bcommand)
342
+ setlocal modifiable
343
+ exec "silent! ".a:firstline.",".a:lastline."delete"
344
+ redraw
345
+ setlocal nomodifiable
346
346
  echom bcommand
347
- let res = system(bcommand)
348
- " delete lines from buffer
349
- echom res
350
- endfunction
347
+ return
348
+ endfunc
351
349
 
352
350
  function! s:newPlaylist(name)
353
351
  let command = s:vitunes_tool.'newPlaylist '.shellescape(a:name)
@@ -1,3 +1,3 @@
1
1
  module ViTunes
2
- VERSION = '0.4.6'
2
+ VERSION = '0.4.7'
3
3
  end
@@ -119,19 +119,17 @@ void addTracksToPlaylistName(NSString *trackIds, NSString *playlistName) {
119
119
  }
120
120
  }
121
121
 
122
- // TODO This doesn't seem to work
123
- void rmTracksFromPlaylistName(NSString *trackIds, NSString *playlistName) {
122
+ void deleteTracksFromPlaylistName(NSString *trackIds, NSString *playlistName) {
124
123
  iTunesPlaylist *playlist = [[library playlists] objectWithName:playlistName];
125
-
126
124
  for (NSString *trackID in [trackIds componentsSeparatedByString:@","]) {
127
- iTunesTrack* t = findTrackID(trackID);
125
+ NSNumber *databaseId = convertNSStringToNumber(trackID);
126
+ NSArray *xs = [[playlist tracks] filteredArrayUsingPredicate: [NSPredicate predicateWithFormat:@"databaseID == %@", databaseId]];
127
+ iTunesTrack* t = [xs objectAtIndex:0];
128
128
  NSLog(@"Removing track: %@ from playlist: %@", [t name], [playlist name]);
129
- [[playlist tracks] removeObject:t];
129
+ [t delete];
130
130
  }
131
-
132
131
  }
133
132
 
134
-
135
133
  void groupTracksBy(NSString *property) {
136
134
  // gets list of all e.g. artists, genres
137
135
  // NOTE year won't work yet
@@ -275,8 +273,11 @@ int main (int argc, const char * argv[]) {
275
273
  } else if ([action isEqual: @"playPlaylist"]) {
276
274
  playPlaylist([args objectAtIndex:0]);
277
275
  } else if ([action isEqual: @"addTracksToPlaylist"]) {
278
- // make sure to quote args
276
+ // make sure to quote first arg
279
277
  addTracksToPlaylistName([args objectAtIndex:0], [args objectAtIndex:1]);
278
+ } else if ([action isEqual: @"deleteTracksFromPlaylist"]) {
279
+ // make sure to quote first arg
280
+ deleteTracksFromPlaylistName([args objectAtIndex:0], [args objectAtIndex:1]);
280
281
  } else if ([action isEqual: @"volumeUp"]) {
281
282
  turnVolume(@"up");
282
283
  } else if ([action isEqual: @"volumeDown"]) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vitunes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-02 00:00:00.000000000Z
12
+ date: 2011-08-03 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Control iTunes with Vim
15
15
  email: