zik 0.16.1 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/ChangeLog +4 -0
- data/Makefile.in +1 -1
- data/doc/ChangeLog +4 -0
- data/doc/man/zik.1.gz +0 -0
- data/gui/error.rb +4 -4
- data/gui/mod.rb +2 -2
- data/playlist/playlist.rb +2 -2
- data/zik +375 -0
- metadata +5 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
data/Makefile.in
CHANGED
data/doc/ChangeLog
CHANGED
data/doc/man/zik.1.gz
ADDED
Binary file
|
data/gui/error.rb
CHANGED
@@ -41,21 +41,21 @@ class Error
|
|
41
41
|
case type
|
42
42
|
when ErrorINFO, ModErrorINFO
|
43
43
|
puts message
|
44
|
-
if $show_errors&&user
|
44
|
+
if $show_errors&&user&&defined?(@@zik)
|
45
45
|
dialog=Gtk::MessageDialog.new(@@zik, Gtk::Dialog::MODAL|Gtk::Dialog::DESTROY_WITH_PARENT,
|
46
46
|
Gtk::MessageDialog::INFO, Gtk::MessageDialog::BUTTONS_CLOSE, @long_message)
|
47
47
|
dialog.run; dialog.destroy
|
48
48
|
end
|
49
49
|
when ErrorWARNING, ModErrorWARNING
|
50
50
|
$stderr.puts "WARNING. "+message
|
51
|
-
if $show_errors&&user
|
51
|
+
if $show_errors&&user&&defined?(@@zik)
|
52
52
|
dialog=Gtk::MessageDialog.new(@@zik, Gtk::Dialog::MODAL|Gtk::Dialog::DESTROY_WITH_PARENT,
|
53
53
|
Gtk::MessageDialog::WARNING, Gtk::MessageDialog::BUTTONS_CLOSE, @long_message)
|
54
54
|
dialog.run; dialog.destroy
|
55
55
|
end
|
56
56
|
when ErrorERROR, ModErrorERROR
|
57
57
|
$stderr.puts "ERROR. "+message
|
58
|
-
if $show_errors&&user
|
58
|
+
if $show_errors&&user&&defined?(@@zik)
|
59
59
|
dialog=Gtk::MessageDialog.new(@@zik, Gtk::Dialog::MODAL|Gtk::Dialog::DESTROY_WITH_PARENT,
|
60
60
|
Gtk::MessageDialog::ERROR, Gtk::MessageDialog::BUTTONS_CLOSE, @long_message)
|
61
61
|
dialog.run; dialog.destroy
|
@@ -106,7 +106,7 @@ class ErrorsStock
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def show_all(message="")
|
109
|
-
if $show_errors
|
109
|
+
if $show_errors&&defined?(@@zik)
|
110
110
|
unless @stock.empty?
|
111
111
|
tmp=[]
|
112
112
|
@stock.each{|error| message+="\n#{error.long_message}"; tmp.push(error.type)}
|
data/gui/mod.rb
CHANGED
@@ -68,11 +68,11 @@ class ModErrorLoadError < ModError
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
def initialize(mod,
|
71
|
+
def initialize(mod, message)
|
72
72
|
@mod=mod; @message=message
|
73
73
|
@@stock.push(self)
|
74
74
|
$stderr.print "[#{mod.id}]: "
|
75
|
-
super(mod, ModErrorLOAD_ERROR, message, false)
|
75
|
+
super(mod, ModErrorLOAD_ERROR, message, false, nil)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
data/playlist/playlist.rb
CHANGED
@@ -53,7 +53,7 @@ private
|
|
53
53
|
f=File.open(file, 'r')
|
54
54
|
data=f.read
|
55
55
|
rescue
|
56
|
-
ErrorError.new("#{file} cannot be read."
|
56
|
+
ErrorError.new("#{file} cannot be read.")
|
57
57
|
ensure
|
58
58
|
f.close if f
|
59
59
|
end
|
@@ -73,7 +73,7 @@ private
|
|
73
73
|
add_file(p.to_s, tag)
|
74
74
|
}
|
75
75
|
rescue
|
76
|
-
ErrorError.new("Error while parsing #{file}."
|
76
|
+
ErrorError.new("Error while parsing #{file}.")
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
data/zik
CHANGED
@@ -1,2 +1,377 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
|
+
|
4
|
+
=begin
|
5
|
+
Copyright 2007-2011 Vincent Carmona
|
6
|
+
vinc4mai@gmail.com
|
7
|
+
|
8
|
+
This file is part of ZiK.
|
9
|
+
|
10
|
+
ZiK is free software; you can redistribute it and/or modify
|
11
|
+
it under the terms of the GNU General Public License as published by
|
12
|
+
the Free Software Foundation; either version 2 of the License, or
|
13
|
+
(at your option) any later version.
|
14
|
+
|
15
|
+
ZiK is distributed in the hope that it will be useful,
|
16
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
+
GNU General Public License for more details.
|
19
|
+
|
20
|
+
You should have received a copy of the GNU General Public License
|
21
|
+
along with ZiK; if not, write to the Free Software
|
22
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
23
|
+
=end
|
24
|
+
|
25
|
+
$name='ZiK'
|
26
|
+
Version='0.16.2'
|
27
|
+
|
28
|
+
#Usage
|
29
|
+
def usage
|
30
|
+
puts "ZiK is an audio player based on gstreamer.\n\n"
|
31
|
+
puts "Options."
|
32
|
+
puts "--help -h\tPrint this help."
|
33
|
+
puts "--configuration -c <path>\tDirectory used to load and save configuration."
|
34
|
+
puts "--file -f <files>\tAdd files to playlist."
|
35
|
+
puts "--append -f <files>\tAppend files playlist."
|
36
|
+
puts "--show-all\tshow browser and playlist."
|
37
|
+
puts "--show-browser\tshow browser."
|
38
|
+
puts "--show-playlist\tshow playlist."
|
39
|
+
puts "--show-cd\tshow CD."
|
40
|
+
puts "--show-radio\tshow radios."
|
41
|
+
puts "--disable-cd\tDisable cd support"
|
42
|
+
puts "--disable-radio\tDisable webradios"
|
43
|
+
puts "--disable-module\tDisable module support"
|
44
|
+
puts "--hide-errors\tDo not show errors dialogs."
|
45
|
+
puts "--quiet -q\tDo not print on standart output."
|
46
|
+
puts "--no-save\tDo not overwrite configuration file"
|
47
|
+
puts "--title -t <name>\tRename window's title."
|
48
|
+
puts "--version\tDisplay the current version and exit."
|
49
|
+
end
|
50
|
+
|
51
|
+
#Parse options
|
52
|
+
$write_config=true
|
53
|
+
$show_errors=true
|
54
|
+
$cd=true
|
55
|
+
$radio=true
|
56
|
+
$module=true
|
57
|
+
append=false
|
58
|
+
playfiles=[]
|
59
|
+
while arg=ARGV.shift
|
60
|
+
case arg
|
61
|
+
when '--version'
|
62
|
+
puts "ZiK version #{Version}.";exit 0
|
63
|
+
when '--help', '-h'
|
64
|
+
usage;exit 0
|
65
|
+
when '--quiet', '-q'
|
66
|
+
$stderr=$stdout=File.new('/dev/null', 'w')
|
67
|
+
when '--no-save'
|
68
|
+
$write_config=false
|
69
|
+
when '--hide-errors'
|
70
|
+
$show_errors=false
|
71
|
+
when '--disable-cd'
|
72
|
+
$cd=false
|
73
|
+
when '--disable-radio'
|
74
|
+
$radio=false
|
75
|
+
when '--disable-module'
|
76
|
+
$module=false
|
77
|
+
when '--configuration', '-c'
|
78
|
+
User_dir=ARGV.shift
|
79
|
+
when '--show-all'
|
80
|
+
view='all'
|
81
|
+
when '--show-browser'
|
82
|
+
view='browser'
|
83
|
+
when '--show-playlist'
|
84
|
+
view='playlist'
|
85
|
+
when '--show-cd'
|
86
|
+
view='cd'
|
87
|
+
when '--show-radio'
|
88
|
+
view='radio'
|
89
|
+
when '--file', '-f'
|
90
|
+
append=false
|
91
|
+
when '--append', '-a'
|
92
|
+
append=true
|
93
|
+
when '--title', '-t'
|
94
|
+
$name+=' - '+ARGV.shift
|
95
|
+
when /^-/
|
96
|
+
$stderr.puts "Unknown option. Try ZiK --help.";exit 1
|
97
|
+
else
|
98
|
+
playfiles.push(arg)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
Data_dir='/usr/share/ZiK'
|
103
|
+
Pix_dir=File.join(Data_dir,'pix')
|
104
|
+
Doc_dir='/usr/share/doc/ZiK'
|
105
|
+
Locale_dir='/usr/share/locale'
|
106
|
+
|
107
|
+
require 'gettext'
|
108
|
+
include GetText
|
109
|
+
bindtextdomain('ZiK', {:path=>Locale_dir})
|
110
|
+
require File.join(Data_dir, 'gui/error')
|
111
|
+
estock=ErrorsStock.new
|
112
|
+
|
113
|
+
ErrorInfo.new("Hi! This is #{$name} (#{Version}). Enjoy your music.")
|
114
|
+
ErrorWarning.new("ZiK is deprecated. You should call ZiK by zik") if __FILE__=~/ZiK$/
|
115
|
+
|
116
|
+
#Global configuration
|
117
|
+
$border=5
|
118
|
+
|
119
|
+
#Configuration
|
120
|
+
require File.join(Data_dir, 'gui/config')
|
121
|
+
User_dir=File.join(ENV['HOME'],'.ZiK') unless (defined? User_dir)
|
122
|
+
unless File.exist?(User_dir)
|
123
|
+
Dir.mkdir(User_dir)
|
124
|
+
config_new=true
|
125
|
+
end
|
126
|
+
if File.directory?(User_dir)
|
127
|
+
configuration_file=File.join(User_dir,'ZiKrc')
|
128
|
+
config=Configuration.new(configuration_file)
|
129
|
+
else
|
130
|
+
config=Configuration.new("")
|
131
|
+
$write_config=false
|
132
|
+
config_new=true
|
133
|
+
estock.add(ErrorERROR, _("Configuration will not be saved. #{User_dir} is not a directory."))
|
134
|
+
end
|
135
|
+
config_new||=false
|
136
|
+
config['view']=view if view
|
137
|
+
|
138
|
+
#Socket (client part)
|
139
|
+
module ZiKSocket
|
140
|
+
Address=File.join(User_dir, 'socket')
|
141
|
+
end
|
142
|
+
if config['socket']
|
143
|
+
require 'socket'
|
144
|
+
require File.join(Data_dir, 'gui/socket')
|
145
|
+
if File.socket?(ZiKSocket::Address)
|
146
|
+
begin
|
147
|
+
client=ZiKSocket::Client.new
|
148
|
+
ErrorInfo.new(_("Multisession : server already exists."))
|
149
|
+
playfiles.each{|file|
|
150
|
+
file=File.join(Dir.pwd, file) unless file =~ /^\//#absolute path
|
151
|
+
p client.command("add #{file}")
|
152
|
+
}
|
153
|
+
client.command("show")
|
154
|
+
client.close
|
155
|
+
exit 0
|
156
|
+
rescue Errno::ECONNREFUSED
|
157
|
+
ErrorError.new(_("Multissession: socket exists but server does not respond."))
|
158
|
+
File.delete(ZiKSocket::Address)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
#Files needed for playlist managing
|
164
|
+
require 'pathname'
|
165
|
+
require 'rexml/document'
|
166
|
+
begin
|
167
|
+
require 'taglib2'
|
168
|
+
rescue LoadError
|
169
|
+
require 'taglib'
|
170
|
+
ErrorWarning.new("ruby-taglib is depreated.")
|
171
|
+
end
|
172
|
+
require File.join(Data_dir, 'playlist/song')
|
173
|
+
require File.join(Data_dir, 'playlist/common')
|
174
|
+
require File.join(Data_dir, 'playlist/export')
|
175
|
+
require File.join(Data_dir, 'playlist/playlist')
|
176
|
+
|
177
|
+
|
178
|
+
#Files needed for the audio player
|
179
|
+
require 'gst'
|
180
|
+
require File.join(Data_dir, 'player/player')
|
181
|
+
|
182
|
+
#Files needed for graphical interface
|
183
|
+
require 'gtk2'
|
184
|
+
require 'find'
|
185
|
+
require File.join(Data_dir, 'gui/common')
|
186
|
+
require File.join(Data_dir, 'gui/preference')
|
187
|
+
require File.join(Data_dir, 'gui/search')
|
188
|
+
require File.join(Data_dir, 'playlist/editlist')
|
189
|
+
require File.join(Data_dir, 'gui/edit')
|
190
|
+
require File.join(Data_dir, 'gui/progress')
|
191
|
+
require File.join(Data_dir, 'gui/gui')
|
192
|
+
|
193
|
+
#Files needed for audio cd
|
194
|
+
if $cd
|
195
|
+
begin
|
196
|
+
require 'musicbrainz'
|
197
|
+
require File.join(Data_dir, 'playlist/cdlist')
|
198
|
+
require File.join(Data_dir, 'player/cdplayer')
|
199
|
+
require File.join(Data_dir, 'gui/cdgui')
|
200
|
+
rescue LoadError
|
201
|
+
estock.add(ErrorERROR, _("CD support disable. mb-ruby is probably not installed."))
|
202
|
+
$cd=false
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
#Files needed for webradio
|
207
|
+
if $radio
|
208
|
+
begin
|
209
|
+
require 'uri'
|
210
|
+
require 'net/http'
|
211
|
+
require File.join(Data_dir, 'playlist/radiolist')
|
212
|
+
require File.join(Data_dir, 'player/radioplayer')
|
213
|
+
require File.join(Data_dir, 'gui/radiogui')
|
214
|
+
rescue LoadError
|
215
|
+
estock.add(ErrorERROR, _("Radio support disable."))
|
216
|
+
$radio=false
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
#Playlists
|
221
|
+
if (playfiles.empty? || append)
|
222
|
+
playlist=PlayList.new(File.join(User_dir,'playlist'),
|
223
|
+
config['current_song'], config['shuffle'], config['repeat'], config['name_format'], config['sort_by_track'])
|
224
|
+
end
|
225
|
+
playlist||=PlayList.new(nil, 0, config['shuffle'], config['repeat'], config['name_format'], config ['sort_by_track'])
|
226
|
+
playfiles.each{|f| playlist.add(f)}
|
227
|
+
|
228
|
+
cdlist=Cd::List.new(config) if $cd
|
229
|
+
if $radio
|
230
|
+
radio_file=File.join(User_dir,'radio')
|
231
|
+
radiolist=Radio::List.new(radio_file)
|
232
|
+
end
|
233
|
+
|
234
|
+
#Players
|
235
|
+
player=Player.new
|
236
|
+
player.volume=config['volume']
|
237
|
+
if $cd
|
238
|
+
begin
|
239
|
+
cdplayer=Cd::Player.new(config['cd_device'])
|
240
|
+
cdplayer.volume=config['volume']
|
241
|
+
rescue
|
242
|
+
estock.add(ErrorERROR, _("CD support disable (device not found?)."))
|
243
|
+
$cd=false
|
244
|
+
end
|
245
|
+
end
|
246
|
+
if $radio
|
247
|
+
radioplayer=Radio::Player.new
|
248
|
+
radioplayer.volume=config['volume']
|
249
|
+
end
|
250
|
+
|
251
|
+
cdplayer=nil unless $cd
|
252
|
+
cdlist=nil unless $cd
|
253
|
+
radiolist=nil unless $radio
|
254
|
+
|
255
|
+
#Gui
|
256
|
+
module View
|
257
|
+
View::ALL=0
|
258
|
+
View::PLAYLIST=1
|
259
|
+
View::BROWSER=2
|
260
|
+
View::COMPACT=3
|
261
|
+
if $cd
|
262
|
+
View::CD=4
|
263
|
+
$radio ? View::RADIO=5 : View::RADIO=View::ALL
|
264
|
+
else
|
265
|
+
View::CD=View::ALL
|
266
|
+
$radio ? View::RADIO=4 : View::RADIO=View::ALL
|
267
|
+
end
|
268
|
+
end
|
269
|
+
module DragType
|
270
|
+
#Type of data
|
271
|
+
#General types
|
272
|
+
#DragType::STRING=104 #Gdk::Atom.intern('string',true).to_i
|
273
|
+
DragType::URI_LIST=105 #text/uri-list
|
274
|
+
#DragType::PLAIN=106 #text/plain
|
275
|
+
#ZiK types
|
276
|
+
DragType::BROWSER_SELECTION=700
|
277
|
+
end
|
278
|
+
begin
|
279
|
+
Gdk::Color.parse(config['playing_color'])
|
280
|
+
rescue
|
281
|
+
ErrorError.new("#{config['playing_color']} is not a valid color. Use default one.")
|
282
|
+
config['playing_color']=config.default['playing_color']
|
283
|
+
end
|
284
|
+
if config_new
|
285
|
+
require File.join(Data_dir, 'gui/assistant')
|
286
|
+
assistant=Assistant.new(config)
|
287
|
+
def assistant.quit
|
288
|
+
self.destroy
|
289
|
+
Gtk.main_quit
|
290
|
+
end
|
291
|
+
Gtk.main
|
292
|
+
end
|
293
|
+
gui=Gui.new(player, playlist, config, cdplayer, cdlist, radioplayer, radiolist)
|
294
|
+
gui.show
|
295
|
+
Error.gui=gui
|
296
|
+
ErrorsStock.gui=gui
|
297
|
+
player.gui=gui
|
298
|
+
cdplayer.gui=gui if $cd
|
299
|
+
radioplayer.gui=gui if $radio
|
300
|
+
|
301
|
+
#Socket (Server part)
|
302
|
+
##See http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_threads if random crash happen (or try GLib::Idle before)
|
303
|
+
module ZiKSocket
|
304
|
+
def ZiKSocket.clean
|
305
|
+
if File.socket?(Address)
|
306
|
+
c=ZiKSocket::Client.new
|
307
|
+
c.close_server
|
308
|
+
File.delete(Address)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
if config['socket']
|
313
|
+
ErrorError.new(_("Multisession: server not started."), true) if ZiKSocket.start_server(gui, config, playlist).status.nil?#Except raise in thread used to start server.
|
314
|
+
end
|
315
|
+
|
316
|
+
#Modules
|
317
|
+
if $module
|
318
|
+
require File.join(Data_dir, 'gui/mod')
|
319
|
+
Mod.zik=gui
|
320
|
+
modinput={:config_dir=>File.join(User_dir, 'mod'), :mod_dir=>File.join(Data_dir,'mod'), :pix_dir=>Pix_dir}
|
321
|
+
ext='.rb'
|
322
|
+
|
323
|
+
mfiles=Dir.glob(File.join(Data_dir, 'mod', '*'+ext))
|
324
|
+
mfiles.each{|file|
|
325
|
+
begin
|
326
|
+
require file#require all modules in order to build preferences dialog.
|
327
|
+
rescue LoadError
|
328
|
+
estock.add(ErrorERROR, _("Cannot loaded a module (#{file})."))
|
329
|
+
rescue ModNotUniqueId
|
330
|
+
estock.add(ErrorERROR, _("Module id not unique (#{file})."))
|
331
|
+
end
|
332
|
+
}
|
333
|
+
Mod.own.each{|mod|
|
334
|
+
mod.init(modinput)
|
335
|
+
mod.load if config['module'].split(',').include?(mod.id)
|
336
|
+
}
|
337
|
+
|
338
|
+
Mod.global=false
|
339
|
+
mfiles=Dir.glob(File.join(User_dir, 'mod','*'+ext))
|
340
|
+
modinput[:mod_dir]=File.join(User_dir, 'mod')
|
341
|
+
mfiles.each{|file|
|
342
|
+
begin
|
343
|
+
require file#require all modules in order to build preferences dialog.
|
344
|
+
rescue LoadError
|
345
|
+
estock.add(ErrorERROR, _("Cannot loaded a module (#{file})."))
|
346
|
+
rescue ModNotUniqueId
|
347
|
+
estock.add(ErrorERROR, _("Module id not unique (#{file})."))
|
348
|
+
end
|
349
|
+
}
|
350
|
+
Mod.user.each{|mod|
|
351
|
+
mod.init(modinput)
|
352
|
+
mod.load if config['module'].split(',').include?(mod.id)
|
353
|
+
}
|
354
|
+
ModErrorLoadError.show_all
|
355
|
+
end
|
356
|
+
|
357
|
+
#Main
|
358
|
+
gui.play if config['play_on_start']
|
359
|
+
estock.show_all
|
360
|
+
begin
|
361
|
+
Gtk.main
|
362
|
+
if $write_config
|
363
|
+
playlist.save_zik(File.join(User_dir,'playlist'), config['relative_playlist'])
|
364
|
+
config['current_song']=playlist.current
|
365
|
+
config['volume']=player.volume
|
366
|
+
config.write
|
367
|
+
radiolist.write if $radio
|
368
|
+
end
|
369
|
+
Mod.all.each{|mod| mod.quit} if $module
|
370
|
+
ensure
|
371
|
+
player.stop
|
372
|
+
cdplayer.stop if $cd
|
373
|
+
radioplayer.stop if $radio
|
374
|
+
ZiKSocket.clean
|
375
|
+
end
|
376
|
+
|
377
|
+
ErrorInfo.new("Bye.")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 91
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 16
|
9
|
-
-
|
10
|
-
version: 0.16.
|
9
|
+
- 2
|
10
|
+
version: 0.16.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vincent Carmona
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
oxzIRXlS
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-03-
|
39
|
+
date: 2011-03-12 00:00:00 +01:00
|
40
40
|
default_executable:
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
@@ -225,6 +225,7 @@ files:
|
|
225
225
|
- doc/html/pix/logo.png
|
226
226
|
- doc/html/styles/main.css
|
227
227
|
- doc/ChangeLog
|
228
|
+
- doc/man/zik.1.gz
|
228
229
|
- doc/man/manpage.1
|
229
230
|
- ./zik
|
230
231
|
has_rdoc: true
|
metadata.gz.sig
CHANGED
Binary file
|