rwdmovies 0.93 → 0.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/Readme.txt +3 -0
  2. data/code/01rwdcore/01rwdcore.rb +15 -13
  3. data/code/01rwdcore/openhelpwindow.rb +26 -26
  4. data/code/01rwdcore/returntomain.rb +8 -8
  5. data/code/01rwdcore/rwdtinkerversion.rb +12 -13
  6. data/code/01rwdcore/rwdwindowreturn.rb +3 -5
  7. data/code/01rwdcore/test_cases.rb +115 -0
  8. data/code/01rwdcore/test_harness.rb +12 -0
  9. data/code/01rwdcore/uploadreturns.rb +60 -61
  10. data/code/superant.com.rwdmovies/amazonsearch.rb +8 -2
  11. data/code/superant.com.rwdmovies/attachtmpmoviepicture.rb +24 -24
  12. data/code/superant.com.rwdmovies/createmovierecord.rb +20 -20
  13. data/code/superant.com.rwdmovies/deletemovierecord.rb +21 -21
  14. data/code/superant.com.rwdmovies/downloadpic.rb +21 -23
  15. data/code/superant.com.rwdmovies/eo2viewmoviephoto.rb +13 -18
  16. data/code/superant.com.rwdmovies/gl7clearscreendisplay.rb +12 -15
  17. data/code/superant.com.rwdmovies/listmoviefiles.rb +10 -14
  18. data/code/superant.com.rwdmovies/loadconfigurationrecord.rb +28 -33
  19. data/code/superant.com.rwdmovies/loadconfigurationvariables.rb +13 -13
  20. data/code/superant.com.rwdmovies/openhelpwindowrwdmovies.rb +21 -26
  21. data/code/superant.com.rwdmovies/openmoviedata.rb +27 -27
  22. data/code/superant.com.rwdmovies/renamemovie.rb +11 -12
  23. data/code/superant.com.rwdmovies/returntomain.rb +7 -7
  24. data/code/superant.com.rwdmovies/runrwdmoviesbackwindow.rb +8 -8
  25. data/code/superant.com.rwdmovies/rwdmovieshelpabout.rb +10 -12
  26. data/code/superant.com.rwdmovies/saveconfigurationrecord.rb +18 -18
  27. data/code/superant.com.rwdmovies/savemoviechanges.rb +18 -18
  28. data/code/superant.com.rwdmovies/showamazonsettings.rb +7 -4
  29. data/code/superant.com.rwdmovies/viewrwdmoviesconfiguration.rb +21 -21
  30. data/code/superant.com.rwdmovies/viewtmppictures.rb +5 -5
  31. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
  32. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -21
  33. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
  34. data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
  35. data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
  36. data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
  37. data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
  38. data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
  39. data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
  40. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
  41. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
  42. data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
  43. data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
  44. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
  45. data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
  46. data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
  47. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
  48. data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
  49. data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
  50. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
  51. data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
  52. data/configuration/language.dist +1 -1
  53. data/configuration/rwdapplicationidentity.dist +1 -1
  54. data/configuration/rwdmovies.dist +2 -2
  55. data/configuration/rwdtinker.dist +2 -2
  56. data/configuration/tinkerwin2variables.dist +1 -1
  57. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
  58. data/init.rb +231 -228
  59. data/installed/rwdviewlogo-0.4.inf +4 -0
  60. data/rwd_files/HowTo_Movies.txt +3 -0
  61. data/rwd_files/HowTo_Tinker.txt +10 -0
  62. data/rwd_files/moviestmp.jpg +0 -0
  63. data/rwdconfig.dist +6 -2
  64. data/tests/makedist.rb +37 -8
  65. metadata +7 -9
  66. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
  67. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
  68. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
  69. data/rwd_files/tinker.png +0 -0
data/Readme.txt CHANGED
@@ -48,6 +48,9 @@ steven@superant.com
48
48
  http://rwdapplications.rubyforge.org/wiki/wiki.pl
49
49
 
