zik 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +222 -0
  3. data/INSTALL +34 -0
  4. data/Makefile.in +199 -0
  5. data/README +53 -0
  6. data/ZiK.desktop +11 -0
  7. data/ZiK.rb +377 -0
  8. data/configure +269 -0
  9. data/dependencies +142 -0
  10. data/doc/COPYING +340 -0
  11. data/doc/ChangeLog +222 -0
  12. data/doc/html/fr/index.html +128 -0
  13. data/doc/html/index.html +126 -0
  14. data/doc/html/pix/ZiK3.png +0 -0
  15. data/doc/html/pix/capture.png +0 -0
  16. data/doc/html/pix/capture_cd.png +0 -0
  17. data/doc/html/pix/capture_compact.png +0 -0
  18. data/doc/html/pix/capture_radio.png +0 -0
  19. data/doc/html/pix/icon.png +0 -0
  20. data/doc/html/pix/logo.png +0 -0
  21. data/doc/html/styles/main.css +47 -0
  22. data/doc/man/manpage.1 +43 -0
  23. data/gui/assistant.rb +133 -0
  24. data/gui/cdgui.rb +54 -0
  25. data/gui/common.rb +56 -0
  26. data/gui/config.rb +120 -0
  27. data/gui/edit.rb +413 -0
  28. data/gui/error.rb +124 -0
  29. data/gui/gui.rb +1383 -0
  30. data/gui/mod.rb +239 -0
  31. data/gui/preference.rb +496 -0
  32. data/gui/progress.rb +50 -0
  33. data/gui/radiogui.rb +404 -0
  34. data/gui/search.rb +249 -0
  35. data/gui/socket.rb +107 -0
  36. data/mod/brainz.rb +76 -0
  37. data/mod/brainz/dialogs.rb +132 -0
  38. data/mod/brainz/functions.rb +55 -0
  39. data/mod/brainz/ofa.rb +76 -0
  40. data/mod/brainz/song.rb +139 -0
  41. data/mod/brainz/widget.rb +34 -0
  42. data/mod/cover.rb +90 -0
  43. data/mod/cover/application-x-cd-image.svg +666 -0
  44. data/mod/cover/config.rb +79 -0
  45. data/mod/cover/configwidget.rb +35 -0
  46. data/mod/cover/widget.rb +147 -0
  47. data/mod/hotkeys.rb +137 -0
  48. data/mod/hotkeys/config.rb +84 -0
  49. data/mod/hotkeys/configwidget.rb +93 -0
  50. data/mod/interact.rb +131 -0
  51. data/mod/interact/configwidget.rb +107 -0
  52. data/mod/interact/interaction.rb +79 -0
  53. data/mod/notify.rb +128 -0
  54. data/mod/notify/config.rb +96 -0
  55. data/mod/notify/configwidget.rb +76 -0
  56. data/mod/notify/window.rb +56 -0
  57. data/mod/trayicon.rb +83 -0
  58. data/mod/trayicon/config.rb +79 -0
  59. data/mod/trayicon/configwidget.rb +35 -0
  60. data/mod/trayicon/icon.rb +99 -0
  61. data/pix/ZiK.svg +78 -0
  62. data/pix/ZiK3.png +0 -0
  63. data/pix/assistant/capture.png +0 -0
  64. data/pix/gtk-directory.svg +287 -0
  65. data/pix/media-cdrom.svg +292 -0
  66. data/pix/network-wireless.svg +429 -0
  67. data/pix/player_play.svg +286 -0
  68. data/pix/sound.svg +244 -0
  69. data/pix/sound_directory.svg +464 -0
  70. data/player/cdplayer.rb +108 -0
  71. data/player/player.rb +132 -0
  72. data/player/radioplayer.rb +124 -0
  73. data/playlist/cdlist.rb +140 -0
  74. data/playlist/common.rb +343 -0
  75. data/playlist/editlist.rb +50 -0
  76. data/playlist/export.rb +108 -0
  77. data/playlist/playlist.rb +143 -0
  78. data/playlist/radiolist.rb +148 -0
  79. data/playlist/song.rb +122 -0
  80. data/po/ZiK.pot +622 -0
  81. data/po/fr/ZiK.po +658 -0
  82. data/zik +2 -0
  83. metadata +265 -0
  84. metadata.gz.sig +0 -0
