rwdschedule 0.98 → 0.99

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/Readme.txt +226 -400
  2. data/code/01rwdcore/01rwdcore.rb +16 -16
  3. data/code/01rwdcore/jumplinkcommand.rb +26 -0
  4. data/code/01rwdcore/openhelpwindow.rb +26 -26
  5. data/code/01rwdcore/returntomain.rb +8 -8
  6. data/code/01rwdcore/rundocuments.rb +10 -0
  7. data/code/01rwdcore/runeditconfiguration.rb +10 -0
  8. data/code/01rwdcore/runhelpabout.rb +10 -0
  9. data/code/01rwdcore/rwdtinkerversion.rb +12 -13
  10. data/code/01rwdcore/rwdwindowreturn.rb +3 -5
  11. data/code/01rwdcore/selectiontab.rb +9 -0
  12. data/code/01rwdcore/test_cases.rb +81 -98
  13. data/code/01rwdcore/test_harness.rb +8 -10
  14. data/code/01rwdcore/uploadreturns.rb +60 -60
  15. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
  16. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -21
  17. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
  18. data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
  19. data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
  20. data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
  21. data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
  22. data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
  23. data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
  24. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
  25. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
  26. data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
  27. data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
  28. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
  29. data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
  30. data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
  31. data/code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb +11 -0
  32. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
  33. data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
  34. data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
  35. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
  36. data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
  37. data/code/superant.com.schedule/jumplinkupdate.rb +11 -0
  38. data/configuration/language.dist +1 -1
  39. data/configuration/rwdapplicationidentity.dist +2 -2
  40. data/configuration/rwdschedule.dist +2 -2
  41. data/configuration/rwdtinker.dist +3 -3
  42. data/configuration/tinkerwin2variables.dist +1 -1
  43. data/gui/00coreguibegin/applicationguitop.rwd +1 -1
  44. data/gui/frontwindowselectionbegin/selectiontabbegin/selectiontabbegin.rwd +2 -7
  45. data/gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/jumplinkcommands.rwd +15 -0
  46. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/70rwddiagnostics.rwd +0 -17
  47. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m01menubegin.rwd +12 -4
  48. data/gui/tinkerbackwindows/superant.com.rwdschedulesback/m01menubegin.rwd +12 -4
  49. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/81jumplinkcommands.rwd +17 -0
  50. data/init.rb +228 -228
  51. data/rwd_files/HowTo_Schedule.txt +6 -0
  52. data/rwd_files/HowTo_Tinker.txt +11 -0
  53. data/rwdconfig.dist +4 -2
  54. data/tests/makedist.rb +36 -7
  55. metadata +12 -36
  56. data/extras/cmdline_parse +0 -47
  57. data/extras/config_file +0 -69
  58. data/extras/errorMsg +0 -19
  59. data/extras/makePlaylist +0 -34
  60. data/extras/mp3controld +0 -289
  61. data/extras/playlist +0 -186
  62. data/extras/showHelp +0 -18
  63. data/gui/frontwindow0/superant.com.zmenus/m01menubegin.rwd +0 -10
  64. data/gui/frontwindow0/superant.com.zmenus/m02menu.rwd +0 -36
  65. data/gui/frontwindow0/superant.com.zmenus/m03menu.rwd +0 -15
  66. data/gui/frontwindow0/superant.com.zmenus/m85menu.rwd +0 -21
  67. data/gui/frontwindow0/superant.com.zmenus/m88menu.rwd +0 -12
  68. data/gui/frontwindow0/superant.com.zmenus/m99menuend.rwd +0 -3
  69. data/gui/frontwindowselections/superant.com.rwdscheduleselectiontab/rwdschedulessyncselectiontab.rwd +0 -12
  70. data/gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/rwdwin2selectiontab.rwd +0 -12
  71. data/gui/frontwindowselections/superant.com.schedulebackselection/rwdscheduleiscselectiontab.rwd +0 -12
  72. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m02menu.rwd +0 -36
  73. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m03menu.rwd +0 -11
  74. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m85menu.rwd +0 -21
  75. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m88menu.rwd +0 -12
  76. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m99menuend.rwd +0 -3
  77. data/gui/tinkerbackwindows/superant.com.rwdschedulesback/m02menu.rwd +0 -36
  78. data/gui/tinkerbackwindows/superant.com.rwdschedulesback/m03menu.rwd +0 -12
  79. data/gui/tinkerbackwindows/superant.com.rwdschedulesback/m85menu.rwd +0 -21
  80. data/gui/tinkerbackwindows/superant.com.rwdschedulesback/m88menu.rwd +0 -12
  81. data/gui/tinkerbackwindows/superant.com.rwdschedulesback/m99menuend.rwd +0 -3
  82. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/80tab1.rwd +0 -11
  83. data/tests/rwdtinkertestEN.rb +0 -163
  84. data/tests/test.result +0 -32