50
50
  == Changelog
51
+ Version 0.94
52
+ exception rescue wrapping Amazon lib
53
+
51
54
  version 0.93
52
55
  some code comments
53
56
  search screen help
@@ -3,18 +3,20 @@
3
3
  # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
4
  # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
5
  # This class is the top class for the RwdTinker application
6
-
6
+
7
7
  class RwdTinker < RWDialog
8
-
9
- def main
10
- @rwd_window = "main"
11
- @result = "idle"
12
- @display= "idle"
13
8
 
14
-
15
- end
16
-
17
- def inspect
18
- "Rwdtinker Application "
19
- end
20
-
9
+ def main
10
+ @rwd_window = "main"
11
+ @result = "idle"
12
+ @display= "idle"
13
+ if TestNow
14
+
15
+ rwdtest_harness
16
+ end
17
+ end
18
+
19
+ def inspect
20
+ "Rwdtinker Application "
21
+ end
22
+
@@ -1,31 +1,31 @@
1
1
  # this code is to call the help window
2
2
  def runhelpwindow
3
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing","applet_tinkerbackeditconfiguration","remote_control"]
4
-
5
- if @rwd_window == "main"
6
- if @rwd_tab == "documentsrwdtinkerone"
7
- $help_topic = "documents_rwdtinker"
8
- end
9
-
10
- end
11
-
12
- if @rwd_window == "rwdtinkerhelpwindow"
13
- puts "in help window processing"
14
- else
15
- $previouswindow = @rwd_window
16
- $previoustab = @rwd_tab
17
- end
18
-
19
-
20
- @rwdhelptopic = $help_topic
21
- @rwdhelpdataoutput = "#{Helptext[:"#{$help_topic}"]}"
22
- @rwdhelpsubchoicesoutput = $helptopicsarray.rwd_method("choosenewhelptopic")
23
- @rwd_window = "rwdtinkerhelpwindow"
3
+ $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing","applet_tinkerbackeditconfiguration","remote_control"]
4
+
5
+ if @rwd_window == "main"
6
+ if @rwd_tab == "documentsrwdtinkerone"
7
+ $help_topic = "documents_rwdtinker"
8
+ end
9
+
10
+ end
11
+
12
+ if @rwd_window == "rwdtinkerhelpwindow"
13
+ puts "in help window processing"
14
+ else
15
+ $previouswindow = @rwd_window
16
+ $previoustab = @rwd_tab
17
+ end
18
+
19
+
20
+ @rwdhelptopic = $help_topic
21
+ @rwdhelpdataoutput = "#{Helptext[:"#{$help_topic}"]}"
22
+ @rwdhelpsubchoicesoutput = $helptopicsarray.rwd_method("choosenewhelptopic")
23
+ @rwd_window = "rwdtinkerhelpwindow"
24
24
  end
25
-
26
- def choosenewhelptopic(inffile)
27
- $help_topic = inffile
28
- runhelpwindow
29
- end
25
+
26
+ def choosenewhelptopic(inffile)
27
+ $help_topic = inffile
28
+ runhelpwindow
29
+ end
30
30
 
31
31
 
@@ -1,10 +1,10 @@
1
1
  # Application RwdAddresses orginally (c) 2004 Steven Gibson under GPL.
2
2
  #
3
- # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
-
5
- # call the window
6
- def returntomain
7
- @rwd_window = "main"
8
- @rwd_tab = "selectiontab"
9
- end
10
-
3
+ # For information see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def returntomain
7
+ @rwd_window = "main"
8
+ @rwd_tab = "selectiontab"
9
+ end
10
+
@@ -1,15 +1,14 @@
1
1
  # Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
2
2
  # This application is a framework for writing programs from RubyWebDialogs
