zcc 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/History.txt +15 -0
  2. data/Manifest.txt +12 -19
  3. data/Rakefile +2 -1
  4. data/bin/zcc +228 -202
  5. data/examples/zcc.yaml +21 -12
  6. data/examples/zebra/{register/empty → key/remove_me} +1 -1
  7. data/examples/zebra/{key/empty → lock/remove_me} +1 -1
  8. data/examples/zebra/records/0.mrc +1 -0
  9. data/examples/zebra/{lock/empty → register/remove_me} +1 -1
  10. data/examples/zebra/tab/marc21.abs +67 -0
  11. data/examples/zebra/tab/record.abs +1 -0
  12. data/examples/zebra/zebra.cfg +2 -2
  13. data/examples/zservers.yaml +869 -0
  14. data/lib/zcc.rb +8 -0
  15. data/lib/zcc/ansicolorz.rb +26 -0
  16. data/lib/zcc/cli_display.rb +461 -0
  17. data/lib/zcc/query.rb +183 -0
  18. data/lib/zcc/record.rb +265 -0
  19. data/lib/zcc/resultset.rb +169 -0
  20. data/lib/zcc/version.rb +2 -2
  21. data/lib/zcc/zoomer.rb +16 -2
  22. data/lib/zcc/zserver.rb +38 -0
  23. data/website/index.html +1 -1
  24. data/website/koha.html +18 -10
  25. data/website/koha.txt +13 -8
  26. data/website/zcc.html +35 -33
  27. data/website/zcc.txt +30 -32
  28. data/website/zebra.html +57 -15
  29. data/website/zebra.txt +56 -15
  30. metadata +23 -21
  31. data/examples/zebra/README +0 -2
  32. data/examples/zebra/records/examples/0.xml +0 -1
  33. data/examples/zebra/records/examples/1.xml +0 -1
  34. data/examples/zebra/records/examples/2.xml +0 -1
  35. data/examples/zebra/records/examples/3.xml +0 -1
  36. data/examples/zebra/records/examples/4.xml +0 -1
  37. data/examples/zebra/records/examples/5.xml +0 -1
  38. data/examples/zebra/records/examples/6.xml +0 -1
  39. data/examples/zebra/records/examples/7.xml +0 -1
  40. data/examples/zebra/records/examples/8.xml +0 -1
  41. data/examples/zebra/records/examples/9.xml +0 -1
  42. data/examples/zebra/shadow/empty +0 -1
  43. data/examples/zebra/tab/kohalis +0 -1
  44. data/examples/zebra/tmp/empty +0 -1
  45. data/lib/zcc/marcadditions.rb +0 -221
  46. data/lib/zcc/pickers.rb +0 -176
@@ -1,3 +1,18 @@
1
+ == 0.1.0
2
+ * The version is incompatible with previous versions.
3
+ * major changes:
4
+ * Major rewrite of the code to make the library more object oriented and reusable. Major improvements here include the ability of records to carry around the z-target source.
5
+ * Added dependency to gem term-ansicolor.
6
+ * Rewrite of menuing system to utilize HighLine and add functionality like better help. Adding new functionality is now much easier as well.
7
+ * Corrected some configuration issues with zebra that should allow it to work with different installations and changed to storing MARC21 instead of MARCXML.
8
+ * Threaded searches. Ability to group Z39.50 targets and search them in parallel.
9
+ * Added option to save directly to Koha-2.2.X
10
+ * minor changes:
11
+ * Simple relevancy ranking on title searches.
12
+ * Fields that show in browse are configurable as well as the number of records to show per page.
13
+ * Sorting of records in browse, selected record highlighting, forwards and backwards through result set.
14
+ * Search error logging so user can remove bad z-targets--or report a bug in zcc :)
15
+
1
16
  == 0.0.3
2
17
  * major changes:
3
18
  * added dependencies to Rakefile
@@ -6,21 +6,10 @@ Rakefile
6
6
  bin/zcc
7
7
  examples/linter.pl
8
8
  examples/zcc.yaml
