77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/subcl/runner.rb', line 77
def run(args)
LOGGER.debug { "args = #{args}" }
parse_options!(args)
LOGGER.debug { "args = #{args}" }
unless args.size >= 1
@options[:err_stream].puts @usage
exit 3
end
unless system('tty -s')
@options[:tty] = false
@options[:interactive] = false
end
subcl = Subcl.new @options
arg = args[1,args.length-1].join(" ")
command = args[0].downcase
case command
when /^play-song$|^ps$/
subcl.queue(arg, :song, {:play => true, :clear => true})
when /^play-artist$|^pr$/
subcl.queue(arg, :artist, {:play => true, :clear => true})
when /^play-album$|^pl$/
subcl.queue(arg, :album, {:play => true, :clear => true})
when /^play-playlist$|^pp$/
subcl.queue(arg, :playlist, {:play => true, :clear => true})
when /^play-random$|^r$/
subcl.queue(arg, :randomSong, {:play => true, :clear => true})
when /^queue-next-song$|^ns$/
subcl.queue(arg, :song, {:insert => true})
when /^queue-next-artist$|^nr$/
subcl.queue(arg, :artist, {:insert => true})
when /^queue-next-album$|^nl$/
subcl.queue(arg, :album, {:insert => true})
when /^queue-next-playlist$|^np$/
subcl.queue(arg, :playlist, {:insert => true})
when /^queue-last-song$|^ls$/
subcl.queue(arg, :song)
when /^queue-last-artist$|^lr$/
subcl.queue(arg, :artist)
when /^queue-last-album$|^ll$/
subcl.queue(arg, :album)
when /^queue-last-playlist$|^lp$/
subcl.queue(arg, :playlist)
when "albumart-url"
arg = nil if arg.empty?
@options[:out_stream].puts subcl.albumart_url(arg)
when /^album-list$|^al$/
subcl.albumlist
when "test-notify"
subcl.testNotify
else
begin
subcl.send(command, [])
rescue NoMethodError
unknown(command)
end
end
end
|