spfy 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,8 +24,9 @@ require "optparse"
24
24
  require "ostruct"
25
25
  require "taglib"
26
26
  require 'find'
27
+ require 'uri'
27
28
 
28
- $version = "0.1.3"
29
+ $version = "0.1.4"
29
30
  $dirs = []
30
31
 
31
32
  # The main Spfy class
@@ -97,6 +98,12 @@ class Spfy
97
98
 
98
99
  # write track metadata
99
100
  xmlFile.write("\t\t<track>\n")
101
+
102
+ if !options.hide_location
103
+ encoded_path = URI.escape(path)
104
+ xmlFile.write("\t\t\t<location>file://#{encoded_path}</location>\n")
105
+ end
106
+
100
107
  xmlFile.write("\t\t\t<title>#{tag.title}</title>\n") if !options.hide_title and !tag.title.empty?
101
108
  xmlFile.write("\t\t\t<creator>#{tag.artist}</creator>\n") if !options.hide_artist and !tag.artist.empty?
102
109
  xmlFile.write("\t\t\t<album>#{tag.album}</album>\n") if !options.hide_album and !tag.album.empty?
@@ -137,6 +144,12 @@ class Spfy
137
144
 
138
145
  # output track metadata
139
146
  puts "\t\t<track>\n"
147
+
148
+ if !options.hide_location
149
+ encoded_path = URI.escape(path)
150
+ puts "\t\t\t<location>file://#{encoded_path}</location>\n"
151
+ end
152
+
140
153
  puts "\t\t\t<title>#{tag.title}</title>\n" if !options.hide_title and !tag.title.empty?
141
154
  puts "\t\t\t<creator>#{tag.artist}</creator>\n" if !options.hide_artist and !tag.artist.empty?
142
155
  puts "\t\t\t<album>#{tag.album}</album>\n" if !options.hide_album and !tag.album.empty?
@@ -8,9 +8,10 @@ class OptionReader
8
8
  options.hide_title = false
9
9
  options.hide_artist = false
10
10
  options.hide_album = false
11
+ options.hide_location = false
11
12
 
12
13
  opts = OptionParser.new do |opts|
13
- opts.banner = "Usage: #{File.basename($0)} [options] [dir1 ... dirx]"
14
+ opts.banner = "Usage: #{File.basename($0)} [options] dir1 ... dirN"
14
15
 
15
16
  opts.separator ""
16
17
  opts.separator "Output:"
@@ -19,6 +20,10 @@ class OptionReader
19
20
  options.output << out
20
21
  end
21
22
 
23
+ opts.on("-f", "--no-location", "Suppress file location output") do
24
+ options.hide_location = true
25
+ end
26
+
22
27
  opts.on("-t", "--no-title", "Suppress track title in output") do
23
28
  options.hide_title = true
24
29
  end
@@ -21,10 +21,10 @@
21
21
 
22
22
  Gem::Specification.new do |s|
23
23
  s.name = 'spfy'
24
- s.version = '0.1.3'
24
+ s.version = '0.1.4'
25
25
  s.date = '2012-05-06'
26
26
  s.summary = 'XSPF playlist generator'
27
- s.description = 'Spfy is a simple command-line ruby tool for generating XSPF playlists from metadata stored in several popular audio formats.'
27
+ s.description = 'Spfy is a simple command-line tool for generating XSPF playlists from metadata stored in several popular audio formats.'
28
28
  s.authors = ["Marc Ransome"]
29
29
  s.email = 'marc.ransome@fidgetbox.co.uk'
30
30
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spfy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,8 +27,8 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.5.0
30
- description: Spfy is a simple command-line ruby tool for generating XSPF playlists
31
- from metadata stored in several popular audio formats.
30
+ description: Spfy is a simple command-line tool for generating XSPF playlists from
31
+ metadata stored in several popular audio formats.
32
32
  email: marc.ransome@fidgetbox.co.uk
33
33
  executables:
34
34
  - spfy