Skip to content

Instantly share code, notes, and snippets.

class UnimarcRecord(Record):
def __init__(self, *args, **kwargs):
super(UnimarcRecord, self).__init__(*args, **kwargs)
def decode_marc(self, marc, to_unicode=False, force_utf8=False, encoding=None,
hide_utf8_warnings=False, utf8_handling='strict'):
"""
decode_marc() accepts a MARC record in transmission format as a
a string argument, and will populate the object based on the data
00599dam#a22001811i#450#
001ru\nlrt\1789057
00520061005125059.1
010##$d(В пер.)48р
035##$aru\tatar011\books2\15280
099##$x25
2001#$aТукай...:Донья халыклары Тукай турында/Тоз.Р.Акъегет
210##$aКазан$cТатар.кит.нэшр.$d2006
215##$a222б
6101#$aТукай Г
{
"_id": "50bf7a8fe1f978436a7f3d808045f584",
"_rev": "1-884a8b7c7010c482b355c003787d8069",
"harvestProtocol": "Z39.50",
"docType": "Metadata",
"dpId": "d0fcbf46d9d09ac0964c5829eb22531e",
"remoteId": "RU\\SPSTU\\analits2005\\1263",
"Metadata": {
"record": {
"leader": "01061naa2a2200205 i 450",
{
"leader": "00 0 0000 000",
"fields":{
"control":{
"001": "1234556",
"009": "1234556"
},
"data":{
// В хеше с номером поля храним массив, каждый элемент массива содержит информацию о поле. Элементов в
// массиве столько, сколько раз поле повторяется в записе. Например 606 поле
{
"_id": "32770e4b78ca7469c79d9db54e07cb53",
"_rev": "1-d54229f782517f9a2329cae7b34dc7ff",
"harvestProtocol": "Z39.50",
"docType": "Metadata",
"dpId": "d0fcbf46d9d09ac0964c5829eb22531e",
"remoteId": "RU\\SPSTU\\analits2005\\22803",
"Metadata": {
"record": {
"leader": "01841naa2a2200265 i 450",
<record syntax="1.2.840.10003.5.28">
<leader>
<length>02802</length>
<status>n</status>
<type>a</type>
<leader07>a</leader07>
<leader08>2</leader08>
<leader09>a</leader09>
<indicatorCount>2</indicatorCount>
<identifierLength>2</identifierLength>
@isergey
isergey / gist:4651567
Created January 28, 2013 00:10
mongo
#encoding: utf-8
from time import time
import datetime
import random
from pymongo import MongoClient
from bson.code import Code
from couchdb.client import Server, Database
def main():
{
"_id": "3d9c95afb4dfc100855f2764c116307b",
"_rev": "1-20e493e7985d74fd41b3f2b4bb5d3b89",
"harvestProtocol": "Directory",
"docType": "Metadata",
"dpId": "e2611cb7d105abb27d141006d616e4e6",
"remoteId": "RU/ТГПУ/PROEKT/60я72/К 68-870058",
"Metadata": {
"record": {
"leader": "00902nam0 2200253 i 4500",
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<bean id="springTask" class="task.SpringTask" />
@isergey
isergey / 0_reuse_code.js
Created February 12, 2014 12:16
4y45herrHere are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
eerh