9
- examples/zebra/key/empty
10
- examples/zebra/lock/empty
11
- examples/zebra/README
12
- examples/zebra/register/empty
13
- examples/zebra/records/examples/0.xml
14
- examples/zebra/records/examples/1.xml
15
- examples/zebra/records/examples/2.xml
16
- examples/zebra/records/examples/3.xml
17
- examples/zebra/records/examples/4.xml
18
- examples/zebra/records/examples/5.xml
19
- examples/zebra/records/examples/6.xml
20
- examples/zebra/records/examples/7.xml
21
- examples/zebra/records/examples/8.xml
22
- examples/zebra/records/examples/9.xml
23
- examples/zebra/shadow/empty
9
+ examples/zebra/key/remove_me
10
+ examples/zebra/lock/remove_me
11
+ examples/zebra/records/0.mrc
12
+ examples/zebra/register/remove_me
24
13
  examples/zebra/tab/bib1.abs
25
14
  examples/zebra/tab/bib1.att
26
15
  examples/zebra/tab/default.idx
@@ -28,22 +17,26 @@ examples/zebra/tab/explain.abs
28
17
  examples/zebra/tab/explain.att
29
18
  examples/zebra/tab/explain.tag
30
19
  examples/zebra/tab/gils.att
31
- examples/zebra/tab/kohalis
20
+ examples/zebra/tab/marc21.abs
32
21
  examples/zebra/tab/numeric.chr
33
22
  examples/zebra/tab/record.abs
34
23
  examples/zebra/tab/sort-string-utf.chr
35
24
  examples/zebra/tab/tagsetm.tag
36
25
  examples/zebra/tab/usmarc.mar
37
26
  examples/zebra/tab/word-phrase-utf.chr
38
- examples/zebra/tmp/empty
39
27
  examples/zebra/zebra.cfg
40
28
  examples/zoomer-iterator.txt
29
+ examples/zservers.yaml
41
30
  lib/zcc.rb
42
- lib/zcc/marcadditions.rb
43
- lib/zcc/pickers.rb
31
+ lib/zcc/ansicolorz.rb
32
+ lib/zcc/cli_display.rb
33
+ lib/zcc/query.rb
34
+ lib/zcc/record.rb
35
+ lib/zcc/resultset.rb
44
36
  lib/zcc/subfieldeditor.rb
45
37
  lib/zcc/version.rb
46
38
  lib/zcc/zoomer.rb
39
+ lib/zcc/zserver.rb
47
40
  scripts/txt2html
48
41
  setup.rb
49
42
  test/test_helper.rb
data/Rakefile CHANGED
@@ -75,7 +75,8 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
75
75
  ['marc','>=0.1.6'],
76
76
  ['zoom', '>=0.3.0'],
77
77
  ['unicode','>=0.1'],
78
- ['highline', '>=1.2.9']
78
+ ['highline', '>=1.2.9'],
79
+ ['term-ansicolor', '>=1.0.2']
79
80
  ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
80
81
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
81
82
  end