@@ -154,6 +154,12 @@ Steven Gibson
154
154
  steven@superant.com
155
155
 
156
156
  == Changelog
157
+ Version 0.99
158
+ updated for rwdtinker version 1.64
159
+ changed handling of application name returned
160
+ added jump seletion options
161
+ added some unit tests
162
+
157
163
  version 0.98
158
164
  updated for rwdtinker version 1.61
159
165
  add in test harness
@@ -227,6 +227,17 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
227
227
  Thanks, Steven Gibson
228
228
 
229
229
  == Changelog
230
+ Version 1.63
231
+ changed handling of application name returned
232
+ added jump seletion options
233
+ added some unit tests
234
+
235
+ version 1.62
236
+ improve distro release script
237
+ code cleanup
238
+ removed redundent network code
239
+ change handling of window and tab jumps
240
+
230
241
  version 1.61
231
242
  add in test harness
232
243
  rwdtinkerwin2 help about removed
data/rwdconfig.dist CHANGED
@@ -1,4 +1,4 @@
1
- ##VERSION:1.61
1
+ ##VERSION:1.63
2
2
  # rwdtinker core configuration file
3
3
  ##NAME: ConfigLocation:0
4
4
  ConfigLocation=""
@@ -7,4 +7,6 @@ ConfigLocation=""
7
7
  ##NAME:$testharnessarray:0
8
8
  $testharnessarray = ["rwdtinker_all_tests"]
9
9
  ##NAME:TestNow:0
10
- TestNow=false
10
+ TestNow=false # turning this on will run the unit tests
11
+ ##NAME:$testharness:0
12
+ $testharness=true
data/tests/makedist.rb CHANGED
@@ -4,26 +4,55 @@
4
4
  #* Copyright (c) 2004, 2005 by Steven Gibson. All Rights Reserved.
5
5
  #* at "steven@superant.com".
6
6
  #***********************************************************************/
7
-
7
+ $progdir =""
8
8
  require 'fileutils'
9
- load 'configuration/rwdschedule.dist'
9
+ DistroName = "rwdschedule"
10
+ load "configuration/#{DistroName}.dist"
11
+ DistroVersion=RwdScheduleVersion
12
+
13
+ DistroTitle="#{DistroName}-#{DistroVersion}"
14
+
15
+
10
16
 
11
17
  $progdir = File::expand_path( File.dirname(__FILE__))
12
18
  results = " "
13
- puts "creating rwdschedule distribution files version #{RwdScheduleVersion}"
19
+
20
+ puts "creating #{DistroName} distribution files version #{DistroVersion}"
14
21
  puts "cleaning conf files"
15
22
  `tests/cleancnf.sh`
16
23
  puts "moving up one directory"
17
24
  Dir.chdir("..")
18
25
 
19
- zipcreatecmd = "zip -r rwdschedule-#{RwdScheduleVersion}.zip rwdschedule"
26
+
27
+
28
+ FileUtils.rm_rf("#{DistroTitle}.zip")
29
+ zipcreatecmd = "zip -r #{DistroTitle}.zip #{DistroName}"
20
30
  puts "#{zipcreatecmd}"
21
31
  `#{zipcreatecmd}`
22
- tarcreatecmd = "tar --gzip -cf rwdschedule-#{RwdScheduleVersion}.tar.gz rwdschedule"
32
+ tarcreatecmd = "tar --gzip -cf #{DistroTitle}.tar.gz #{DistroName}"
23
33
  puts "#{tarcreatecmd}"
24
34
  `#{tarcreatecmd}`
25
- tarcreatecmd2 = "tar --bzip2 -cf rwdschedule-#{RwdScheduleVersion}.tar.bz2 rwdschedule"
35
+ tarcreatecmd2 = "tar --bzip2 -cf #{DistroTitle}.tar.bz2 #{DistroName}"
26
36
  puts "#{tarcreatecmd2}"
27
37
  `#{tarcreatecmd2}`
28
38
 