@@ -0,0 +1,79 @@
1
+ # encoding: UTF-8
2
+ =begin
3
+ Copyright 2007-2011 Vincent Carmona
4
+ vinc4mai@gmail.com
5
+
6
+ This file is part of ZiK.
7
+
8
+ ZiK is free software; you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation; either version 2 of the License, or
11
+ (at your option) any later version.
12
+
13
+ ZiK is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with ZiK; if not, write to the Free Software
20
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ =end
22
+
23
+ module Cover
24
+ class Configuration < Hash
25
+ def initialize(dir)
26
+ @file=File.join(dir,'coverrc')
27
+ default={:hide=>false}
28
+ super
29
+ self.merge!(default)
30
+ if File.exist?(@file)
31
+ read
32
+ else
33
+ ModErrorWarning.new(Cover.mod, "Configuration file not found. Use default configuration.")
34
+ end
35
+ end
36
+
37
+ def read
38
+ begin
39
+ f=File.open(@file,'r')
40
+ array=f.readlines
41
+ array.reject!{|a| a =~ /^#/}
42
+ array.reject!{|a| a =~ /^\n/}
43
+ array.each{|a| a.chomp!}
44
+ array.each{|a|
45
+ l=a.split('=', 2)
46
+ self[l[0].to_sym]=l[1]
47
+ }
48
+ str2value
49
+ ModErrorInfo.new(Cover.mod, "configuration read.")
50
+ rescue
51
+ ModErrorError.new(Cover.mod, "reading configuration file.")
52
+ ensure
53
+ f.close if f
54
+ end
55
+ end
56
+
57
+ def save
58
+ if $write_config
59
+ begin
60
+ dir=File.dirname(@file)
61
+ Dir.mkdir(dir) unless File.exist?(dir)
62
+ f=File.open(@file,'w')
63
+ f.puts '##Configuration file for cover module (ZiK audio player).'
64
+ self.each_pair{|key, value| f.puts "#{key}=#{value}"}
65
+ ModErrorInfo.new(Cover.mod, "Configuration saved.")
66
+ rescue
67
+ ModErrorError.new(Cover.mod, "Writting configuration file.")
68
+ ensure
69
+ f.close if f
70
+ end
71
+ end
72
+ end
73
+
74
+ private
75
+ def str2value
76
+ self[:hide]=="true" ? self[:hide]=true : self[:hide]=false
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: UTF-8
2
+ =begin
3
+ Copyright 2007-2011 Vincent Carmona
4
+ vinc4mai@gmail.com
5
+
6
+ This file is part of ZiK.
7
+
8
+ ZiK is free software; you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation; either version 2 of the License, or
11
+ (at your option) any later version.
12
+
13
+ ZiK is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with ZiK; if not, write to the Free Software
20
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ =end
22
+
23
+ module Cover
24
+ class ConfigWidget < Gtk::Frame
25
+ attr_reader :bhide
26
+
27
+ def initialize(config)
28
+ @bhide=Gtk::CheckButton.new(_("Check to hide cover area when no cover is found."))
29
+ @bhide.active=config[:hide]
30
+
31
+ super(_('Hide'))
32
+ self.add(@bhide)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,147 @@
1
+ # encoding: UTF-8
2
+ =begin
3
+ Copyright 2007-2011 Vincent Carmona
4
+ vinc4mai@gmail.com
5
+
6
+ This file is part of ZiK.
7
+
8
+ ZiK is free software; you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation; either version 2 of the License, or
11
+ (at your option) any later version.
12
+
13
+ ZiK is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with ZiK; if not, write to the Free Software
20
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ =end
22
+
23
+ module Cover
24
+ Encoding=[LATIN1=0, UTF16_LE=1, UTF16_BE=2, UTF8=3]
25
+
26
+ class Widget < Gtk::Table
27
+ attr_reader :mp3info
28
+
29
+ def initialize(dir, zik)
30
+ begin
31
+ require 'mp3info'
32
+ @mp3info=true
33
+ rescue LoadError
34
+ ModErrorLoadError.new(Cover.mod, "ruby-mp3info not found. Covers from tag will not be displayed.")
35
+ @mp3info=false
36
+ end
37
+
38
+ @zik=zik
39
+ @default=File.join(dir, 'cover', 'application-x-cd-image.svg')
40
+ @title=Gtk::Label.new(_('Title: '))
41
+ @artist=Gtk::Label.new(_('Artist: '))
42
+ @album=Gtk::Label.new(_('Album: '))
43
+ @cover=Gtk::Image.new(Gdk::Pixbuf.new(@default, 124, 124))
44
+
45
+ super(5 ,2)
46
+ self.column_spacings=$border
47
+ self.attach(@cover, 0, 1, 0, 5, Gtk::SHRINK, Gtk::SHRINK)
48
+ self.attach(@title, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK)
49
+ self.attach(@artist, 1, 2, 2, 3, Gtk::SHRINK, Gtk::SHRINK)
50
+ self.attach(@album, 1, 2, 3, 4, Gtk::SHRINK, Gtk::SHRINK)
51
+ end
52
+
53
+ def new_song(song)
54
+ case song.type
55
+ when SONG_RADIO
56
+ @title.text=_('Title: '); @artist.text=_('Artist: '); @album.text=_('Album: ')
57
+ false
58
+ when SONG_CD
59
+ update_text(song)
60
+ false
61
+ when SONG_FILE
62
+ update_text(song); tf=find_cover(song)
63
+ @cover.show#Update view
64
+ tf
65
+ end
66
+ end
67
+
68
+ private
69
+
70
+ def update_text(song)
71
+ @title.text=_('Title: ')+song.title
72
+ @artist.text=_('Artist: ')+song.artist
73
+ @album.text=_('Album: ')+song.album
74
+ end
75
+
76
+ def find_cover(song)
77
+ if @mp3info
78
+ begin
79
+ t=Mp3Info.new(song.path)
80
+ if t.hastag2?
81
+ case t.tag2.version
82
+ when '2.3.0', '2.4.0'
83
+ apic=t.tag2['APIC']
84
+ enc=apic.unpack('c')[0]
85
+ case enc
86
+ when LATIN1, UTF8
87
+ pixstr=apic.unpack('c Z* c Z* a*')[4]
88
+ @cover.pixbuf=pixload(pixstr)
89
+ return true
90
+ when UTF16_LE, UTF16_BE
91
+ cp=apic.unpack('c Z* c a*')[3]
92
+ comment, pixstr=cp.split(/\000\000/,2)
93
+ comment+=pixstr.slice!(0, 1) while pixstr[0]==?\000
94
+ @cover.pixbuf=pixload(pixstr)
95
+ return true
96
+ else
97
+ ModErrorError.new(Cover.mod, "Encoding of #{song.path} APIC frame was not found.")
98
+ end
99
+ else
100
+ ModErrorError.new(Cover.mod, "id3v#{t.tag2.version} is not supported")
101
+ end
102
+ else
103
+ ModErrorError.new(Cover.mod, "No id3v2 tag found in #{song.path}.")
104
+ end
105
+ rescue
106
+ ModErrorInfo.new(Cover.mod, "cannot found cover in #{song.path} tag.")
107
+ end
108
+ end
109
+ dir=File.dirname(song.path)
110
+ files=Dir.glob(File.join(dir.gsub(/(?=[{\[\]}*])/, '\\'), '*'))#Error in Dir.glob when file contains [ or ]. str.gsub(/(?=[{\[\]}*])/, '\\') -> escape { [ ] } *
111
+ files.map!{|file| File.basename(file)}
112
+ f=files.grep(/^cover\.(jpg|png)$/i)
113
+ unless f.empty?
114
+ @cover.pixbuf=pixbuf(File.join(dir, f[0]))
115
+ return true
116
+ end
117
+ f=files.grep(/cover.*\.(jpg|png)$/i)
118
+ unless f.empty?
119
+ @cover.pixbuf=pixbuf(File.join(dir, f[0]))
120
+ return true
121
+ end
122
+ f=files.grep(/\.(jpg|png)$/i)
123
+ unless f.empty?
124
+ @cover.pixbuf=pixbuf(File.join(dir, f[0]))
125
+ return true
126
+ end
127
+ @cover.pixbuf=pixbuf(@default)
128
+ false
129
+ end
130
+
131
+ def pixload(pixstr)
132
+ pixloader=Gdk::PixbufLoader.new
133
+ pixloader.signal_connect('size-prepared'){|pixload, width, height|
134
+ pixloader.set_size((width.to_f/height*124).round, 124)
135
+ }
136
+ pixloader.write(pixstr)
137
+ pixloader.close
138
+ pixloader.pixbuf
139
+ end
140
+
141
+ def pixbuf(file)
142
+ #return pixbuf from a file
143
+ format, width, height=Gdk::Pixbuf.get_file_info(file)
144
+ Gdk::Pixbuf.new(file, (width.to_f/height*124).round, 124)
145
+ end
146
+ end
147
+ end
data/mod/hotkeys.rb ADDED
@@ -0,0 +1,137 @@
1
+ # encoding: UTF-8
2
+ =begin
3
+ Copyright 2007-2011 Vincent Carmona
4
+ vinc4mai@gmail.com
5
+
6
+ This file is part of ZiK.
7
+
8
+ ZiK is free software; you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation; either version 2 of the License, or
11
+ (at your option) any later version.
12
+
13
+ ZiK is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with ZiK; if not, write to the Free Software
20
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ =end
22
+
23
+ module Hotkeys
24
+ begin
25
+ Gdk::Keyval::GDK_KEY_VoidSymbol
26
+ rescue NameError
27
+ Gdk::Keyval::GDK_KEY_VoidSymbol=Gdk::Keyval::GDK_VoidSymbol
28
+ end
29
+
30
+ def Hotkeys.mod
31
+ @m||=Mod.new('hotkeys', "HotKeys", _("Set global hotkeys."),
32
+ 'Vincent Carmona <vinc4mai@gmail.com>', 'GPL-2')
33
+ end
34
+
35
+ Hotkeys.mod
36
+ def @m.init(input)
37
+ @rghk=false
38
+ @dir=input[:mod_dir]
39
+ @zik=zik
40
+ require File.join(@dir, 'hotkeys', 'config')
41
+ @config=Configuration.new(input[:config_dir])
42
+ require File.join(@dir, 'hotkeys', 'configwidget')
43
+ end
44
+
45
+ def @m.load
46
+ unless @loaded
47
+ #Some deprecated code to be cleaned
48
+ #Since 0.2.0 rghk is required using the 'globalhotkeys' string
49
+ rghk='globalhotkeys'
50
+ begin
51
+ require rghk
52
+ @rghk=true
53
+
54
+ @kb_prev||=GlobalHotKeys::KeyBinder.new
55
+ @kb_stop||=GlobalHotKeys::KeyBinder.new
56
+ @kb_play||=GlobalHotKeys::KeyBinder.new
57
+ @kb_next||=GlobalHotKeys::KeyBinder.new
58
+ reload(true)
59
+
60
+ ModErrorInfo.new(self, "module loaded.")
61
+ @loaded=true
62
+ rescue LoadError
63
+ if rghk=='globalhotkeys'
64
+ rghk='rghk'
65
+ retry
66
+ else
67
+ ModErrorLoadError.new(self, _("Cannot find rghk. Please install it."))
68
+ @loaded=false
69
+ end
70
+ end
71
+ else
72
+ false
73
+ end
74
+ end
75
+
76
+ def @m.unload
77
+ if @loaded
78
+ [@kb_prev, @kb_stop, @kb_play, @kb_next].each{|kb| kb.unbind}
79
+
80
+ ModErrorInfo.new(self, "module unloaded.")
81
+ @loaded=false
82
+ true
83
+ else
84
+ false
85
+ end
86
+ end
87
+
88
+ def @m.configwidget
89
+ @rghk ? @wconfig=ConfigWidget.new(@config) : Gtk::Label.new(_("Module not loaded. Cannot display configuration."))
90
+ end
91
+
92
+ def @m.saveconfig
93
+ if @rghk
94
+ save_mask([@wconfig.bcprev, @wconfig.bsprev, @wconfig.baprev], :prev_mask)
95
+ save_key(@wconfig.eprev.text, :prev_key)
96
+ save_mask([@wconfig.bcstop, @wconfig.bsstop, @wconfig.bastop], :stop_mask)
97
+ save_key(@wconfig.estop.text, :stop_key)
98
+ save_mask([@wconfig.bcplay, @wconfig.bsplay, @wconfig.baplay], :play_mask)
99
+ save_key(@wconfig.eplay.text, :play_key)
100
+ save_mask([@wconfig.bcnext, @wconfig.bsnext, @wconfig.banext], :next_mask)
101
+ save_key(@wconfig.enext.text, :next_key)
102
+ reload
103
+ end
104
+ end
105
+
106
+ def @m.quit
107
+ @config.save
108
+ end
109
+
110
+ private
111
+
112
+ def @m.reload(force=false)
113
+ if @loaded||force
114
+ [@kb_prev, @kb_stop, @kb_play, @kb_next].each{|kb| kb.unbind}
115
+ @kb_prev.bind(Gdk::Keyval.from_name(@config[:prev_key]), @config[:prev_mask]){@zik.previous_song}
116
+ @kb_stop.bind(Gdk::Keyval.from_name(@config[:stop_key]), @config[:stop_mask]){@zik.stop}
117
+ @kb_play.bind(Gdk::Keyval.from_name(@config[:play_key]), @config[:play_mask]){@zik.playpause}
118
+ @kb_next.bind(Gdk::Keyval.from_name(@config[:next_key]), @config[:next_mask]){@zik.next_song}
119
+ end
120
+ end
121
+
122
+ def @m.save_mask(buttons, sym)
123
+ mask=0
124
+ mask|=GlobalHotKeys::Modifier::CONTROL_MASK if buttons[0].active?
125
+ mask|=GlobalHotKeys::Modifier::SHIFT_MASK if buttons[1].active?
126
+ mask|=GlobalHotKeys::Modifier::MOD1_MASK if buttons[2].active?
127
+ @config[sym]=mask
128
+ end
129
+
130
+ def @m.save_key(key, sym)
131
+ if Gdk::Keyval.from_name(key)==Gdk::Keyval::GDK_KEY_VoidSymbol
132
+ ModErrorError.new(self, "Cannot parse #{key}. Use previous value.")
133
+ else
134
+ @config[sym]=key
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,84 @@
1
+ # encoding: UTF-8
2
+ =begin
3
+ Copyright 2007-2011 Vincent Carmona
4
+ vinc4mai@gmail.com
5
+
6
+ This file is part of ZiK.
7
+
8
+ ZiK is free software; you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation; either version 2 of the License, or
11
+ (at your option) any later version.
12
+
13
+ ZiK is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with ZiK; if not, write to the Free Software
20
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ =end
22
+
23
+ module Hotkeys
24
+ class Configuration < Hash
25
+ def initialize(dir)
26
+ @file=File.join(dir,'hotkeysrc')
27
+ default={:prev_mask=>0, :prev_key=>"F9", :stop_mask=>0, :stop_key=>"F10", :play_mask=>0, :play_key=>"F11",
28
+ :next_mask=>0, :next_key=>"F12"}
29
+ super
30
+ self.merge!(default)
31
+ if File.exist?(@file)
32
+ read
33
+ else
34
+ ModErrorError.new(Hotkeys.mod, "Configuration file not found. Use default configuration.")
35
+ end
36
+ end
37
+
38
+ def read
39
+ begin
40
+ f=File.open(@file,'r')
41
+ array=f.readlines
42
+ array.reject!{|a| a =~ /^#/}
43
+ array.reject!{|a| a =~ /^\n/}
44
+ array.each{|a| a.chomp!}
45
+ array.each{|a|
46
+ l=a.split('=', 2)
47
+ self[l[0].to_sym]=l[1]
48
+ }
49
+ str2val
50
+ ModErrorInfo.new(Hotkeys.mod, "configuration read.")
51
+ rescue
52
+ ModErrorError.new(Hotkeys.mod, "reading configuration file.")
53
+ ensure
54
+ f.close if f
55
+ end
56
+ end
57
+
58
+ def save
59
+ if $write_config
60
+ begin
61
+ dir=File.dirname(@file)
62
+ Dir.mkdir(dir) unless File.exist?(dir)
63
+ f=File.open(@file,'w')
64
+ f.puts '##Configuration file for hotkeys module (ZiK audio player).'
65
+ self.each_pair{|key, value| f.puts "#{key}=#{value}"}
66
+ ModErrorInfo.new(Hotkeys.mod, "configuration saved")
67
+ rescue
68
+ ModErrorError.new(Hotkeys.mod, "writting configuration file.")
69
+ ensure
70
+ f.close if f
71
+ end
72
+ end
73
+ end
74
+
75
+ private
76
+
77
+ def str2val
78
+ self[:prev_mask]=self[:prev_mask].to_i
79
+ self[:stop_mask]=self[:stop_mask].to_i
80
+ self[:play_mask]=self[:play_mask].to_i
81
+ self[:next_mask]=self[:next_mask].to_i
82
+ end
83
+ end
84
+ end