tangled
alpha
login
or
join now
jcs.org
/
itunes-rsync
0
fork
atom
utility to sync an itunes playlist to a directory (like a mounted sd card/phone)
0
fork
atom
overview
issues
pulls
pipelines
use File.symlink
authored by
jcs
and committed by
jcs.org
13 years ago
a52e38f3
1a3a0929
+6
-7
1 changed file
expand all
collapse all
unified
split
itunes-rsync.rb
+6
-7
itunes-rsync.rb
···
1
1
#!/usr/bin/ruby
2
2
-
# $Id: itunes-rsync.rb,v 1.1 2009/01/27 08:49:12 jcs Exp $
3
3
-
#
4
4
-
# rsync an itunes playlist with another directory, most likely a usb music
5
5
-
# device
2
2
+
# $Id: itunes-rsync.rb,v 1.5 2009/01/27 09:11:14 jcs Exp $
6
3
#
7
7
-
# requires the rubyosa gem ("sudo gem install rubyosa")
4
4
+
# rsync the files of an itunes playlist with another directory, most likely a
5
5
+
# usb music device. requires the rubyosa gem ("sudo gem install rubyosa")
8
6
#
9
7
# Copyright (c) 2009 joshua stein <jcs@jcs.org>
10
8
#
···
92
90
end
93
91
94
92
# setup work dir
95
95
-
td = `mktemp -d /tmp/itunesrsync.XXXXX`.strip
93
93
+
td = `mktemp -d /tmp/itunes-rsync.XXXXX`.strip
96
94
97
95
# mirror directory structure and create symlinks
98
96
print "linking files under #{td}/... "
···
102
100
tmppath = "#{td}/#{shortpath}"
103
101
104
102
if !Dir[File.dirname(tmppath)].any?
103
103
+
# i'm too lazy to emulate -p with Dir.mkdir
105
104
system("mkdir", "-p", File.dirname(tmppath))
106
105
end
107
106
108
108
-
system("ln", "-s", t, tmppath)
107
107
+
File.symlink(t, tmppath)
109
108
end
110
109
111
110
puts "done."