29
- print Dir["rwdschedule*.{gz,bz2,deb,gem}"]
39
+ gemspecfilename = "#{DistroTitle}.gemspec"
40
+ tobject = Time.now
41
+ year = tobject.year.to_s
42
+ month = tobject.mon.to_s
43
+ daydate = tobject.day.to_s
44
+
45
+ fd = File.open(gemspecfilename,"w")
46
+ fd.print("Gem::Specification.new do |s|\n")
47
+ fd.print(" s.name = %q{#{DistroName}}\n")
48
+ fd.print(" s.version = \"#{DistroVersion}\"\n")
49
+ fd.print(" s.date = %q{#{year}-#{month}-#{daydate}}")
50
+ load "#{DistroName}/tests/gemspec"
51
+ fd.print($gemspecvar)
52
+ fd.close
53
+
54
+ ListingCommand = "ls -1 -s -h #{DistroTitle}*"
55
+
56
+ puts `#{ListingCommand}`
57
+
58
+ print "Build finished\n"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: rwdschedule
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.98"
7
- date: 2005-03-23
6
+ version: "0.99"
7
+ date: 2005-04-04
8
8
  summary: rwdschedule is an calendar application using rwdtinker and RubyWebDialogs.
9
9
  require_paths:
10
10
  - "."
@@ -38,6 +38,11 @@ files:
38
38
  - code/01rwdcore/uploadreturns.rb
39
39
  - code/01rwdcore/test_cases.rb
40
40
  - code/01rwdcore/test_harness.rb
41
+ - code/01rwdcore/jumplinkcommand.rb
42
+ - code/01rwdcore/selectiontab.rb
43
+ - code/01rwdcore/rundocuments.rb
44
+ - code/01rwdcore/runhelpabout.rb
45
+ - code/01rwdcore/runeditconfiguration.rb
41
46
  - code/superant.com.rwdtinkerbackwindow/controlclient.rb
42
47
  - code/superant.com.rwdtinkerbackwindow/diagnostictab.rb
43
48
  - code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb
@@ -60,6 +65,7 @@ files:
60
65
  - code/superant.com.rwdtinkerbackwindow/remotegemlist.rb
61
66
  - code/superant.com.rwdtinkerbackwindow/installremotegem.rb
62
67
  - code/superant.com.rwdtinkerbackwindow/listgemzips.rb
68
+ - code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb
63
69
  - code/zz0applicationend/zz0end.rb
64
70
  - code/superant.com.rwdcalendar/gh9calendar.rb
65
71
  - code/superant.com.schedule/archiveevent.rb
@@ -93,6 +99,7 @@ files:
93
99
  - code/superant.com.schedule/deleteicseventrecord.rb
94
100
  - code/superant.com.schedule/renameicseventdata.rb
95
101
  - code/superant.com.schedule/exporticseventrecord.rb
102
+ - code/superant.com.schedule/jumplinkupdate.rb
96
103
  - configuration/tinkerwin2variables.dist
97
104
  - configuration/rwdtinker.dist
98
105
  - configuration/language.dist
@@ -100,14 +107,6 @@ files:
100
107
  - configuration/rwdcalendar.dist
101
108
  - configuration/rwdschedule.dist
102
109
  - extras/zip
103
- - extras/cmdline_parse
104
- - extras/config_file
105
- - extras/errorMsg
106
- - extras/makePlaylist
107
- - extras/mp3controld
108
- - extras/playlist
109
- - extras/plugins
110
- - extras/showHelp
111
110
  - extras/rconftool.rb
112
111
  - extras/icalendar
113
112
  - extras/cal.rb
@@ -140,24 +139,13 @@ files:
140
139
  - gui/00coreguibegin/applicationguitop.rwd
141
140
  - gui/frontwindow0/superant.com.rwdschedules
142
141
  - gui/frontwindow0/superant.com.tinkercalendar
143
- - gui/frontwindow0/superant.com.zmenus
144
142
  - gui/frontwindow0/superant.com.rwdschedules/gg0viewevent.rwd
145
143
  - gui/frontwindow0/superant.com.rwdschedules/gl6editrecord.rwd
146
144
  - gui/frontwindow0/superant.com.rwdschedules/gl8contactutilities.rwd
147
145
  - gui/frontwindow0/superant.com.tinkercalendar/hl9calendar.rwd
148
- - gui/frontwindow0/superant.com.zmenus/m01menubegin.rwd
149
- - gui/frontwindow0/superant.com.zmenus/m02menu.rwd
150
- - gui/frontwindow0/superant.com.zmenus/m03menu.rwd
151
- - gui/frontwindow0/superant.com.zmenus/m85menu.rwd
152
- - gui/frontwindow0/superant.com.zmenus/m88menu.rwd
153
- - gui/frontwindow0/superant.com.zmenus/m99menuend.rwd
154
146
  - gui/frontwindowselectionbegin/selectiontabbegin/selectiontabbegin.rwd
