Last active
May 3, 2018 20:24
-
-
Save toroidal-code/6415977 to your computer and use it in GitHub Desktop.
Revisions
-
toroidal-code revised this gist
Sep 8, 2013 . 2 changed files with 18 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,8 +6,8 @@ unit.set(xscale=1.5) # Text scale for pyx conn = zoom.Connection('z3950.loc.gov', 7090) # Which server to connect to with ZOOM #albert.rit.edu, 210 conn.databaseName = 'VOYAGER' # Which database to use #innopac conn.preferredRecordSyntax = 'USMARC' # Has to be one of available database record emissions while True: # main loop This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/usr/bin/env ruby require 'nokogiri' require 'csv' doc = Nokogiri::HTML(`curl http://isbnsearch.sourceforge.net/servers.html`) csv = CSV.open("output.csv", 'w') doc.xpath('//table//tr').each do |row| tarray = [] #temporary array row.xpath('td').each do |cell| tarray << cell.text #Build array of that row of data. end csv << tarray #Write that row out to csv file end csv.close -
toroidal-code revised this gist
Sep 8, 2013 . 1 changed file with 25 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,29 @@ #! /usr/bin/env python2 from PyZ3950 import zoom # ZOOM is the protocol from pymarc import MARCReader # This is for easily dealing with USMARC data from pyx import * # This is for exporting EPS/PDF import os # for calling lpr unit.set(xscale=1.5) # Text scale for pyx conn = zoom.Connection('z3950.loc.gov', 7090) # Which server to connect to with ZOOM conn.databaseName = 'VOYAGER' # Which database to use conn.preferredRecordSyntax = 'USMARC' # Has to be one of available database record emissions while True: # main loop i = raw_input(">> ") # grab input query = zoom.Query('CCL', str(i)) # send query with input for item in conn.search(query): # iterator for query results for rec in MARCReader(item.data): # iterator for records in result try: # python blows up if the rec['050'] record isn't accessible print rec.title() # print title for verification print rec['050']['a'] #ans = raw_input("Is this right? (y/n)") #if ans.lower() == 'y': c = canvas.canvas() c.text(0.65, 0, rec['050']['a'], [text.halign.boxcenter, trafo.rotate(-90)]) c.text(0, 0, rec['050']['b'], [text.halign.boxcenter, trafo.rotate(-90)]) c.writePDFfile() os.system("lpr isbn2.pdf") except TypeError: print "Whoops" -
toroidal-code revised this gist
Sep 7, 2013 . 1 changed file with 9 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,10 @@ #! /usr/bin/env python2 from PyZ3950 import zoom from pymarc import MARCReader from pyx import * import os unit.set(xscale=1.5) conn = zoom.Connection('z3950.loc.gov', 7090) conn.databaseName = 'VOYAGER' conn.preferredRecordSyntax = 'USMARC' @@ -15,11 +14,13 @@ for item in conn.search(query): for rec in MARCReader(item.data): try: print rec.title() print rec['050']['a'] # this grabs the LOC call number if raw_input("Is this right? (y/n)") is 'y' or 'Y': c = canvas.canvas() c.text(0.65, 0, rec['050']['a'], [text.halign.boxcenter, trafo.rotate(-90)]) c.text(0, 0, rec['050']['b'], [text.halign.boxcenter, trafo.rotate(-90)]) c.writePDFfile() os.system("lpr isbn2.pdf") except TypeError: print "Whoops" -
toroidal-code revised this gist
Sep 3, 2013 . 1 changed file with 12 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,19 +2,24 @@ from PyZ3950 import zoom from pymarc import MARCReader from pyx import * conn = zoom.Connection('z3950.loc.gov', 7090) conn.databaseName = 'VOYAGER' conn.preferredRecordSyntax = 'USMARC' while True: i = input(">> ") query = zoom.Query('CCL', str(i)) for item in conn.search(query): for rec in MARCReader(item.data): try: print rec['050']['a'] # this grabs the LOC call number print rec['050']['b'] # This grabs the item number c = canvas.canvas() c.text(0, 0.5, rec['050']['a'], [text.halign.boxcenter]) c.text(0, 0, rec['050']['b'], [text.halign.boxcenter]) c.writePDFfile() except TypeError: print "Whoops" -
toroidal-code created this gist
Sep 2, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #! /usr/bin/env python2 from PyZ3950 import zoom from pymarc import MARCReader conn = zoom.Connection('z3950.loc.gov', 7090) conn.databaseName = 'VOYAGER' conn.preferredRecordSyntax = 'USMARC' while True: text = input(">> ") query = zoom.Query('CCL', str(text)) for item in conn.search(query): read = MARCReader(item.data) for rec in read: #print rec.title() #print rec.isbn() try: print rec['050']['a'] # this grabs the LOC call number print rec['050']['b'] # This grabs the item number except TypeError: print "Whoops"