Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a9155f7
Development: updated 'date' tag matching and removed 'date' tag redun…
Luizerko Jul 20, 2023
523a29a
Development: CI updates and test corrections for isort
Luizerko Jul 21, 2023
69a52db
Development: CI updates
Luizerko Jul 21, 2023
1aa9d31
Development: fixing bugs on data extraction for existing tags.
Luizerko Jul 24, 2023
daf410a
Development: multiple JSONs for multiple videos inside the same record
Luizerko Jul 28, 2023
39c97d7
Git: recommiting because of wrong origin
Luizerko Jul 28, 2023
5d5eeb3
Development: fixing return type bug
Luizerko Jul 28, 2023
a59c37e
Development: bug fixed to handle controlfield only marcxml
Luizerko Jul 31, 2023
5731330
Development: tag 8564 added to model
Luizerko Aug 1, 2023
393daf1
Development: bug on tag 8564 fixed and made 'not_indexed' video the m…
Luizerko Aug 4, 2023
84df891
Development: changed not_indexed tag set and fixed a bug when reading…
Luizerko Aug 16, 2023
b7c9718
Development: fixing name bug for non-indexed videos and tag 246 added
Luizerko Aug 17, 2023
f23b6f2
Development: new tags added to existing properties
Luizerko Aug 18, 2023
3fd87e6
Documentation: fixing missing docstring error
Luizerko Aug 18, 2023
4e6bb8f
Documentation: fixing missing docstring error
Luizerko Aug 18, 2023
fa92d48
Development: '_digitization' field added to the sceham and tags added…
Luizerko Aug 21, 2023
67131fe
Development: video test revision, bug fixing on new read tags
Luizerko Aug 22, 2023
09eaa24
Development: bug fixed on tag capturing and new version of tests for …
Luizerko Aug 22, 2023
520c154
Development: updated deposit video schema and modified tests to inclu…
Luizerko Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 2.7
python-version: 3.6

- name: Install dependencies
run: |
python -m pip install --upgrade "pip>=20,<21" "setuptools>=40,<46" wheel
python -m pip install --upgrade "pip==21" "setuptools==40" wheel
- name: Build package
# Remove `compile_catalog` if the package has no translations.
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
#python-version: [2.7, 3.6]
python-version: [2.7]
requirements-level: [min, pypi]
python-version: [3.6]
#python-version: [2.7]
requirements-level: [pypi]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Generate dependencies
run: |
python -m pip install --upgrade "pip>=20,<21" "setuptools>=40,<46" py
python -m pip install --upgrade "pip==21" "setuptools==40" py
python -m pip install wheel coveralls requirements-builder configparser
requirements-builder --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt

- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }}
Expand Down
44 changes: 39 additions & 5 deletions cds_dojson/marc21/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ignore_value)

from ..models.base import model
from .utils import build_contributor, build_contributor_from_508
from .utils import build_contributor, build_contributor_from_508, build_contributor_from_906


@model.over('recid', '^001')
Expand Down Expand Up @@ -54,14 +54,22 @@ def report_number(self, key, value):
return rn


@model.over('contributors', '^(100|700|508)__')
@model.over('contributors', '^(100|700|508|906)__')
def contributors(self, key, value):
"""Contributors."""
authors = self.get('contributors', [])
if key in ['100__', '700__']:
items = build_contributor(value)
else:
elif key == '508__':
items = build_contributor_from_508(value)
else:
items = build_contributor_from_906(value)
if 'contributors' in self.keys():
names = [dic['name'] for dic in self['contributors']]
roles = [dic['role'] for dic in self['contributors']]
if items[0]['name'] in names:
if items[0]['role'] == roles[names.index(items[0]['name'])]:
items = None
# add only contributors that are not part of the authors
if items:
authors.extend(
Expand All @@ -87,17 +95,43 @@ def translations(self, key, value):
translation = self.get('translations', [{}])[0]
if key.startswith('246'):
translation['title'] = {'title': value.get('a')}
if value.get('n'):
translation['description'] = value.get('n')
if value.get('p'):
translation['title']['subtitle'] = value.get('p')
if key.startswith('590'):
translation['description'] = value.get('a')
translation['language'] = 'fr'
self['translations'] = [translation]
raise IgnoreKey('translations')


@model.over('description', '^520__')
@model.over('description', '(^511__)|(^5111_)|(^518__)|(^520__)')
def description(self, key, value):
"""Description."""
return value.get('a')
if key == '511__' or key == '5111_':
if value.get('a'):
return 'Filmed people: ' + value.get('a')
elif value.get('1'):
return 'Filmed people: ' + value.get('1')
return ''

if key == '518__':
if value.get('a'):
if 'description' in self.keys():
return self['description'] + '\nPlace and/or date of event: ' + value.get('a')
return value.get('a')
if 'description' in self.keys():
return self['description']
return ''

if value.get('a'):
if 'description' in self.keys():
return self['description'] + '\nPlace and/or date of event: ' + value.get('a')
return value.get('a')
if 'description' in self.keys():
return self['description']
return ''


@model.over('keywords', '^6531_')
Expand Down
23 changes: 21 additions & 2 deletions cds_dojson/marc21/fields/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _get_correct_video_contributor_role(role):
'autor': 'Creator',
'camera': 'Camera Operator',
'camera & sound': 'Camera Operator',
'chairperson': 'Chairperson',
'co-produced by': 'Co-Producer',
'co-production': 'Co-Producer',
'commentaire': 'Comments by',
Expand Down Expand Up @@ -119,6 +120,7 @@ def _get_correct_video_contributor_role(role):
'made by': 'Creator',
'montage': 'Editor',
'narrator': 'Narrator',
'organiser': 'Organiser',
'presentator': 'Reporter',
'presented by': 'Reporter',
'presenter': 'Reporter',
Expand Down Expand Up @@ -146,6 +148,7 @@ def _get_correct_video_contributor_role(role):
'shooting and editing': ('Camera Operator', 'Editor'),
'son': 'Music by',
'speaker': 'Speaker',
'sponsor': 'Sponsor',
'writen by': 'Screenwriter',
'writer and director': ('Screenwriter', 'Director'),
'written & directed by': ('Screenwriter', 'Director'),
Expand Down Expand Up @@ -227,8 +230,16 @@ def build_contributor(value):
# Avoids a few calls
value = get_author_info_from_people_collection(value)

role = _get_correct_video_contributor_role(
value.get('e', 'producer')) # always unicode
if value.get('e'):
role = _get_correct_video_contributor_role(
value.get('e', 'producer')) # always unicode
else:
try:
role = _get_correct_video_contributor_role(
value.get('g', 'producer')) # always unicode
except:
role = 'Producer'

contributors = []
contributor = {
'ids': _extract_json_ids(value) or None,
Expand Down Expand Up @@ -270,3 +281,11 @@ def build_contributor_from_508(value):
return contributors
else:
return build_contributor({'a': item.strip(), 'e': 'credits'})

def build_contributor_from_906(value):
"""Build contributors from field 508."""
contributor = {'name': value.get('p'), 'role': 'Speaker'}
if value.get('u'):
contributor['affiliations'] = (value.get('u'))

return [contributor]
Loading