data/bin/zcc CHANGED
@@ -1,202 +1,228 @@
1
- #!/usr/bin/ruby -w
2
- ## Jason Ronallo
3
- # April, 2007
4
-
5
- require 'rubygems'
6
- require 'zoom'
7
- require 'marc'
8
- require 'stringio'
9
- require 'yaml'
10
-
11
- $KCODE = 'u'
12
- require 'jcode'
13
- require 'unicode'
14
-
15
- #--my modules
16
- require 'zcc/marcadditions'
17
- require 'zcc/pickers'
18
- require 'zcc/subfieldeditor'
19
- require 'zcc/zoomer'
20
- #require 'wcid'
21
- require 'highline/import'
22
- #require 'curses'
23
-
24
- termsize = HighLine::SystemExtensions.terminal_size
25
- $term_width = termsize[0]
26
- $term_height = termsize[1]
27
- $clear_code = %x{clear}
28
-
29
-
30
- ft = HighLine::ColorScheme.new do |cs|
31
- cs[:headline] = [ :bold, :white, :on_black ]
32
- cs[:horizontal_line] = [ :bold, :white, :on_blue]
33
- cs[:even_row] = [ :green ]
34
- cs[:odd_row] = [ :magenta ]
35
- cs[:marc_tag] = [:bold]
36
- cs[:bolder] = [:bold]
37
- cs[:field_hilite] = [:bold, :blue]
38
- cs[:index] = [:bold, :red]
39
- end
40
- HighLine.color_scheme = ft
41
-
42
-
43
- ##Setting up testing parameter
44
- $testing = ARGV[0]
45
- $testing = nil unless $testing == 'v' or $testing == 't'
46
- puts "We're testing " if $testing
47
- STDIN.gets if $testing
48
-
49
- #reading in config from yaml file
50
- yamlfile = YAML.load_file( "#{File.expand_path("~")}/.zcc/zcc.yaml" )
51
- zservers = yamlfile['zservers']
52
- labels = yamlfile['labels']
53
- scripting = yamlfile['scripting']
54
- $procs = yamlfile['procs']
55
-
56
- TO_SHOW = yamlfile['to_show']
57
- HOW_TO_SAVE = yamlfile['save_filename']
58
- TIMESTAMP = Time.now.strftime("%Y%m%d%H%M%S")
59
- SCRIPTING = yamlfile['scripting_on']
60
- EDITING = yamlfile['subfield_editing']
61
- CSV = yamlfile['csv_on']
62
- LINTER = yamlfile['linter_on']
63
- FORMAT_TO_SAVE = yamlfile['save_record_syntax']
64
- #ZEBRA_ON = yamlfile['zebra']
65
- #ZEBRA_CONF = yamlfile['zebraconf']
66
-
67
- print $clear_code
68
- #printed once when starting the program.
69
- say("Zcc, Copyright (C) 2007 Jason Ronallo\nZcc comes with ABSOLUTELY NO WARRANTY.\nZcc is released under the terms of the GPL v.2 or later.\nSee LICENSE for full information.\n")
70
- say("Introductory help. For now see: http://zcc.rubyforge.org/zcc.html")
71
-
72
- #++# All the main logic of the program is just one simple big loop.
73
- # Copy cataloging forever....
74
- clear_code_do = false
75
- loop {
76
- taken = []
77
- print $clear_code if clear_code_do
78
- clear_code_do = true
79
- search_term = ask("\n<%= color('Enter search. [ISBN, title, LCCN (with dash), or :q to quit]', :bolder) %>\nsearch> ", String){ |q| q.readline = true }
80
- exit if search_term == ':q'
81
-
82
- zservers.each do |zserver|
83
- records = ZCC.zoomer(search_term, zserver[0], zserver[1], zserver[2])
84
- puts "\n"
85
-
86
- if records.nil?: print "nil records returned"; next; end
87
-
88
- recs_array = records.to_a
89
- taker = []
90
- taker = recs_array.zcc_select_good_marc('multi')
91
- another_zserver = taker.pop if taker[-1] == 'done'
92
-
93
- next if taker == nil
94
- taker.each do |taker|
95
- puts "\ntaker: #{taker['245']}\n\n"
96
- taken << taker
97
- end
98
- break if another_zserver == 'done'
99
- end
100
-
101
- taken.flatten!
102
- taken.compact!
103
- puts "taken.length #{taken.length}"
104
- if taken.length > 1
105
- say("\a<%= color('#{'!' * 10}We only need one record per book, so make your choice now!#{'!' * 10}', :headline) %>")
106
- sleep 2
107
- taken = taken.zcc_select_good_marc('one')
108
- if taken == 'none'
109
- next
110
- print $clear_code
111
- end
112
- puts "after selecting final record taken.length = #{taken.length}"
113
- puts taken[0]['245'] , "\n\n"
114
- elsif taken.length == 0
115
- print $clear_code
116
- print "You didn't get any records!\n"
117
- clear_code_do = false
118
- next #if continue? == 'again'
119
- end
120
-
121
- final_taken = taken[0]
122
- #puts final_taken
123
-
124
- #SCRIPTING and EDITING
125
- if SCRIPTING
126
- print $clear_code
127
- print "\a"
128
- say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
129
- say("<%= color('SCRIPTING...', :headline) %>")
130
- final_taken.local_script(scripting)
131
- end
132
- if EDITING
133
- print $clear_code
134
- print "\a"
135
- say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
136
- say("Would you like to <%= color('edit', :headline) %> this record [yes or ANYTHING]? ")
137
- edit = STDIN.gets.chomp
138
- if edit == ('y' or 'yes')
139
- print $clear_code
140
- say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
141
- final_taken.edit
142
- end
143
- end
144
-
145
- print $clear_code
146
- say("<%= color('#{'-'*20}FINAL RECORD#{'-'*20}', :headline) %>")
147
- say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
148
- say("<%= color('#{'-'*20}FINAL RECORD#{'-'*20}\a', :headline) %>")
149
- print "Would you like to keep this FINAL RECORD? (ANYTHING or n)"
150
-
151
- to_save_or_not_to_save = STDIN.gets.chomp
152
-
153
- if to_save_or_not_to_save == 'n'
154
- next #if continue? == 'again'
155
- end
156
-
157
- if CSV
158
- print $clear_code
159
- print "\a"
160
- say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
161
- say("<%= color('Label making time!', :headline) %>")
162
- csv = final_taken.marc_to_csv(labels)
163
- print "Final csv:\n#{csv}\n"
164
- end
165
-
166
- print $clear_code
167
- clear_code_do = false
168
-
169
-
170
- #saves in the directory in which zcc was run
171
- if HOW_TO_SAVE == 'search_term'
172
- filename = search_term.gsub(' ','_')
173
- elsif HOW_TO_SAVE == 'timestamp'
174
- filename = TIMESTAMP
175
- end
176
-
177
- if FORMAT_TO_SAVE == 'marc'
178
- aFile = File.new("#{filename}\.mrc","a+")
179
- aFile.write(final_taken.to_marc)
180
- puts "#{final_taken['245']['a']} saved in #{filename}\.mrc"
181
- aFile.close
182
- elsif FORMAT_TO_SAVE == 'marcxml'
183
- puts final_taken.to_xml
184
- aFile = File.new("#{filename}\.xml","a+")
185
- aFile.write(final_taken.to_xml)
186
- puts "#{final_taken['245']['a']} saved in #{filename}\.xml"
187
- aFile.close
188
- elsif FORMAT_TO_SAVE == 'zebra'
189
- #puts final_taken.to_xml
190
- File.open("#{File.expand_path("~")}/.zcc/zebra/records/#{Time.now.strftime("%Y%m%d%H%M%S")}\.xml", "w") do |f|
191
- f.write final_taken.to_xml
192
- end
193
- end
194
-
195
- if CSV
196
- csvFile = File.new("csv-#{filename}\.txt","a+")
197
- csvFile.write(csv)
198
- puts "csv for #{taken[0]['245']['a']} saved in csv-#{filename}\.txt"
199
- csvFile.close
200
- end
201
-
202
- }
1
+ #!/usr/bin/ruby -w
2
+ ## Jason Ronallo
3
+ # July, 2007
4
+ #zcc-new
5
+
6
+ require 'rubygems'
7
+ require 'zoom'
8
+ require 'marc'
9
+ require 'highline/import'
10
+ require 'term/ansicolor'
11
+ #include Term::ANSIColor
12
+
13
+ require 'stringio'
14
+ require 'yaml'
15
+ require 'tempfile'
16
+
17
+ $KCODE = 'u'
18
+ require 'jcode'
19
+ require 'unicode'
20
+
21
+ require 'zcc'
22
+ include ZCC
23
+
24
+ termsize = HighLine::SystemExtensions.terminal_size
25
+ $term_width = termsize[0]
26
+ $term_height = termsize[1]
27
+ $clear_code = %x{clear}
28
+ HighLine.track_eof = false
29
+
30
+ ##Setting up testing parameter
31
+ $testing = ARGV[0]
32
+ $testing = nil unless $testing == 'v' or $testing == 't'
33
+ file_mode = true if ARGV[0] == 'file'
34
+ puts "We're testing " if $testing
35
+ STDIN.gets if $testing
36
+
37
+ #reading in config from yaml file
38
+ yamlfile = YAML.load_file( "#{File.expand_path("~")}/.zcc/zcc.yaml" )
39
+ zservers = yamlfile['zservers']
40
+
41
+ if zservers[0][0] =~ /Include/
42
+ filename = zservers[0][0][8, 99]
43
+ contents = YAML.load_file("#{File.expand_path("~")}/.zcc/#{filename}")
44
+ contents.each{|c| zservers.push(c)}
45
+ zservers[0] = nil
46
+ end
47
+ zservers.compact!
48
+
49
+ labels = yamlfile['labels']
50
+ scripting = yamlfile['scripting']
51
+ $procs = yamlfile['procs']
52
+
53
+ TO_SHOW = yamlfile['to_show']
54
+ SHOW_PER_PAGE = yamlfile['show_per_page']
55
+ FIELDS_TO_SHOW = yamlfile['fields_to_show']
56
+ HOW_TO_SAVE = yamlfile['save_filename']
57
+ TIMESTAMP = Time.now.strftime("%Y%m%d%H%M%S")
58
+ SCRIPTING = yamlfile['scripting_on']
59
+ EDITING = yamlfile['subfield_editing']
60
+ CSV = yamlfile['csv_on']
61
+ LINTER = yamlfile['linter_on']
62
+ FORMAT_TO_SAVE = yamlfile['save_record_syntax']
63
+
64
+ print $clear_code
65
+ #printed once when starting the program.
66
+ say("Zcc, Copyright (C) 2007 Jason Ronallo\nZcc comes with ABSOLUTELY NO WARRANTY.\nZcc is released under the terms of the GPL v.2 or later.\nSee LICENSE for full information.\n".bold)
67
+ say("Simply enter a title, LCCN or ISBN and hit enter.\nTitle: enter the title exactly as it is on the source\n for better relevancy ranking by title.\nLCCN: Include the dash, like 81-21962\nEnter ISBNs without dashes.\nNot all servers accept it, but you can also do a narrowing search\nby including an author's name after the title like so:\nFinnegans Wake :au Joyce")
68
+ say("For more help see: http://zcc.rubyforge.org/zcc.html")
69
+
70
+ zserver_objects = []
71
+ zservers.each do |server|
72
+ zserver_objects << Zserver.new(server[0], server[1], server[2], server[3])
73
+ end
74
+
75
+ server_h = Hash.new {|hash, key| hash[key] = [] }
76
+ zserver_objects.each {|z| server_h[z.group] << z}
77
+
78
+ groups = []
79
+ server_h.each_key{|k| groups << k}
80
+ groups.uniq!
81
+ groups.sort!
82
+
83
+ loop {
84
+ search_term = ask("\nEnter search. [ISBN, title, LCCN (with dash), or :q to quit]\nsearch> ".boldz, String){ |q| q.readline = true }
85
+ exit if search_term == ':q'
86
+
87
+ taken = ResultSet.new
88
+ groups.each do |group|
89
+ print $clear_code
90
+ servers = server_h[group]
91
+ query = Query.new(search_term, servers)
92
+ results = query.search(TO_SHOW)
93
+ results.index_pos = SHOW_PER_PAGE - 1
94
+ if results.records.empty?
95
+ puts "There are no results from group #{group} servers!\n\n\n"
96
+ another_group = ask("Do you want to continue searcing the next group of servers? [y], anything ".boldz)
97
+ if another_group == 'y' || another_group == ''
98
+ next
99
+ else
100
+ print $clear_code
101
+ break
102
+ end
103
+ end
104
+ results.rank_by_relevance!
105
+ return_value = zcc_select_good_marc(results, 'multi')
106
+ taken << results
107
+ break if return_value == 'done'
108
+ end
109
+
110
+ taken.remove_unselected!
111
+ next if taken.empty?
112
+ continue = true
113
+ print $clear_code
114
+ say("\aThis is your combined result set.\nWe will winnow until you choose ".white.bold.on_black + "'done'".red.bold + "\nor you unselect all records.".white.bold.on_black)
115
+ sleep 3
116
+ while continue
117
+ return_value = zcc_select_good_marc(taken, 'multi')
118
+ continue = false if taken.selected_length == 0
119
+ continue = false if return_value == 'done'
120
+ end
121
+ taken.remove_unselected!
122
+ unless taken.length == 0
123
+ puts "Here are the records you've selected for processing:"
124
+ taken.each do |record|
125
+ puts record.title
126
+ end
127
+ sleep 2
128
+ end
129
+
130
+ taken.records.each do |final_taken|
131
+
132
+ #SCRIPTING and EDITING
133
+ if SCRIPTING
134
+ print $clear_code
135
+ print "\a"
136
+ say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
137
+ say("SCRIPTING...".bold.white.on_black)
138
+ final_taken.local_script(scripting)
139
+ end
140
+
141
+ if EDITING
142
+ print $clear_code
143
+ print "\a"
144
+ say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
145
+ edit = ask("Would you like to " + "edit".headline + " this record [yes or ANYTHING]? ")
146
+ if edit == ('y' or 'yes')
147
+ print $clear_code
148
+ say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
149
+ final_taken.edit
150
+ end
151
+ end
152
+
153
+ print $clear_code
154
+ say("#{'-'*20}FINAL RECORD#{'-'*20}".headline)
155
+ say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
156
+ say("#{'-'*20}FINAL RECORD#{'-'*20}".headline)
157
+ to_save_or_not_to_save = ask("Would you like to keep this FINAL RECORD? (ANYTHING or n)")
158
+
159
+ if to_save_or_not_to_save == 'n'
160
+ next #if continue? == 'again'
161
+ end
162
+
163
+ if CSV
164
+ print $clear_code
165
+ print "\a"
166
+ say("#{ZCC.zcc_marc_str_bold(final_taken.to_s, 'record')}")
167
+ say("Label making time!".headline)
168
+ csv = final_taken.marc_to_csv(labels)
169
+ print "Final csv:\n#{csv}\n"
170
+ end
171
+
172
+ print $clear_code
173
+ clear_code_do = false
174
+
175
+
176
+ #saves in the directory in which zcc was run
177
+ if HOW_TO_SAVE == 'search_term'
178
+ filename = search_term.gsub(' ','_')
179
+ elsif HOW_TO_SAVE == 'timestamp'
180
+ filename = TIMESTAMP
181
+ end
182
+
183
+ FORMAT_TO_SAVE.each do |format|
184
+ if format == 'marc'
185
+ puts
186
+ aFile = File.new("#{filename}\.mrc","a+")
187
+ aFile.write(final_taken.marc.to_marc)
188
+ puts "#{final_taken.marc['245']['a']} saved in #{filename}\.mrc"
189
+ aFile.close
190
+ puts
191
+ elsif format == 'xml'
192
+ #puts final_taken.marc.to_xml
193
+ aFile = File.new("#{filename}\.xml","a+")
194
+ aFile.write(final_taken.marc.to_xml)
195
+ puts "#{final_taken.marc['245']['a']} saved in #{filename}\.xml"
196
+ aFile.close
197
+ elsif format == 'zebra'
198
+ #puts final_taken.to_xml
199
+ File.open("#{File.expand_path("~")}/.zcc/zebra/records/#{Time.now.strftime("%Y%m%d%H%M%S")}\.mrc", "w") do |f|
200
+ f.write final_taken.marc.to_marc
201
+ end
202
+ Dir.chdir("#{File.expand_path("~")}/.zcc/zebra") do
203
+ record_update = `zebraidx update records`
204
+ puts record_update
205
+ end
206
+ #saving to koha2 is untested. Please let me know if it doesn't work--or even if it does.
207
+ elsif format == 'koha2'
208
+ puts
209
+ out = Tempfile.new("koha2-")
210
+ out << final_taken.marc.to_marc
211
+ out.close
212
+ koha_save = `perl /usr/local/koha/intranet/scripts/misc/migration_tools/bulkmarcimport.pl -v 6 -file #{out.path}`
213
+ puts koha_save
214
+ puts
215
+ end
216
+ end
217
+
218
+ if CSV
219
+ puts
220
+ csvFile = File.new("csv-#{filename}\.txt","a+")
221
+ csvFile.write(csv)
222
+ puts "csv for #{final_taken.marc['245']['a']} saved in csv-#{filename}\.txt"
223
+ csvFile.close
224
+ puts
225
+ end
226
+ end
227
+
228
+ }