3
- # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
- # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
-
6
- # return the version constant defined in the config file
7
- def runrwdtinkerversion
8
- @rwd_window = "applicationversion"
9
- @versionappnamedisplay = "RwdTinker"
10
- @versioncopyrightdisplay = "(c) 2004 Steven Gibson "
11
- @versionnumberdisplay = "Version " + RwdTinkerVersion
12
-
13
- end
14
-
15
-
3
+ # For information see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # return the version constant defined in the config file
6
+ def runrwdtinkerversion
7
+ @rwd_window = "applicationversion"
8
+ @versionappnamedisplay = "RwdTinker"
9
+ @versioncopyrightdisplay = "(c) 2004 Steven Gibson "
10
+ @versionnumberdisplay = "Version " + RwdTinkerVersion
11
+
12
+ end
13
+
14
+
@@ -1,11 +1,9 @@
1
1
  # this code is to return to the window back from the help window
2
2
  def rwdwindowreturn
3
-
4
3
 
5
- @rwd_window = "#{$previouswindow}"
6
- @rwd_tab = "#{$previoustab}"
7
- end
8
-
4
+ @rwd_window = "#{$previouswindow}"
5
+ @rwd_tab = "#{$previoustab}"
6
+ end
9
7
 
10
8
 
11
9
 
@@ -0,0 +1,115 @@
1
+ # test harness
2
+ def rwdtinker_all_tests
3
+ print "in rwdtinker all tests\n"
4
+ test_runrwdtinkerbackwindow
5
+ end
6
+
7
+ def test_runrwdtinkerbackwindow
8
+
9
+ require 'test/unit'
10
+ begin
11
+
12
+ runrwdtinkerbackwindow
13
+
14
+ raise NotImplementedError, 'Need to write test_runrwdtinkerbackwindow'
15
+
16
+ rescue NotImplementedError
17
+ $stderr.print $!
18
+
19
+ end
20
+ end
21
+
22
+
23
+
24
+ def test_choosenewhelptopic
25
+ raise NotImplementedError, 'Need to write test_choosenewhelptopic'
26
+ end
27
+
28
+
29
+ def test_listinstalledfiles
30
+ raise NotImplementedError, 'Need to write test_listinstalledfiles'
31
+ end
32
+
33
+
34
+ def test_listzipfilestoinstall
35
+ raise NotImplementedError, 'Need to write test_listzipfilestoinstall'
36
+ end
37
+
38
+ def test_loadconfigurationrecord
39
+ raise NotImplementedError, 'Need to write test_loadconfigurationrecord'
40
+ end
41
+
42
+ def test_loadconfigurationvariables
43
+ raise NotImplementedError, 'Need to write test_loadconfigurationvariables'
44
+ end
45
+
46
+
47
+
48
+ def test_main
49
+ raise NotImplementedError, 'Need to write test_main'
50
+ end
51
+
52
+ def test_network_demon
53
+ raise NotImplementedError, 'Need to write test_network_demon'
54
+ end
55
+
56
+ def test_network_start
57
+ raise NotImplementedError, 'Need to write test_network_start'
58
+ end
59
+
60
+ def test_openappletname
61
+ raise NotImplementedError, 'Need to write test_openappletname'
62
+ end
63
+
64
+ def test_removeapplet
65
+ raise NotImplementedError, 'Need to write test_removeapplet'
66
+ end
67
+
68
+ def test_returntomain
69
+ raise NotImplementedError, 'Need to write test_returntomain'
70
+ end
71
+
72
+ def test_runcontrolcommand
73
+ raise NotImplementedError, 'Need to write test_runcontrolcommand'
74
+ end
75
+
76
+
77
+ def test_runhelpwindow
78
+ raise NotImplementedError, 'Need to write test_runhelpwindow'
79
+ end
80
+
81
+
82
+
83
+
84
+ def test_runrwdtinkerversion
85
+ raise NotImplementedError, 'Need to write test_runrwdtinkerversion'
86
+ end
87
+
88
+ def test_runrwdtinkerwin2version
89
+ raise NotImplementedError, 'Need to write test_runrwdtinkerwin2version'
90
+ end
91
+
92
+ def test_runviewplatform
93
+ raise NotImplementedError, 'Need to write test_runviewplatform'
94
+ end
95
+
96
+ def test_rwdtinkerversiondiagnostic
97
+ raise NotImplementedError, 'Need to write test_rwdtinkerversiondiagnostic'
98
+ end
99
+
100
+ def test_rwdwindowreturn
101
+ raise NotImplementedError, 'Need to write test_rwdwindowreturn'
102
+ end
103
+
104
+ def test_saveconfigurationrecord
105
+ raise NotImplementedError, 'Need to write test_saveconfigurationrecord'
106
+ end
107
+
108
+
109
+ def test_viewappletcontents
110
+ raise NotImplementedError, 'Need to write test_viewappletcontents'
111
+ end
112
+
113
+
114
+
115
+
@@ -0,0 +1,12 @@
1
+ # this to start the test harness
2
+ def rwdtest_harness
3
+
4
+ print "in test harness\n"
5
+ $testharnessarray.each { |x|
6
+ print "calling #{x}\n"
7
+ eval("#{x}")
8
+
9
+ }
10
+
11
+ end
12
+
@@ -1,63 +1,62 @@
1
- #this code uploads bug reports to the program author
2
1
  def uploadreturnsfile