155
147
  - gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab
156
- - gui/frontwindowselections/superant.com.rwdscheduleselectiontab
157
- - gui/frontwindowselections/superant.com.schedulebackselection
158
- - gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/rwdwin2selectiontab.rwd
159
- - gui/frontwindowselections/superant.com.rwdscheduleselectiontab/rwdschedulessyncselectiontab.rwd
160
- - gui/frontwindowselections/superant.com.schedulebackselection/rwdscheduleiscselectiontab.rwd
148
+ - gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/jumplinkcommands.rwd
161
149
  - gui/frontwindowselectionzend/viewselectionzend/viewselectionend.rwd
162
150
  - gui/frontwindowtdocumentbegin/superant.com.documentsbegin
163
151
  - gui/frontwindowtdocumentbegin/superant.com.documentsbegin/tt0documentbegin.rwd
@@ -192,9 +180,9 @@ files:
192
180
  - gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd
193
181
  - gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd
194
182
  - gui/tinkerbackwindows/superant.com.tinkerbackwindow/75rwdcontrol.rwd
195
- - gui/tinkerbackwindows/superant.com.tinkerbackwindow/80tab1.rwd
196
183
  - gui/tinkerbackwindows/superant.com.tinkerbackwindow/9backend.rwd
197
184
  - gui/tinkerbackwindows/superant.com.tinkerbackwindow/45installremotezip.rwd
185
+ - gui/tinkerbackwindows/superant.com.tinkerbackwindow/81jumplinkcommands.rwd
198
186
  - gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd
199
187
  - gui/tinkerbackwindows/superant.com.tinkerhelpwindow/9end.rwd
200
188
  - gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd
@@ -203,11 +191,6 @@ files:
203
191
  - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/67viewconfiguration.rwd
204
192
  - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/70rwddiagnostics.rwd
205
193
  - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m01menubegin.rwd
206
- - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m02menu.rwd
207
- - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m03menu.rwd
208
- - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m85menu.rwd
209
- - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m88menu.rwd
210
- - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/m99menuend.rwd
211
194
  - gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/zvbackend.rwd
212
195
  - gui/tinkerbackwindows/superant.com.rwdschedulesback/40editrecord.rwd
213
196
  - gui/tinkerbackwindows/superant.com.rwdschedulesback/30viewevent.rwd
@@ -215,11 +198,6 @@ files:
215
198
  - gui/tinkerbackwindows/superant.com.rwdschedulesback/1appname.rwd
216
199
  - gui/tinkerbackwindows/superant.com.rwdschedulesback/zvbackend.rwd
217
200
  - gui/tinkerbackwindows/superant.com.rwdschedulesback/m01menubegin.rwd
218
- - gui/tinkerbackwindows/superant.com.rwdschedulesback/m02menu.rwd
219
- - gui/tinkerbackwindows/superant.com.rwdschedulesback/m03menu.rwd
220
- - gui/tinkerbackwindows/superant.com.rwdschedulesback/m85menu.rwd
221
- - gui/tinkerbackwindows/superant.com.rwdschedulesback/m88menu.rwd
222
- - gui/tinkerbackwindows/superant.com.rwdschedulesback/m99menuend.rwd
223
201
  - gui/zzcoreguiend/tinkerapplicationguiend/yy9rwdend.rwd
224
202
  - installed/rwdviewlogo-0.4.inf
225
203
  - rwd_files/favicon.ico
@@ -232,16 +210,14 @@ files:
232
210
  - rwd_files/tinker.png
233
211
  - rwd_files/HowTo_Schedule.txt
234
212
  - zips/rwdahelloworld-0.5.zip
235
- - tests/rwdtinkertestEN.rb
236
- - tests/test.result
237
213
  - tests/totranslate.lang
238
214
  - tests/cleancnf.sh
239
215
  - tests/rdep.rb
240
216
  - tests/checkdepends.sh
241
217
  - tests/makedist.rb
242
- - Readme.txt
243
218
  - init.rb
244
219
  - rwdconfig.dist
220
+ - Readme.txt
245
221
  test_files: []
246
222
  rdoc_options:
247
223
  - "--main"
