zik 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +222 -0
- data/INSTALL +34 -0
- data/Makefile.in +199 -0
- data/README +53 -0
- data/ZiK.desktop +11 -0
- data/ZiK.rb +377 -0
- data/configure +269 -0
- data/dependencies +142 -0
- data/doc/COPYING +340 -0
- data/doc/ChangeLog +222 -0
- data/doc/html/fr/index.html +128 -0
- data/doc/html/index.html +126 -0
- data/doc/html/pix/ZiK3.png +0 -0
- data/doc/html/pix/capture.png +0 -0
- data/doc/html/pix/capture_cd.png +0 -0
- data/doc/html/pix/capture_compact.png +0 -0
- data/doc/html/pix/capture_radio.png +0 -0
- data/doc/html/pix/icon.png +0 -0
- data/doc/html/pix/logo.png +0 -0
- data/doc/html/styles/main.css +47 -0
- data/doc/man/manpage.1 +43 -0
- data/gui/assistant.rb +133 -0
- data/gui/cdgui.rb +54 -0
- data/gui/common.rb +56 -0
- data/gui/config.rb +120 -0
- data/gui/edit.rb +413 -0
- data/gui/error.rb +124 -0
- data/gui/gui.rb +1383 -0
- data/gui/mod.rb +239 -0
- data/gui/preference.rb +496 -0
- data/gui/progress.rb +50 -0
- data/gui/radiogui.rb +404 -0
- data/gui/search.rb +249 -0
- data/gui/socket.rb +107 -0
- data/mod/brainz.rb +76 -0
- data/mod/brainz/dialogs.rb +132 -0
- data/mod/brainz/functions.rb +55 -0
- data/mod/brainz/ofa.rb +76 -0
- data/mod/brainz/song.rb +139 -0
- data/mod/brainz/widget.rb +34 -0
- data/mod/cover.rb +90 -0
- data/mod/cover/application-x-cd-image.svg +666 -0
- data/mod/cover/config.rb +79 -0
- data/mod/cover/configwidget.rb +35 -0
- data/mod/cover/widget.rb +147 -0
- data/mod/hotkeys.rb +137 -0
- data/mod/hotkeys/config.rb +84 -0
- data/mod/hotkeys/configwidget.rb +93 -0
- data/mod/interact.rb +131 -0
- data/mod/interact/configwidget.rb +107 -0
- data/mod/interact/interaction.rb +79 -0
- data/mod/notify.rb +128 -0
- data/mod/notify/config.rb +96 -0
- data/mod/notify/configwidget.rb +76 -0
- data/mod/notify/window.rb +56 -0
- data/mod/trayicon.rb +83 -0
- data/mod/trayicon/config.rb +79 -0
- data/mod/trayicon/configwidget.rb +35 -0
- data/mod/trayicon/icon.rb +99 -0
- data/pix/ZiK.svg +78 -0
- data/pix/ZiK3.png +0 -0
- data/pix/assistant/capture.png +0 -0
- data/pix/gtk-directory.svg +287 -0
- data/pix/media-cdrom.svg +292 -0
- data/pix/network-wireless.svg +429 -0
- data/pix/player_play.svg +286 -0
- data/pix/sound.svg +244 -0
- data/pix/sound_directory.svg +464 -0
- data/player/cdplayer.rb +108 -0
- data/player/player.rb +132 -0
- data/player/radioplayer.rb +124 -0
- data/playlist/cdlist.rb +140 -0
- data/playlist/common.rb +343 -0
- data/playlist/editlist.rb +50 -0
- data/playlist/export.rb +108 -0
- data/playlist/playlist.rb +143 -0
- data/playlist/radiolist.rb +148 -0
- data/playlist/song.rb +122 -0
- data/po/ZiK.pot +622 -0
- data/po/fr/ZiK.po +658 -0
- data/zik +2 -0
- metadata +265 -0
- metadata.gz.sig +0 -0
data/README
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#***Descritpion.
|
2
|
+
ZiK is audio player.
|
3
|
+
It is written in ruby and use gstreamer to play audio file.
|
4
|
+
ZiK is release under GPL v2 license (see the doc/COPYNG file).
|
5
|
+
|
6
|
+
#***Dependencies.
|
7
|
+
To run ZiK you will need:
|
8
|
+
ruby-gtk2 http://ruby-gnome2.sourceforge.jp/
|
9
|
+
librsvg http://librsvg.sourceforge.net/
|
10
|
+
ruby-gstreamer http://ruby-gnome2.sourceforge.jp/
|
11
|
+
gst-plugins-base http://gstreamer.freedesktop.org/
|
12
|
+
ruby-taglib http://www.hakubi.us/ruby-taglib/
|
13
|
+
ruby-gettext-package http://rubyforge.org/projects/gettext/
|
14
|
+
|
15
|
+
For cd support, you will need:
|
16
|
+
mb-ruby http://pablotron.org/software/mb-ruby/
|
17
|
+
gst-plugins-good http://gstreamer.freedesktop.org/
|
18
|
+
gst-plugins-ugly http://gstreamer.freedesktop.org/
|
19
|
+
|
20
|
+
For other format suppport (ie: mp3,wav), check gstreamer plug-ins:
|
21
|
+
gst-plugins-* http://gstreamer.freedesktop.org/
|
22
|
+
|
23
|
+
|
24
|
+
You can use check the dependencies by running (after running the configure script):
|
25
|
+
make check-depend
|
26
|
+
|
27
|
+
#***Installation.
|
28
|
+
You can use the usual ./configure && make && make install.
|
29
|
+
#Unpack the tarball.
|
30
|
+
tar xvzf ZiK-version.tar.gz
|
31
|
+
#Go to the source directory.
|
32
|
+
cd ZiK-version
|
33
|
+
#Configure.
|
34
|
+
./configure
|
35
|
+
#Compile.
|
36
|
+
make
|
37
|
+
#Install as superuser if needed.
|
38
|
+
make install
|
39
|
+
For more options see INSTALL file.
|
40
|
+
|
41
|
+
#***Uninstallation.
|
42
|
+
make uninstall
|
43
|
+
|
44
|
+
#***website
|
45
|
+
http://zik.rubyforge.org/
|
46
|
+
|
47
|
+
#***Thanks.
|
48
|
+
My thanks to all ruby programmers and documentation writers.
|
49
|
+
Thanks to the T1000-tag project who allows ZiK to use its musicip id.
|
50
|
+
I also thank:
|
51
|
+
Draco, Mouine89, l e . n o x, mathieuI who test the development (git) version.
|
52
|
+
http://www.developpez.net/forums menbers for theirs help.
|
53
|
+
All ubuntu users and especially the unbuntu-fr community.
|
data/ZiK.desktop
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
[Desktop Entry]
|
2
|
+
Name=ZiK
|
3
|
+
GenericName=Audio player
|
4
|
+
GenericName[fr]=Lecteur audio
|
5
|
+
Icon=
|
6
|
+
Categories=GTK;AudioVideo;Audio;
|
7
|
+
Type=Application
|
8
|
+
Terminal=false
|
9
|
+
TryExec=
|
10
|
+
Exec=
|
11
|
+
MimeType=audio/ogg;audio/x-vorbis+ogg;audio/mp4;audio/x-flac+ogg;audio/x-flac;audio/mpeg;audio/x-mpegurl;audio/x-ms-asx;audio/x-ms-wma;audio/x-wav;x-content/audio-cdda;audio/x-scpls;application/xspf+xml;
|
data/ZiK.rb
ADDED
@@ -0,0 +1,377 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
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='version'
|
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=File.dirname(__FILE__)
|
103
|
+
Pix_dir=File.join(Data_dir,'pix')
|
104
|
+
Doc_dir=File.join(Data_dir,'doc')
|
105
|
+
Locale_dir=File.join(Data_dir,'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.")
|
data/configure
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
|
3
|
+
ERROR=0
|
4
|
+
WARNING=0
|
5
|
+
|
6
|
+
#***************Help************************
|
7
|
+
usage(){
|
8
|
+
echo "Usage:"
|
9
|
+
echo "configure --option1=value1 --option2=value2"
|
10
|
+
echo "See INSTALL file for valid options"
|
11
|
+
}
|
12
|
+
|
13
|
+
if test "$1" = '--help'
|
14
|
+
then
|
15
|
+
usage
|
16
|
+
exit 0
|
17
|
+
fi
|
18
|
+
|
19
|
+
if test "$1" = '-h'
|
20
|
+
then
|
21
|
+
usage
|
22
|
+
exit 0
|
23
|
+
fi
|
24
|
+
|
25
|
+
#***************Parse options***************
|
26
|
+
echo 'Parsing options.'
|
27
|
+
SRCDIR=''
|
28
|
+
OPTIONS=''
|
29
|
+
|
30
|
+
until test -z "$1"
|
31
|
+
do
|
32
|
+
case "$1" in
|
33
|
+
--srcdir=*)
|
34
|
+
SRCDIR=`expr "$1" : '--srcdir\=\(.*\)'`;;
|
35
|
+
--srcdir)
|
36
|
+
SRCDIR="$2";shift;;
|
37
|
+
--destdir)
|
38
|
+
DESTDIR="$2";shift;;
|
39
|
+
--destdir=*)
|
40
|
+
DESTDIR=`expr "$1" : '--destdir\=\(.*\)'`;;
|
41
|
+
--prefix=*)
|
42
|
+
PREFIX=`expr "$1" : '--prefix\=\(.*\)'`;OPTIONS="$OPTIONS PREFIX";;
|
43
|
+
--prefix)
|
44
|
+
PREFIX="$2";shift;OPTIONS="$OPTIONS PREFIX";;
|
45
|
+
--bindir=*)
|
46
|
+
BINDIR=`expr "$1" : '--bindir\=\(.*\)'`;OPTIONS="$OPTIONS BINDIR";;
|
47
|
+
--bindir)
|
48
|
+
BINDIR="$2";shift;OPTIONS="$OPTIONS BINDIR";;
|
49
|
+
--datadir=*)
|
50
|
+
DATADIR=`expr "$1" : '--datadir\=\(.*\)'`;OPTIONS="$OPTIONS DATADIR";;
|
51
|
+
--datadir)
|
52
|
+
DATADIR="$2";shift;OPTIONS="$OPTIONS DATADIR";;
|
53
|
+
--docdir=*)
|
54
|
+
DOCDIR=`expr "$1" : '--docdir\=\(.*\)'`;OPTIONS="$OPTIONS DOCDIR";;
|
55
|
+
--docdir)
|
56
|
+
DOCDIR="$2";shift;OPTIONS="$OPTIONS DOCDIR";;
|
57
|
+
--localedir=*)
|
58
|
+
LOCALEDIR=`expr "$1" : '--localedir\=\(.*\)'`;OPTIONS="$OPTIONS LOCALEDIR";;
|
59
|
+
--localedir)
|
60
|
+
LOCALEDIR="$2";shift;OPTIONS="$OPTIONS LOCALEDIR";;
|
61
|
+
#MODULE can be added several times to OPTION. CHANGE THIS
|
62
|
+
--module-trayicon)
|
63
|
+
MODULE="$MODULE install-module-trayicon";OPTIONS="$OPTIONS MODULE";;
|
64
|
+
--module-notify)
|
65
|
+
MODULE="$MODULE install-module-notify";OPTIONS="$OPTIONS MODULE";;
|
66
|
+
--module-cover)
|
67
|
+
MODULE="$MODULE install-module-cover";OPTIONS="$OPTIONS MODULE";;
|
68
|
+
--module-hotkeys)
|
69
|
+
MODULE="$MODULE install-module-hotkeys";OPTIONS="$OPTIONS MODULE";;
|
70
|
+
--module-brainz)
|
71
|
+
MODULE="$MODULE install-module-brainz";OPTIONS="$OPTIONS MODULE";;
|
72
|
+
--module-none)
|
73
|
+
MODULE='';OPTIONS="$OPTIONS MODULE";;
|
74
|
+
# --lang=*)
|
75
|
+
# check for po and html support;;
|
76
|
+
--lang-none)
|
77
|
+
LANG='';HTMLLANG='';OPTIONS="$OPTIONS LANG";;
|
78
|
+
*)
|
79
|
+
echo "ERROR: unknown option."; usage; exit 1;;
|
80
|
+
esac
|
81
|
+
shift
|
82
|
+
done
|
83
|
+
|
84
|
+
#***************Check programs needed to build***************
|
85
|
+
echo 'Checking programs needed to build ZiK.'
|
86
|
+
if sed --version 1> /dev/null 2>&1
|
87
|
+
then
|
88
|
+
R="yes"
|
89
|
+
else
|
90
|
+
R="no"
|
91
|
+
ERROR=1
|
92
|
+
fi
|
93
|
+
echo "Check sed..$R"
|
94
|
+
if install --version 1> /dev/null 2>&1
|
95
|
+
then
|
96
|
+
R="yes"
|
97
|
+
else
|
98
|
+
R="no"
|
99
|
+
ERROR=1
|
100
|
+
fi
|
101
|
+
echo "Check install..$R"
|
102
|
+
if /bin/gzip --version 1> /dev/null 2>&1
|
103
|
+
then
|
104
|
+
R="yes"
|
105
|
+
else
|
106
|
+
R="no"
|
107
|
+
ERROR=1
|
108
|
+
fi
|
109
|
+
echo "Check /bin/gzip..$R"
|
110
|
+
if make --version 1> /dev/null 2>&1
|
111
|
+
then
|
112
|
+
R="yes"
|
113
|
+
else
|
114
|
+
R="no"
|
115
|
+
ERROR=1
|
116
|
+
fi
|
117
|
+
echo "Check make..$R"
|
118
|
+
|
119
|
+
if desktop-file-install --help 1> /dev/null 2>&1
|
120
|
+
then
|
121
|
+
R="yes"
|
122
|
+
else
|
123
|
+
R="no"
|
124
|
+
ERROR=1
|
125
|
+
fi
|
126
|
+
echo "Check desktop-file-install..$R"
|
127
|
+
|
128
|
+
if test "$ERROR" -gt 0
|
129
|
+
then
|
130
|
+
echo "Error: install missing programs."
|
131
|
+
exit 1
|
132
|
+
fi
|
133
|
+
|
134
|
+
#***************Guess sources directory**************************
|
135
|
+
absolute_path(){
|
136
|
+
p=`expr "$1" : '\/\(.*\)'`
|
137
|
+
if test -z "$p"
|
138
|
+
then
|
139
|
+
echo "ERROR: $2 have to be an absolute path"
|
140
|
+
exit 1
|
141
|
+
fi
|
142
|
+
}
|
143
|
+
strip_final_slash(){
|
144
|
+
p=`expr "$1" : '\(.*\)\/$'`
|
145
|
+
if test -n "$p"
|
146
|
+
then
|
147
|
+
eval "$2=\$p"
|
148
|
+
echo "WARNING: $2 is set to $p."
|
149
|
+
WARNING=1
|
150
|
+
fi
|
151
|
+
}
|
152
|
+
|
153
|
+
if test -z "$SRCDIR"
|
154
|
+
then
|
155
|
+
echo 'Guessing srcdir.'
|
156
|
+
SRCDIR=`dirname $0`
|
157
|
+
if test $SRCDIR = "."
|
158
|
+
then
|
159
|
+
SRCDIR=`pwd`
|
160
|
+
else
|
161
|
+
pa=`expr "$SRCDIR" : '\/\(.*\)'`
|
162
|
+
if test -z "$pa"
|
163
|
+
then
|
164
|
+
PWD=`pwd`
|
165
|
+
SRCDIR="$PWD/$SRCDIR"
|
166
|
+
fi
|
167
|
+
fi
|
168
|
+
echo "srcdir is set to $SRCDIR"
|
169
|
+
else
|
170
|
+
strip_final_slash $SRCDIR SRCDIR
|
171
|
+
fi
|
172
|
+
|
173
|
+
if ! test -d $SRCDIR
|
174
|
+
then
|
175
|
+
echo "ERROR: srcdir ($SRCDIR) is not a directory."
|
176
|
+
echo "Run the script with --srcdir=/path_to_sources."
|
177
|
+
exit 1
|
178
|
+
fi
|
179
|
+
|
180
|
+
#***************Check options and create config.sed***************
|
181
|
+
#***config.sed is used to modify Makefile.in in order to take account of options
|
182
|
+
echo 'Verify options and writing configuration.'
|
183
|
+
|
184
|
+
if test "$SRCDIR"="."
|
185
|
+
then
|
186
|
+
SED_FILE=config.sed
|
187
|
+
else
|
188
|
+
SED_FILE=$SRCDIR/config.sed
|
189
|
+
fi
|
190
|
+
#Delete old config.sed file.
|
191
|
+
if test -e $SED_FILE
|
192
|
+
then
|
193
|
+
rm -f $SED_FILE
|
194
|
+
fi
|
195
|
+
|
196
|
+
for OPTION in $OPTIONS
|
197
|
+
do
|
198
|
+
case $OPTION in
|
199
|
+
PREFIX)
|
200
|
+
absolute_path $PREFIX prefix; strip_final_slash $PREFIX PREFIX
|
201
|
+
echo "s!^PREFIX\=\/usr\/local!PREFIX\=$PREFIX!" >> $SED_FILE;;
|
202
|
+
BINDIR)
|
203
|
+
absolute_path $BINDIR bindir; strip_final_slash $BINDIR BINDIR
|
204
|
+
echo "s!^BINDIR\=\$(EXEC_PREFIX)\/bin!BINDIR\=$BINDIR!" >> $SED_FILE;;
|
205
|
+
DATADIR)
|
206
|
+
absolute_path $DATADIR datadir; strip_final_slash $DATADIR DATADIR
|
207
|
+
echo "s!^DATADIR\=\$(DATAROOTDIR)!DATADIR\=$DATADIR!" >> $SED_FILE;;
|
208
|
+
DOCDIR)
|
209
|
+
absolute_path $DOCDIR docdir; strip_final_slash $DOCDIR DOCDIR
|
210
|
+
echo "s!^DOCDIR\=\$(DATAROOTDIR)\/doc\/\$(NAME)!DOCDIR\=$DOCDIR!" >> $SED_FILE;;
|
211
|
+
LOCALEDIR)
|
212
|
+
absolute_path $LOCALEDIR localedir; strip_final_slash $LOCALEDIR LOCALEDIR
|
213
|
+
echo "s!^LOCALEDIR\=\$(DATAROOTDIR)\/locale!LOCALEDIR\=$LOCALEDIR!" >> $SED_FILE;;
|
214
|
+
MODULE)
|
215
|
+
echo "s!^TMODULES\=.*!TMODULES\=$MODULE!" >> $SED_FILE;;
|
216
|
+
LANG)
|
217
|
+
echo "s!^LANGUAGES\=.*!LANGUAGES\=$LANG!" >> $SED_FILE;
|
218
|
+
echo "s!^HTMLLANGUAGES\=.*!HTMLLANGUAGES\=$HTMLLANG!" >> $SED_FILE;;
|
219
|
+
esac
|
220
|
+
done
|
221
|
+
|
222
|
+
#***************Improve git version string***************
|
223
|
+
#TODO: use $SRCDIR
|
224
|
+
echo "Checking version."
|
225
|
+
if grep ^VERSION= Makefile.in | grep git 1> /dev/null 2>&1
|
226
|
+
then
|
227
|
+
if GIT_DESCRIPTION=`git describe --tags` 1> /dev/null 2>&1
|
228
|
+
then
|
229
|
+
IN_VERSION=`grep ^VERSION= Makefile.in`
|
230
|
+
echo "s!^VERSION=.*!$IN_VERSION$GIT_DESCRIPTION!" >> $SED_FILE
|
231
|
+
fi
|
232
|
+
fi
|
233
|
+
|
234
|
+
#***************Create Makefile***************
|
235
|
+
echo "Writing Makefile."
|
236
|
+
echo "SRCDIR=$SRCDIR" > $SRCDIR/Makefile
|
237
|
+
if test -n "$DESTDIR"
|
238
|
+
then
|
239
|
+
absolute_path $DESTDIR destdir; strip_final_slash $DESTDIR DESTDIR
|
240
|
+
echo "DESTDIR=$DESTDIR" >> $SRCDIR/Makefile
|
241
|
+
if ! test -d $DESTDIR
|
242
|
+
then
|
243
|
+
echo "ERROR: destdir ($DESTDIR) is not a directory."
|
244
|
+
echo "Create $DESTDIR directory before running this script"
|
245
|
+
exit 1
|
246
|
+
fi
|
247
|
+
fi
|
248
|
+
if test -e $SED_FILE
|
249
|
+
then
|
250
|
+
sed -f $SED_FILE $SRCDIR/Makefile.in >> $SRCDIR/Makefile
|
251
|
+
else
|
252
|
+
cat $SRCDIR/Makefile.in >> $SRCDIR/Makefile
|
253
|
+
fi
|
254
|
+
|
255
|
+
#***************Summary**********************
|
256
|
+
echo 'Configuration done.'
|
257
|
+
echo '========================================'
|
258
|
+
if test -z "$PREFIX"
|
259
|
+
then
|
260
|
+
echo "The Programm will be installed in /usr/local."
|
261
|
+
else
|
262
|
+
echo "The Programm will be installed in $PREFIX."
|
263
|
+
fi
|
264
|
+
if test "$WARNING" -gt 0
|
265
|
+
then
|
266
|
+
echo "There are some warnings."
|
267
|
+
fi
|
268
|
+
echo "To continue type:
|
269
|
+
make"
|