3
- require 'net/ftp'
4
- BasicSocket.do_not_reverse_lookup = true
5
- @returnsftpdisplays = ""
6
- randomnumber = rand(9999) + 1000
7
- puts randomnumber.to_i
8
-
9
-
10
- returns_ftpsite = "ftp.superant.com"
11
- returns_ftplogin = "anonymous@superant.com"
12
- returns_ftppassword = "anonymous@superant.com"
13
- returns_ftpdirectory = "/incoming/returns/"
14
-
15
- begin
16
- platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
17
- platformdisplay = platformdisplay + "Ruby Version " + VERSION + "\n"
18
- platformdisplay = platformdisplay + "rwdtinker version " + RwdTinkerVersion + "\n"
19
- platformdisplay = platformdisplay + "application name " + $rwdapplicationidentity + "\n"
20
- platformdisplay = platformdisplay + "program directory " + $progdir + "\n"
21
- platformdisplay = platformdisplay + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
22
- platformdisplay = platformdisplay + "Date " + Date.today().to_s + "\n"
23
- if ! @a_emailupload.empty?
24
- platformdisplay = platformdisplay + @a_emailupload + "\n"
25
- end
26
- if ! @a_emailupload.empty?
27
- platformdisplay = platformdisplay + @a_commentupload + "\n"
28
- end
29
- updatefile = Date.today().to_s + Resolv.getname(Resolv.getaddress("localhost")) + randomnumber.to_s
30
-
31
- tmpdir = ENV['TMP']
32
- if tmpdir.to_s.empty?
33
- tmpdir = "/tmp"
34
- end
35
- fileName = File.join( tmpdir, updatefile)
36
- fd = File.open(fileName,"w")
37
- fd.print(platformdisplay) # save the record info to the file
38
- fd.close
39
- ftp = Net::FTP::new(returns_ftpsite)
40
- @returnsftpdisplay = "data uploaded" + "\n"
41
-
42
- filedirname = File.join(tmpdir,updatefile)
43
-
44
- ftp.debug_mode = false
45
- ftp.login(returns_ftplogin, returns_ftppassword)
46
- ftp.chdir(returns_ftpdirectory)
47
- print "I'm in the directory ", ftp.pwd(), "\n"
48
-
49
- puts filedirname
50
- ftp.puttextfile(filedirname , updatefile)
51
- @returnsftpdisplay = @returnsftpdisplay + platformdisplay
52
-
53
-
54
- ftp.close
55
-
56
- rescue
57
- @returnsftpdisplay = "upload error"
58
- if ftp
59
- ftp.close
60
- end
61
- print "ftp error"
62
- end
2
+ require 'net/ftp'
3
+ BasicSocket.do_not_reverse_lookup = true
4
+ @returnsftpdisplays = ""
5
+ randomnumber = rand(9999) + 1000
6
+ puts randomnumber.to_i
7
+
8
+
9
+ returns_ftpsite = "ftp.superant.com"
10
+ returns_ftplogin = "anonymous@superant.com"
11
+ returns_ftppassword = "anonymous@superant.com"
12
+ returns_ftpdirectory = "/incoming/returns/"
13
+
14
+ begin
15
+ platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
16
+ platformdisplay = platformdisplay + "Ruby Version " + VERSION + "\n"
17
+ platformdisplay = platformdisplay + "rwdtinker version " + RwdTinkerVersion + "\n"
18
+ platformdisplay = platformdisplay + "application name " + $rwdapplicationidentity + "\n"
19
+ platformdisplay = platformdisplay + "program directory " + $progdir + "\n"
20
+ platformdisplay = platformdisplay + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
21
+ platformdisplay = platformdisplay + "Date " + Date.today().to_s + "\n"
22
+ if ! @a_emailupload.empty?
23
+ platformdisplay = platformdisplay + @a_emailupload + "\n"
24
+ end
25
+ if ! @a_emailupload.empty?
26
+ platformdisplay = platformdisplay + @a_commentupload + "\n"
27
+ end
28
+ updatefile = Date.today().to_s + Resolv.getname(Resolv.getaddress("localhost")) + randomnumber.to_s
29
+
30
+ tmpdir = ENV['TMP']
31
+ if tmpdir.to_s.empty?
32
+ tmpdir = "/tmp"
33
+ end
34
+ fileName = File.join( tmpdir, updatefile)
35
+ fd = File.open(fileName,"w")
36
+ fd.print(platformdisplay) # save the record info to the file
37
+ fd.close
38
+ ftp = Net::FTP::new(returns_ftpsite)
39
+ @returnsftpdisplay = "data uploaded" + "\n"
40
+
41
+ filedirname = File.join(tmpdir,updatefile)
42
+
43
+ ftp.debug_mode = false
44
+ ftp.login(returns_ftplogin, returns_ftppassword)
45
+ ftp.chdir(returns_ftpdirectory)
46
+ print "I'm in the directory ", ftp.pwd(), "\n"
47
+
48
+ puts filedirname
49
+ ftp.puttextfile(filedirname , updatefile)
50
+ @returnsftpdisplay = @returnsftpdisplay + platformdisplay
51
+
52
+
53
+ ftp.close
54
+
55
+ rescue
56
+ @returnsftpdisplay = "upload error"
57
+ if ftp
58
+ ftp.close
59
+ end
60
+ print "ftp error"
61
+ end
63
62
  end
