vitunes 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -119,6 +119,11 @@ added to the end of the playlist.
119
119
  If this target playlist is already playing, you can keep queuing tracks to it
120
120
  and let the mix play out automatically.
121
121
 
122
+ ### Managing playlists
123
+
124
+ * `:NewPlaylist [new-playlist-name]` creates a new playlist
125
+
126
+
122
127
  ## Bug reports and feature requests
123
128
 
124
129
  Please submit these at either of these places:
@@ -1,3 +1,3 @@
1
1
  module ViTunes
2
- VERSION = '0.2.7'
2
+ VERSION = '0.2.8'
3
3
  end
Binary file
data/lib/vitunes.vim CHANGED
@@ -8,8 +8,8 @@ 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
12
  " Maybe I should make this a relative path
12
- let s:vitunes_tool = '/Users/choi/projects/vitunes/lib/vitunes-tool-objc '
13
13
  endif
14
14
 
15
15
  let s:searchPrompt = "Search iTunes Music Library: "
@@ -90,6 +90,8 @@ function! ViTunes()
90
90
  setlocal nomodifiable
91
91
  setlocal statusline=%!ViTunesStatusLine()
92
92
 
93
+ command! -buffer -bar -nargs=1 NewPlaylist call s:newPlaylist(<f-args>)
94
+
93
95
  if line('$') == 1 " buffer empty
94
96
  let msg = "Welcome to ViTunes\n\nPress ? for help"
95
97
  setlocal modifiable
@@ -171,7 +173,7 @@ function! s:currentTrackAndPlaylist()
171
173
  endfunction
172
174
 
173
175
  function! s:openQueryWindow()
174
- leftabove split SearchTracks
176
+ leftabove split SearchLibrary
175
177
  setlocal textwidth=0
176
178
  setlocal buftype=nofile
177
179
  setlocal noswapfile
@@ -341,6 +343,13 @@ function! s:deleteTracksFromPlaylist() range
341
343
  echom res
342
344
  endfunction
343
345
 
346
+ function! s:newPlaylist(name)
347
+ let command = s:vitunes_tool.'newPlaylist '.shellescape(a:name)
348
+ echom command
349
+ let res = system(s:vitunes_tool.'newPlaylist '.shellescape(a:name))
350
+ echom res
351
+ endfunction
352
+
344
353
  nnoremap <silent> <leader>i :call ViTunes()<cr>
345
354
 
346
355
 
data/vitunes/main.m CHANGED
@@ -223,6 +223,18 @@ void turnVolume(NSString *direction) {
223
223
  printf("Changing volume %d -> %d", (int)currentVolume, (int)iTunes.soundVolume);
224
224
  }
225
225
 
226
+ void newPlaylist(NSString *name) {
227
+ // note that we have to force realize it with get to check for missing
228
+ iTunesPlaylist *existingPlaylist = [[[library playlists] objectWithName:name] get];
229
+ if (existingPlaylist != nil) {
230
+ printf("%s already exists", [[existingPlaylist name] cStringUsingEncoding: NSUTF8StringEncoding]);
231
+ return;
232
+ }
233
+ NSDictionary *props = [NSDictionary dictionaryWithObject:name forKey:@"name"];
234
+ iTunesPlaylist *playlist = [[[iTunes classForScriptingClass:@"playlist"] alloc] initWithProperties:props];
235
+ [[library playlists] addObject:playlist];
236
+ printf("Created new playlist: %s", [name cStringUsingEncoding:NSUTF8StringEncoding]);
237
+ }
226
238
 
227
239
  int main (int argc, const char * argv[]) {
228
240
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
@@ -266,6 +278,8 @@ int main (int argc, const char * argv[]) {
266
278
  turnVolume(@"up");
267
279
  } else if ([action isEqual: @"volumeDown"]) {
268
280
  turnVolume(@"down");
281
+ } else if ([action isEqual: @"newPlaylist"]) {
282
+ newPlaylist([args objectAtIndex:0]);
269
283
  } else if ([action isEqual: @"itunes"]) {
270
284
  // argument is an action for iTunesApplication to perform
271
285
  itunes([args objectAtIndex:0]);
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 7
9
- version: 0.2.7
8
+ - 8
9
+ version: 0.2.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Choi