View printllmc856.py
import sys | |
from pymarc import Record, MARCReader | |
reader = MARCReader(file(sys.argv[1])) | |
print "ALT LOOKUP, Provider, URL" | |
for rec in reader: |
View write_excel_to_marc.py
#!/usr/bin/env python | |
import sys | |
from pymarc import Field, Reader, Record, MARCWriter | |
import xlrd | |
#script timer | |
import time | |
start_time = time.time() |
View ldapBackEnd.py
""" | |
Add below to settings.py | |
AUTHENTICATION_BACKENDS = ( | |
'ldapBackend.LDAPBackend', | |
'django.contrib.auth.backends.ModelBackend', | |
) | |
Requires python-ldap |
View linked880iiixrec.py
#pass in elementree tree obj | |
#pass call linked_value('245', subfields=['a', 'c']) | |
def linked_fields(self): | |
linked_fields = [] | |
for field in self.var_fields: | |
rec_tag = field.findtext('MARCINFO/MARCTAG') | |
if '880' == rec_tag: | |
linked_fields.append((field.findall('MARCSUBFLD'), field)) |
View parse_mt_diss.py
from xml.etree.ElementTree import ElementTree | |
import urllib | |
source_url = 'http://etd.lib.montana.edu/etd/view/locations-markers.php' | |
source = urllib.urlopen(source_url) | |
tree = ElementTree() | |
doc = tree.parse(source) | |
print'<?xml version="1.0" encoding="UTF-8"?>' |
View summon_search.py
""" | |
Search Summon API with Python. | |
See Dough Chesnut's Code4Lib mailing list post: http://serials.infomotions.com/code4lib/archive/2010/201010/2408.html | |
""" | |
import httplib2 | |
import urllib | |
from datetime import datetime | |
import hmac | |
import base64 | |
import hashlib |
View library_reports_models.py
class Accession(models.Model): | |
"""Sample for recording library statistics. | |
Use indexes for faster query time..""" | |
number = models.CharField(max_length=15, primary_key=True) | |
created = models.DateField(db_index=True) | |
acquisition_method = models.CharField(max_length=50, db_index=True) | |
format = models.CharField(max_length=50, db_index=True) | |
location = models.CharField(max_length=50, db_index=True) | |
volumes = models.IntegerField() |
View search_z3950.py
""" | |
Simple script to search a Z39.50 target using Python | |
and PyZ3950. | |
""" | |
from PyZ3950 import zoom | |
ISBNs = ['9781905017799', '9780596513986'] |
View write_marc_from_xls.py
import xlrd, sys | |
from pymarc import Field, Reader, Record, MARCWriter | |
#script timer | |
import time | |
start_time = time.time() | |
"""Script that reads data from an Excel sheet and converts the records to MARC format. | |
Sample incoming data is in Chinese, UTF 8. Would work for other languages as well. |
View read_bluebook.py
import sys | |
import csv | |
csv_file = csv.DictReader(open(sys.argv[1])) | |
for row in csv_file: | |
print row['bluebook'], row['journal'] |
OlderNewer