@@ -1,18 +1,24 @@
1
+ begin
1
2
  require 'amazon/search'
2
3
  include Amazon::Search
4
+ rescue Exception
5
+ $stderr.print "amazon load error\n"
6
+ $stderr.print "to use amazon search, you need to load ruby-amazon\n"
7
+ end
3
8
  #amazon search
4
9
  def runmoviesearch
10
+ begin
5
11
  req = Request.new(DEV_TOKEN)
6
12
  testmovie = @a_moviefilename
7
13
  s = ['keyword_search', "#{testmovie}", 'dvd', HEAVY, ALL_PAGES,'Name']
8
14
 
9
15
 
10
16
  s.pop
11
- begin
17
+
12
18
  # parse and display the results of each search
13
19
  response = req.send(*s) { |prod| @moviesearchdisplay = prod, '' }
14
20
  # printf("Arguments returned from search were:\n\n%s\n", response.args.inspect)
15
- rescue
21
+ rescue Exception
16
22
  print "result error"
17
23
  end
18
24
  end
@@ -1,25 +1,25 @@
1
- # this code is to attach a photo from the tmp directory
2
- def attachtmpmoviepicture
3
- if ! @a_moviefilename.empty?
4
- $currentmovietext = @a_moviefilename
5
- end
6
- if $currentmovietext
7
- tmpmoviepictureName = $tmpmoviepicture_directory + "/" + @a_tmppicturename
8
- begin
9
- if File.exist?(tmpmoviepictureName)
10
- newmoviepictureName = $tmpmoviepicture_directory + "/" + $currentmovietext + ".jpg"
11
- if ! (tmpmoviepictureName == newmoviepictureName )
12
- File.rename(tmpmoviepictureName, newmoviepictureName)
13
- end
14
- FileUtils.cp(newmoviepictureName , $rwdmovies_directory)
15
- @listpicturesfromtmp = "Picture attached"
16
-
17
- else
18
- @listpicturesfromtmp = "attachment failed"
19
- end
20
- rescue
21
- @listpicturesfromtmp = "attachment failed"
22
- end
23
- end
24
- end
1
+ # this code is to attach a photo from the tmp directory
2
+ def attachtmpmoviepicture
3
+ if ! @a_moviefilename.empty?
4
+ $currentmovietext = @a_moviefilename
5
+ end
6
+ if $currentmovietext
7
+ tmpmoviepictureName = $tmpmoviepicture_directory + "/" + @a_tmppicturename
8
+ begin
9
+ if File.exist?(tmpmoviepictureName)
10
+ newmoviepictureName = $tmpmoviepicture_directory + "/" + $currentmovietext + ".jpg"
11
+ if ! (tmpmoviepictureName == newmoviepictureName )
12
+ File.rename(tmpmoviepictureName, newmoviepictureName)
13
+ end
14
+ FileUtils.cp(newmoviepictureName , $rwdmovies_directory)
15
+ @listpicturesfromtmp = "Picture attached"
16
+
17
+ else
18
+ @listpicturesfromtmp = "attachment failed"
19
+ end
20
+ rescue
21
+ @listpicturesfromtmp = "attachment failed"
22
+ end
23
+ end
24
+ end
25
25
 