data/extras/cmdline_parse DELETED
@@ -1,47 +0,0 @@
1
- #!/usr/bin/ruby
2
- # --- Parse command line ---
3
- #
4
- # Author: Magnus Engstr�m
5
- # Email: magnus@gisab.se
6
- # File: cmdline_parse
7
- #
8
- # Description
9
- # -----------
10
- # Parses the commandline and
11
- # returns a hash with the
12
- # switch as key and the
13
- # value as value :)
14
- # --------------------------
15
-
16
- class Commandline
17
- def Commandline::parse()
18
-
19
- params = Hash::new() # Could be useful to have something to put the commandline in ;)
20
- key = false # Just a really ugly hack to keep track on if we're reading key or value
21
- foo = '' # Keeps the key name
22
-
23
- # Iterate through the command line ($*) and put it in the params hash
24
- $*.each { |param|
25
- key = ( key == true ? false : true ) # Negate the value of key
26
- if(key)
27
- foo = param
28
- else
29
- params[foo] = param
30
- end
31
- }
32
-
33
- # Validate the command line.
34
- # Every key should begin with at least one '-' and have a value
35
- if( !key ) # If key equals true, then the user should enter one more parameter
36
- passed = true
37
- params.each { |key, value| # Iterate through all parameters
38
- passed = false if(key[0].chr() != '-') # Doesn't it start with a '-'? Not passed...
39
- passed = false if(value == '') # I really want a value here, not just an empty string
40
- }
41
- end
42
-
43
- # Return params if check passed, else return -1
44
- passed ? params : -1
45
-
46
- end
47
- end
data/extras/config_file DELETED
@@ -1,69 +0,0 @@
1
- #!ruby
2
- require 'ftools'
3
- require 'tempfile'
4
-
5
- class ConfigFile
6
-
7
- def ConfigFile::parse(filename)
8
- # Make sure this file exists and is readable
9
- if( FileTest::readable_real?(filename) )
10
- new(filename) # Return the class instance
11
- else
12
- -1 # Return -1 on failure
13
- end
14
- end
15
-
16
- def initialize(filename)
17
- @filename = filename
18
- @config = Hash::new() # The class internal variable that holds the config data
19
- section = ''
20
-
21
- # Parse the configuration file (and in only TWO rows, God I love Ruby! =)
22
- IO::foreach(@filename) { |configLine| @config[section = $1] = Hash::new() if(configLine.gsub(/\s*#.*$/, '') =~ /\s*(\S+)\s*\{/)
23
- @config[section].update({$1 => $2}) if(configLine.gsub(/\s*#.*$/, '') =~ /\s*(\S+)\s*=\s*(.*)/) }
24
- end
25
-
26
- # Return the requested parameter
27
- def getParam(section, parameter)
28
- @config[section][parameter] if(@config[section].type == Hash)
29
- end
30
-
31
- # Set the provided parameter
32
- def setParam(section, parameter, value)
33
- # Create a temp file
34
- temp = Tempfile::new('config')
35
-
36
- current_section = ''
37
- # Loop through the config file
38
- IO::foreach(@filename) { |line|
39
- current_section = $1 if( line =~ /^\s*(\S+)\s*{\s*(#.*)?$/ ) # Handle the section stuff
40
- # Is this a correct parameter entry?
41
- if( line =~ /^\s*(\S+)\s*=\s*\S+\s*(#.*)?$/ )
42
-
43
- if( current_section == section && $1 == parameter ) # This is the line we want to change!
44
- line.gsub!( /^(\s*\S+\s*=\s*)\S+(\s*(#.*)?)$/, "\\1#{value}\\2" ) # Change the parameter value to the one the user supplied
45
- end
46
-
47
- end
48
-
49
- temp.puts(line) # Write the line to the tempfile
50
- }
51
-
52
- temp.close() # Close the file
53
- File::copy(temp.path, @filename) # Copy the tempfile to overwrite the old one
54
- temp.close(true) # Remove the file
55
- end
56
-
57
- # Loop through all sections
58
- def each_section()
59
- @config.each { |key,value| yield(key) }
60
- end
61
-
62
- # Loop through all parameters in a section
63
- def each_parameter(section)
64
- @config[section].each { |key,value| yield(key) }
65
- end
66
-
67
- attr_reader :filename
68
-
69
- end
data/extras/errorMsg DELETED
@@ -1,19 +0,0 @@
1
- #!ruby
2
-
3
- # --- errorMsg ---
4
- #
5
- # Author: Magnus Engstr�m
6
- # Email: magnus@gisab.se
7
- # File: errorWrite
8
- #
9
- # Description
10
- # -----------
11
- # Outputs an error message to the administrator
12
- # ------------------
13
-
14
- def errorMsg(message, exitapp = false)
15
- STDERR.puts(message)
16
- MP3Control::exit_mpg123() if(exitapp)
17
- Kernel::exit(exitapp) if(exitapp) # Terminate application and return the exitapp value if it isn't falsew
18
-
19
- end
data/extras/makePlaylist DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/ruby
2
- require 'mp3tag'
3
-
4
- def getList(dir)
5
- Dir::chdir(dir)
6
-
7
- # Find the files in this directory
8
- Dir['*mp3'].each { |file|
9
- if(FileTest::file?(file))
10
- mp3tag = Mp3Tag::new(Dir::getwd()+"/"+file)
11
- if(mp3tag.songname.length > 0)
12
- puts("#{Dir::getwd()+"/"+file}||#{mp3tag.songname}||#{mp3tag.artist}||#{mp3tag.album}||#{mp3tag.year}||#{mp3tag.comment}||#{mp3tag.tracknum}||#{mp3tag.genre_id}||#{mp3tag.genre}")
13
- else
14
- name = Dir::getwd()+"/"+file
15
- name =~ /([^\/]+)\.mp3$/
16
- puts("#{Dir::getwd()+"/"+file}||#{$1}||#{mp3tag.artist}||#{mp3tag.album}||#{mp3tag.year}||#{mp3tag.comment}||#{mp3tag.tracknum}||#{mp3tag.genre_id}||#{mp3tag.genre}")
17
- end
18
- end
19
- }
20
-
21
- Dir['*'].each { |entry|
22
- if(FileTest::directory?(entry))
23
- getList(entry)
24
- end
25
- }
26
- Dir::chdir('..')
27
- end
28
-
29
- # Change current directory to user supplied one
30
- Dir::chdir(ARGV[0])
31
- getList(ARGV[0])
32
-
33
- #song = Mp3Tag::new(ARGV[0])
34
- #puts song.songname()
data/extras/mp3controld DELETED
@@ -1,289 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- # --- MP3 Control ---
4
- #
5
- # Author: Magnus Engstr�m
6
- # Email: magnus@gisab.se
7
- # File: mp3controld
8
- #
9
- # Description
10
- # -----------
11
- # An application which manages
12
- # mp3 songs on the poor users
13
- # computer.
14
- # -------------------------
15
-
16
- # --- External files ---
17
- # Change directory to find all functions
18
- #Dir::chdir("/usr/lib/mp3control")
19
-
20
- load "extras/config_file" # Handles the mp3controld.conf configuration file
21
- load "extras/cmdline_parse" # Provides the Commandline::parse which returns an hash of the commandline
22
- load "extras/showHelp" # Hmmm... guess what? This function shows the help message =)
23
- load "extras/errorMsg" # Outputs error messages to the admin
24
- load "extras/playlist" # Core playlist functionality
25
-
26
- # --- MP3Control - the main class ---
27
- class MP3Control
28
- # --- Core functions ---
29
- # initialize() reads the config files and daemonizes!
30
- def initialize()
31
- # Parse the commandline
32
- $commandline = Commandline::parse()
33
-
34
- # Display help if the commandline sucks
35
- if($commandline == -1)
36
- showHelp()
37
- Kernel::exit(-1)
38
- end
39
-
40
- # Make this class instance a background daemon
41
- daemonize() if($commandline["--daemon"] != 'no' && $commandline["-D"] != 'no')
42
-
43
- # Read the configuration file
44
- configfile = ( $commandline["--configfile"] ? $commandline["--configfile"] : 'configuration/mp3controld.conf' ) # Use the --configfile if supplied, else use the default /etc/mp3controld/mp3controld.conf
45
- $configFile = ConfigFile::parse(configfile) # Create an new config file object
46
- errorMsg("Configuration file #{configfile} isn't readable or doesn't exist!", 137) if($configFile == -1)
47
-
48
- # Find the default playlist (or use the user supplied one from the commandline)
49
- defaultPlaylist = $configFile.getParam("programConfig", "defaultPlaylist")
50
- defaultPlaylist = $commandline["--playlist"] if($commandline["--playlist"])
51
- if( $configFile.getParam(defaultPlaylist, 'listFile').type == String) # Make sure the listFile contains a value
52
- if(FileTest.readable_real?( $configFile.getParam(defaultPlaylist, 'listFile') )) # Make sure this file is readable
53
- # Cool. Everything looks alright. Lets create a playlist!
54
- errorMsg("Loading playlist '#{defaultPlaylist}' from #{$configFile.getParam(defaultPlaylist, 'listFile')}...") if($commandline['--verbose'] == 'on')
55
- $current_playlist = Playlist::create_from_file($configFile.getParam(defaultPlaylist, 'listFile'))
56
- $current_playlist_name = defaultPlaylist
57
-
58
- # Errorhandling
59
- errorMsg("Playlist creation from #{$current_playlist.filename} failed.", 1) if($current_playlist == -1) # Quit and complain if it didn't work
60
- errorMsg("Playlist #{defaultPlaylist} (#{$current_playlist.filename}) doesn't contain any entries.", 1) if($current_playlist.length() < 1)
61
- errorMsg("Playlist '#{defaultPlaylist}' loaded successfully.") if($commandline["--verbose"] == 'on')
62
-
63
- # Fix wrap/repeat and shuffle the playlist if the configfile says so
64
- $current_playlist.wrap = true if($configFile.getParam(defaultPlaylist, 'repeat') == 'true')
65
- $current_playlist.shuffle() if($configFile.getParam(defaultPlaylist, 'random') == 'true')
66
- $current_playlist.goto(0) # Rewind the playlist
67
- else
68
- errorMsg("The default playlist doesn't appear to exist, or has the wrong permissions. That's not good.", 1)
69
- end
70
- else # listFile returns other than string, that's baaaaad
71
- errorMsg("the listFile value for '#{defaultPlaylist}' doesn't appear to exist in your #{$configFile.filename}. That's not good.", 1)
72
- end
73
-
74
- # Check for the existence of our mpg123 instance
75
- errorMsg("Trying to find the mp3 player...") if($commandline["--verbose"] == 'on')
76
- @mpg123 = $configFile.getParam('programConfig', 'application') # Get the application name, path, and possible arguments
77
- mpg123_application = @mpg123.scan(/^\S+/)
78
- if(mpg123_application.type == Array)
79
- mpg123_application = mpg123_application[0]
80
- else
81
- errorMsg("Please check your ProgramConfig/application setting in the configuration file. It seems weird.", 1)
82
- end
83
-
84
- # Do some nice errorhandling
85
- if( !FileTest::executable_real?(mpg123_application) )
86
- errorMsg("#{mpg123_application} doesn't appear to exist. Please do something about it (no, not \"touch #{mpg123_application}\"! Stupid!).", 1)
87
- else
88
- errorMsg("Found #{mpg123_application}!") if($commandline["--verbose"] == 'on')
89
- end
90
-
91
- # Open an instance of mpg123, our high-performance mp3 player
92
- @@mpg123 = IO::popen("#{@mpg123} -R -", 'r+')
93
-
94
- # Start all plugins
95
- load_plugins()
96
-
97
- # Start the mp3 player
98
- mpg123_control()
99
-
100
- end
101
-
102
- # mpg123_control() gets the input from the mpg123 process and handles it hopefully correctly :)
103
- def mpg123_control()
104
-
105
- # Initialize class variables
106
- @@stopped = false
107
-
108
- # Start playing if the configfile says so
109
- if( $configFile.getParam('programConfig', 'playOnStartup') == 'true' )
110
- MP3Control::play()
111
- else
112
- puts("Dont want to play!")
113
- end
114
-
115
- # The infinite 5 second loop =)
116
- while(true)
117
- begin
118
- input = @@mpg123.readline.chop()
119
- rescue EOFError
120
- errorMsg("mpg123 error! Probably just a file that didn't exist (#{$current_playlist.song_info["filename"]}).")
121
- @@mpg123 = IO::popen("#{@mpg123} -R -", 'r+') # Just start it again...
122
- MP3Control::next_song() # Next song, so it doesn't die again...
123
- end
124
-
125
- # Song stopped
126
- MP3Control::next_song() if(input == '@P 0' && @@stopped != true) # Change to the next song if current song stops and the user didn't told it to
127
- @@stopped = false if(input == '@P 0' && @@stopped == true) # Reset the stop-flag if the user ordered the stop
128
-
129
- # Time left
130
- if(input[0,2] == '@F')
131
- input =~ /^@F\s+\S+\s+\S+\s+(\S+)\s+(\S+)$/
132
- @@time = $1
133
- @@timeleft = $2
134
- end
135
-
136
- end
137
- end
138
-
139
- # start() creates a new instance. Just like .new, but a nicer name.
140
- def MP3Control::start()
141
- MP3Control::new()
142
- end
143
-
144
- # daemonize() daemonizes this process. Cool =)
145
- def daemonize()
146
- if(child_pid = fork) # Parent code
147
- puts("PID #{child_pid}")
148
- Kernel::exit(0) # We dont want this parent process any more. Too bad.
149
- end
150
-
151
- # Child code. And child wants to be free from parent
152
- Process.setsid()
153
- end
154
-
155
- # load_plugins() loads all plugins that can be found in the plugins directory
156
- def load_plugins()
157
- Dir::entries('extras/plugins/').each { |plugin|
158
- # Try to load every plugin except all files that begins with a dot
159
- if(plugin[0].chr() != '.')
160
- retval = 0
161
- # Do some errorhandling
162
- begin
163
- load("extras/plugins/#{plugin}") # Load the files
164
- errorMsg("Loaded plugin '#{plugin}'") if($commandline['--verbose'] == 'no')
165
- rescue SyntaxError
166
- errorMsg("Plugin '#{plugin}' has syntax errors.")
167
- end
168
-
169
- # Run the plugin in a separate thread
170
- # Try to start the class with the same name as the plugin
171
- eval("
172
- Thread::new() {
173
- start_again = true
174
- while(start_again)
175
- puts(\"Plugin starting...\")
176
- begin
177
- retval = #{plugin}::start()
178
- rescue
179
- error = $!
180
- puts(error)
181
- puts(error.backtrace)
182
- puts(\"Error in plugin #{plugin}! Waiting for 5 seconds before attempting to start again...\")
183
- sleep(5)
184
- end
185
- if(retval == -1)
186
- errorMsg(\"Plugin 'plugins/#{plugin}' failed to load...\")
187
- start_again = false
188
- end
189
- end
190
- }
191
- ")
192
-
193
- end
194
- }
195
- end
196
-
197
- # exit_mpg123() terminates the current mpg123 session
198
- def MP3Control::exit_mpg123()
199
- #system("kill `pidof mpg123`") # Yes, I know this isn't a nice way to do it in, please fix this and send me a patch :)
200
- end
201
-
202
- # mpg123_command() sends a command to mpg123
203
- def MP3Control::mpg123_command(command)
204
- errorMsg("mpg123 command: '#{command}'") if($commandline['--verbose'] == 'on')
205
- @@mpg123.write("#{command}\n")
206
- @@mpg123.flush()
207
- end
208
-
209
-
210
- # --- play functions ---
211
- # play() plays the current index of the current playlist
212
- def MP3Control::play()
213
- @@stopped = false
214
- mpg123_command("LOAD #{$current_playlist.song_info["filename"]}")
215
- end
216
-
217
- # stop() stops playing
218
- def MP3Control::stop()
219
- mpg123_command("PAUSE")
220
- @@stopped = true # Set the stop-status to true
221
- end
222
-
223
- # pause() pauses playing
224
- def MP3Control::pause()
225
- @@stopped = false
226
- mpg123_command("PAUSE")
227
- end
228
-
229
- # next_song() loads the next song. Yay...
230
- def MP3Control::next_song()
231
- retval = $current_playlist.next()
232
- if(retval == -1)
233
- errorMsg("Error while changing to the next song.") # Tell him/her
234
- else
235
- MP3Control::play() if(@@stopped == false)
236
- end
237
- end
238
-
239
- # prev_song() loads the previous song. Yay...
240
- def MP3Control::prev_song()
241
- retval = $current_playlist.prev()
242
- if(retval == -1)
243
- errorMsg("Error while changing to the previous song.") # Tell him/her
244
- else
245
- MP3Control::play() if(@@stopped == false)
246
- end
247
- end
248
-
249
- # forward(sec) jumps sec seconds forward
250
- def MP3Control::forward(sec)
251
- mpg123_command("JUMP +#{sec*38}")
252
- end
253
-
254
- # backward(sec) jumps sec seconds backward
255
- def MP3Control::backward(sec)
256
- mpg123_command("JUMP -#{sec*38}")
257
- end
258
-
259
-
260
- # --- Misc functions ---
261
- # getTime() - Get the current song time information. getTime(true) for time left
262
- def MP3Control::getTime(whichTime = 'elapsed')
263
- case whichTime
264
- when 'elapsed'
265
- parsed = Time::at(@@time.to_i)
266
- when 'left'
267
- parsed = Time::at(@@timeleft.to_i)
268
- when 'total'
269
- parsed = Time::at( (@@time.to_f + @@timeleft.to_f).to_i )
270
- end
271
-
272
- hour = (parsed.hour - 1).to_s
273
- min = parsed.min.to_s
274
- sec = parsed.sec.to_s
275
-
276
- hour = "0#{hour}" if(hour.length == 1)
277
- min = "0#{min}" if(min.length == 1)
278
- sec = "0#{sec}" if(sec.length == 1)
279
-
280
- hour = (hour == '00' ? '' : "#{hour}:")
281
-
282
- # Return the now formatted time
283
- "#{hour}#{min}:#{sec}"
284
- end
285
-
286
- end
287
-
288
- # Create an instance of the MP3Control class and start the application
289
- MP3Control::start()