@@ -1,20 +1,20 @@
1
- # this method adds a new record
2
- def createmovierecord
3
- require 'fileutils'
4
- if @a_moviefilename
5
- newname = "%s" % [@a_moviefilename] # grab the new filename to create
6
- newdata =@a_moviefilename.to_s # make the filename the first line of data
7
-
8
- fullnewname = newname + ".nam"
9
- begin # exception trapped block
10
- fileName = File.join( $rwdmovies_directory, fullnewname )
11
- fd = File.open(fileName,"w")
12
- fd.print(newdata) # save the record info to the file
13
- fd.close
14
- @listpicturesfromtmp=newdata + " file created" #show the record info in the browser
15
- rescue SystemCallError, StandardError
16
- @listpicturesfromtmp = "file creation error: " + $!
17
- $stderr.print "system call error: " + $!
18
- end # exception rescue
19
- end
20
- end
1
+ # this method adds a new record
2
+ def createmovierecord
3
+ require 'fileutils'
4
+ if @a_moviefilename
5
+ newname = "%s" % [@a_moviefilename] # grab the new filename to create
6
+ newdata =@a_moviefilename.to_s # make the filename the first line of data
7
+
8
+ fullnewname = newname + ".nam"
9
+ begin # exception trapped block
10
+ fileName = File.join( $rwdmovies_directory, fullnewname )
11
+ fd = File.open(fileName,"w")
12
+ fd.print(newdata) # save the record info to the file
13
+ fd.close
14
+ @listpicturesfromtmp=newdata + " file created" #show the record info in the browser
15
+ rescue SystemCallError, StandardError
16
+ @listpicturesfromtmp = "file creation error: " + $!
17
+ $stderr.print "system call error: " + $!
18
+ end # exception rescue
19
+ end
20
+ end
@@ -1,24 +1,24 @@
1
- # this method views an existing record
2
- def deletemovierecord
3
-
4
- require 'fileutils'
5
-
6
- if @a_moviefilename
7
- $currentmovietext = @a_moviefilename
8
- end
9
-
10
- fileName = $rwdmovies_directory + "/" + $currentmovietext + ".nam"
11
-
1
+ # this method views an existing record
2
+ def deletemovierecord
12
3
 
13
- begin # exception trapped block
4
+ require 'fileutils'
14
5
 
15
- File.delete(fileName)
16
- fileNamephoto = $rwdmovies_directory + "/" + $currentmovietext + ".jpg"
17
- if File.exist?(fileNamephoto)
18
- File.delete(fileNamephoto)
19
- end
20
- rescue SystemCallError, StandardError
21
- $stderr.print "system call error: " + $!
22
- end # exception rescue
6
+ if @a_moviefilename
7
+ $currentmovietext = @a_moviefilename
8
+ end
23
9
 
24
- end
10
+ fileName = $rwdmovies_directory + "/" + $currentmovietext + ".nam"
11
+
12
+
13
+ begin # exception trapped block
14
+
15
+ File.delete(fileName)
16
+ fileNamephoto = $rwdmovies_directory + "/" + $currentmovietext + ".jpg"
17
+ if File.exist?(fileNamephoto)
18
+ File.delete(fileNamephoto)
19
+ end
20
+ rescue SystemCallError, StandardError
21
+ $stderr.print "system call error: " + $!
22
+ end # exception rescue
23
+
24
+ end
@@ -1,28 +1,26 @@
1
1
 
2
2
  # download picture
3
- def downloadpicture
4
- require 'net/http'
5
- require 'uri'
6
- uri = @a_urlpicturename
7
- begin
8
- uri_parse = URI.parse(uri)
9
- host = uri_parse.host
10
- path = uri_parse.path
11
- response = nil
12
-
13
- http = Net::HTTP.start(host)
3
+ def downloadpicture
4
+ require 'net/http'
5
+ require 'uri'
6
+ uri = @a_urlpicturename
7
+ begin
8
+ uri_parse = URI.parse(uri)
9
+ host = uri_parse.host
10
+ path = uri_parse.path
11
+ response = nil
14
12
 
15
-
16
- response = http.get(path)
17
-
18
- data = response.body
19
- File.open("/tmp/test.jpg", "w") { |f| f.write(data) }
20
- @listpicturesfromtmp = "picture downloaded"
13
+ http = Net::HTTP.start(host)
21
14
 
22
- rescue
23
- @listpicturesfromtmp = "error retrieving #{uri}:"
24
- end
25
15
 
26
-
27
-
28
- end
16
+ response = http.get(path)
17
+
18
+ data = response.body
19
+ File.open("/tmp/test.jpg", "w") { |f| f.write(data) }
20
+ @listpicturesfromtmp = "picture downloaded"
21
+
22
+ rescue
23
+ @listpicturesfromtmp = "error retrieving #{uri}:"
24
+ end
25
+
26
+ end
@@ -1,19 +1,14 @@
1
1
  # show picture
2
- def viewmoviephoto
3
- path_to = File.join( "rwd_files", "moviestmp.jpg" )
4
- begin
5
- if ! @a_tmppicturename.empty?
6
- path_from = File.join( $tmpmoviepicture_directory, @a_tmppicturename.to_s )
7
- print path_from.to_s
8
-
9
-
10
-
11
- FileUtils.cp(path_from, path_to)
12
- @rwd_window = "moviephoto"
13
-
14
- end
15
- rescue
16
- print "picture copy error"
17
- end
18
-
19
- end
2
+ def viewmoviephoto
3
+ path_to = File.join( "rwd_files", "moviestmp.jpg" )
4
+ begin
5
+ if ! @a_tmppicturename.empty?
6
+ path_from = File.join( $tmpmoviepicture_directory, @a_tmppicturename.to_s )
7
+ print path_from.to_s
8
+ FileUtils.cp(path_from, path_to)
9
+ @rwd_window = "moviephoto"
10
+ end
11
+ rescue
12
+ print "picture copy error"
13
+ end
14
+ end