diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..517574c Binary files /dev/null and b/.DS_Store differ diff --git a/cce_search/.DS_Store b/cce_search/.DS_Store new file mode 100644 index 0000000..ddbf327 Binary files /dev/null and b/cce_search/.DS_Store differ diff --git a/cce_search/__init__.py b/cce_search/__init__.py index bbd5265..ba98f0d 100644 --- a/cce_search/__init__.py +++ b/cce_search/__init__.py @@ -35,6 +35,10 @@ def create_app(test_config=None): def about(): return render_template('about.html') + @app.route('/results') + def results(): + return render_template('results.html') + # a simple page that says hello @app.route('/registration-classes') diff --git a/cce_search/search.py b/cce_search/search.py index d2e08c6..e262495 100644 --- a/cce_search/search.py +++ b/cce_search/search.py @@ -12,34 +12,69 @@ bp = Blueprint('search', __name__) @bp.route('/') def index(): results = None - term = None + title = None paging=None + sentTitle = None search_type = "ft" - if request.args: - term = request.args['term'] - if request.args['type'] == 'ft': - response = search(request.args['term'], request.args.get('page'), - request.args.get('per_page')) - elif request.args['type'] == 'reg': - search_type = "reg" - term = term.strip().upper() - response = reg_search(term, - request.args.get('page'), - request.args.get('per_page')) - else: - search_type = "ren" - term = term.strip().upper() - response = ren_search(term, - request.args.get('page'), - request.args.get('per_page')) - - paging = proc_pagination(response['data']['paging'], - request.args.get('page')) - results = proc_results(response) + arguments = request.args.get("title") or request.args.get("renewal") or request.args.get("registration") or request.args.get("author") or request.args.get("publisher") + #print("TEST HERE") + #print(request.args) + #print(request.args.get("title")) + print("----------------------------------------------------------") + unique = 0 + if not arguments: + print("NO ARGUMENTS GIVEN. PLEASE GIVE ARGUMENTS") + else: + if request.args.get("renewal"): + results = ren_search(request.args['renewal'], request.args.get('page'), + request.args.get('per_page')) + paging = proc_pagination(results['data']['paging'], request.args.get('page')) + unique = 1 + + + if request.args.get("registration") and unique == 0: + results = reg_search(request.args['registration'], request.args.get('page'), + request.args.get('per_page')) + paging = proc_pagination(results['data']['paging'], request.args.get('page')) + unique = 1 #technically not 100% unique but should be very simplified for now + + if request.args.get("title") and unique == 0: + title = request.args['title'] + results = search(title, request.args.get('page'), + request.args.get('per_page')) + paging = proc_pagination(results['data']['paging'], + request.args.get('page')) + + + if request.args.get("author") and unique == 0: + results = search(request.args['author'], request.args.get('page'), + request.args.get('per_page')) + paging = proc_pagination(results['data']['paging'], + request.args.get('page')) + + + if request.args.get("publisher") and unique == 0: + results = search(request.args['publisher'], request.args.get('page'), + request.args.get('per_page')) + paging = proc_pagination(results['data']['paging'], + request.args.get('page')) + #paging = proc_pagination(results['data']['paging'], + # request.args.get('page')) + + print("PRINTING PAGING HERE") + print(paging) + + results = proc_results(results) + print(results) + + if results == []: + print("NO RESULTS") + noresults = 1 + return render_template('search/index.html', noresults=noresults) - return render_template('search/index.html', results=results, term=term, - paging=paging, search_type=search_type) + return render_template('search/index.html', results=results, term=title, + paging=paging, search_type=search_type) def proc_results(r): @@ -49,7 +84,6 @@ def proc_results(r): def enhance_results(r): if r.get('type') == 'renewal': return r - return {**r, **{'original': strip_tags(r.get('xml')), 'is_post_1963': is_post_1963(r.get('registrations')), 'is_foreign': is_foreign(r.get('registrations')), @@ -63,7 +97,7 @@ def strip_tags(xml): return "" -def ia_url(src): +def ia_url(src): #return src return "{}#page/{:d}/mode/1up".format(ia_stream(src.get('url', '')), src.get('page', 0)) diff --git a/cce_search/static/background.jpg b/cce_search/static/background.jpg new file mode 100644 index 0000000..01c446b Binary files /dev/null and b/cce_search/static/background.jpg differ diff --git a/cce_search/static/books.jpg b/cce_search/static/books.jpg new file mode 100644 index 0000000..ad8e461 Binary files /dev/null and b/cce_search/static/books.jpg differ diff --git a/cce_search/static/collage.docx b/cce_search/static/collage.docx new file mode 100644 index 0000000..fcc5064 Binary files /dev/null and b/cce_search/static/collage.docx differ diff --git a/cce_search/static/cover-collage-2.jpg b/cce_search/static/cover-collage-2.jpg new file mode 100644 index 0000000..4f4d3ba Binary files /dev/null and b/cce_search/static/cover-collage-2.jpg differ diff --git a/cce_search/static/cover-collage.jpg b/cce_search/static/cover-collage.jpg new file mode 100644 index 0000000..466b182 Binary files /dev/null and b/cce_search/static/cover-collage.jpg differ diff --git a/cce_search/static/garside_career.jpg b/cce_search/static/garside_career.jpg new file mode 100644 index 0000000..2940172 Binary files /dev/null and b/cce_search/static/garside_career.jpg differ diff --git a/cce_search/static/in_the_days_of_giants.jpg b/cce_search/static/in_the_days_of_giants.jpg new file mode 100644 index 0000000..032df4b Binary files /dev/null and b/cce_search/static/in_the_days_of_giants.jpg differ diff --git a/cce_search/static/little_women.jpg b/cce_search/static/little_women.jpg new file mode 100644 index 0000000..c95b7e5 Binary files /dev/null and b/cce_search/static/little_women.jpg differ diff --git a/cce_search/static/ocean_steamships.jpg b/cce_search/static/ocean_steamships.jpg new file mode 100644 index 0000000..8fa7fc6 Binary files /dev/null and b/cce_search/static/ocean_steamships.jpg differ diff --git a/cce_search/static/sailor_in_spite_of_himself.jpg b/cce_search/static/sailor_in_spite_of_himself.jpg new file mode 100644 index 0000000..b686d42 Binary files /dev/null and b/cce_search/static/sailor_in_spite_of_himself.jpg differ diff --git a/cce_search/static/styles.css b/cce_search/static/styles.css index f47a9ad..299ff24 100644 --- a/cce_search/static/styles.css +++ b/cce_search/static/styles.css @@ -1,44 +1,96 @@ -.info-card { - border: 2px solid black; - border-radius: 1em; - margin-bottom: 1em; - padding-bottom: 1em; +body, html { + background: url('cover-collage-2.jpg'); + background-size: 100%; } -.info-card dt { - font-weight: bold; -} - -.info-card dd { - padding-bottom: 0.5em; -} - -.info-card ul.child-renewal { - padding-left: 0; -} - -fieldset.usa-fieldset legend { - margin-bottom: 8px; -} - -.pagination { +.content{ + margin-left:auto; + margin-right:auto; + background-color:#E4E6E9; + border: solid #969FAA 3px; + border-radius: 35px; + text-align: center; + width: 60%; + padding: 20px 30px; text-align: center; } -nav.pagination { - margin-bottom: 1rem; +.content p { + line-height: 1.5em; + margin-left:auto; + margin-right:auto; } -nav.pagination li { - display: inline-block; - padding: 0 1em; +#cprr { + width:75% } -header { - margin-top: 1rem; - padding-bottom: 1rem; +input { + width: 85%; + height:30px; + padding-left: 5px; + margin-bottom:10px; } -.usa-logo { - margin-top: 0; +.btn{ + margin-top: 0.75em } + +.header { + background: black; + /* padding:2%; */ + padding-left: 10px; + overflow: hidden; + position: sticky; + position: -webkit-sticky; + top: 0; +} + +/* FOR THE RESULTS PAGE */ + +.results { + /* position:relative; */ + width: 70%; + margin-left:auto; + margin-right:auto; + margin-top: 1em; + margin-bottom: 1em; + padding: 30px 20px; + /* padding-top:10%; */ + background-color:#E4E6E9; + border: solid #969FAA 4px; + border-radius: 46px; +} + +h3 { + margin-bottom: 1rem; +} + +ul { + margin-bottom: 0; +} + +.results p { + margin: 0; +} + +th { + width: 20%; +} + +.table-bordered td, .table-bordered th { + border: 2px solid black; + background-color: white; +} + +.title { + width: fit-content; + margin-left:auto; + margin-right:auto; + padding: 10px 20px; + /* padding-top:10%; */ + background-color:#E4E6E9; + border: solid #969FAA 4px; + border-radius: 20px; + margin-bottom: 20px; +} \ No newline at end of file diff --git a/cce_search/static/the_black_troopers.jpg b/cce_search/static/the_black_troopers.jpg new file mode 100644 index 0000000..355403c Binary files /dev/null and b/cce_search/static/the_black_troopers.jpg differ diff --git a/cce_search/static/the_border_boys_on_the_trail.jpg b/cce_search/static/the_border_boys_on_the_trail.jpg new file mode 100644 index 0000000..f4d28dc Binary files /dev/null and b/cce_search/static/the_border_boys_on_the_trail.jpg differ diff --git a/cce_search/static/where_animals_talk.jpg b/cce_search/static/where_animals_talk.jpg new file mode 100644 index 0000000..238707a Binary files /dev/null and b/cce_search/static/where_animals_talk.jpg differ diff --git a/cce_search/templates/about.html b/cce_search/templates/about.html index 492b827..730cdbd 100644 --- a/cce_search/templates/about.html +++ b/cce_search/templates/about.html @@ -1,46 +1,12 @@ {% extends 'base.html' %} -{% block header %} -

About this project

-{% endblock %} - {% block content %} -

This is an unofficial, experimental interface for searching records from the -US Copyright Office's Catalog of Copyright Entries digitized by NYPL. You -can read about the inception and progress of the project in two blog -posts: Unlocking -the Record of American Creativity—with Your Help -and https://www.nypl.org/blog/2019/05/31/us-copyright-history-1923-1964

- -

Renewals have been searchable for many years thanks to the Copyright Renewals project at Stanford. The digitization of registrations by NYPL allows us to find renewed and unrenewed works with equal ease. Search results in this interface contain registrations with their associated renewals, registrations with no known renewals, as well as renewal entries on their own.

- -

What's in the Data?

- -

This dataset contains registrations from all the book volumes of the Catalog of Copyright Entries, 1923 to 1969, but not including the “pamphlet” volumes (part 1, group 2) from 1923 to 1953. It contains all renewals from book volumes from 1923 to 1977, including “pamphlet” volumes (from Project Gutenberg transcriptions) and all renewals from all classes of works from 1978 to 1991 (from the Copyright Office database).

- -

Clearly there are many renewal records for items not yet included in the registrations but, in theory, all book renewals should be included here. That said, these search results are far from definitive. The data still requires cleanup (see How to report a problem or error below).

- -

How to report a problem or error

- -

If the problem is with this website and not the data, for instance broken -links, server errors, or ideas for improvement, you -can submit -an issue on Github.

- -

If you find an error in the data please submit in issue via the Github repository for the registrations unless you are certain that problem is in a renewal entry, in which case you can submit an issue via the renewals repository. Data problems may involve simple typos, mistakes in parsing, or missing or mistaken links between registrations and renewals. When reporting data problems, please include the CCEIDs of the entries involved. The CCEID is the string of 32 letters in numbers at the end of each record, such as “be62f40e-6d17-1014-b416-88728c01eda4”.

- -

If you are comfortable with git and editing large XML files, you can also submit a pull request.

- -

Get the Code

- -

Registration and renewal data is in the Public Domain and available from two repositories:

- - - -

Code for this website is available from its own repository: https://github.com/seanredmond/cce-search-prototype

- - -{% endblock %} +
+
+

About

+

Many books published between 1923 through 1977 may be in the public domain either because their copyright was not registered, or because their copyrights were not renewed after an initial term. Unfortunately, determining the copyright status of these books requires a review of the copyright records of registration and renewal. Unfortunately, these records were all on paper. Digital scans of these records were made, and are available from the Internet Archive, but searching the scans is not easy.

+

To make this task more manageable, work has gone underway to convert the Catalog of Copyright Entries (CCEs) into well-structured XML data. The CCEs are comprised of about 450,000 pages and are printed compilations of brief registration and renewal records. These records were published by the Copyright Office at regular intervals, ranging in length from semi-weekly to semi-annually. The CCEs are divided by classes of works, such as books, periodicals, music, drama, maps, photographs, etc. Conversion of a set of 10,000 pages of book registration records published between 1923 and 1964 has been completed, and the result is publicly available.

+

This website serves as a user-friendly interface for librarians, archivists, and rights researchers to make use of the XML data.

+
+
+{% endblock %} \ No newline at end of file diff --git a/cce_search/templates/base.html b/cce_search/templates/base.html index 346633f..09c1f2f 100644 --- a/cce_search/templates/base.html +++ b/cce_search/templates/base.html @@ -1,102 +1,50 @@ - + - - - {% block title %}{% endblock %} - CCE Search - - - - - - - + + + + + + + + + + + + Copyright Renewals + - - Skip to main content - + + {% block content %}{% endblock %} + + \ No newline at end of file diff --git a/cce_search/templates/books2.jpg b/cce_search/templates/books2.jpg new file mode 100644 index 0000000..ad8e461 Binary files /dev/null and b/cce_search/templates/books2.jpg differ diff --git a/cce_search/templates/results.html b/cce_search/templates/results.html new file mode 100644 index 0000000..856db88 --- /dev/null +++ b/cce_search/templates/results.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + + Copyright Renewals + + + + +
+
+

Static Results page

+
+
+ + + + \ No newline at end of file diff --git a/cce_search/templates/search/cceid.html b/cce_search/templates/search/cceid.html index 19a7a28..9516bbf 100644 --- a/cce_search/templates/search/cceid.html +++ b/cce_search/templates/search/cceid.html @@ -6,9 +6,11 @@ {% block content %} {% if result["type"] %} -{% include "search/render_renewal.html" %} +{% include "search/new_renewal.html" %} {% else %} -{% include "search/render_registration.html" %} +
+ {% include "search/new_registration.html" %} +
{% endif %} {% endblock %} diff --git a/cce_search/templates/search/index.html b/cce_search/templates/search/index.html index 9c92a19..7683f60 100644 --- a/cce_search/templates/search/index.html +++ b/cce_search/templates/search/index.html @@ -1,74 +1,41 @@ {% extends 'base.html' %} -{% block header %} -

{% block title %}Find Copyright Entries{% endblock %}

-{% endblock %} - - {% block content %} -
-
-

Search

-
-
- Search Type -
- - -
-
- - -
-
- - -
-
- - - - - - -
-
- -
-

Search Hints

- - -
-
- - {% if results %} -

Results

+{% block content %} +{% if results %} {% include "search/paging.html" %} - - +{% else %} - {% endif %} - {% include "search/paging.html" %} + + +
+
+

Copyright Search

+

Search for copyright registrations and renewals on books from the Catalog of Copyright Entries.

+

Find a book:

+
+
+
+
+
+
+ +
+ {% if noresults %} +
+ + {% endif %} +
+
+ + +{% endif %} + {% endblock %} diff --git a/cce_search/templates/search/new_registration.html b/cce_search/templates/search/new_registration.html new file mode 100644 index 0000000..419eefb --- /dev/null +++ b/cce_search/templates/search/new_registration.html @@ -0,0 +1,103 @@ +

Registration {{ result['registrations'][0]['number'] }}

+ + + + + + + + + + + + + + + {% if result['copies'] %} + + + + + {% endif %} + + {% if result['copy_date'] %} + + + + + {% endif %} + + {% if result['description'] %} + + + + + {% endif %} + + {% if result['pub_date'] %} + + + + + {% endif %} + + {% if result['publishers'] %} + + + + + {% endif %} + + + + + + + + + + + + + + + + + + +
Title{{ result['title'] }}
Authors + {% for a in result['authors'] %} +

{{ a }}

+ {% endfor %} +
Registrations + {% for r in result['registrations'] %} +

{{ r['number'] }} {{ r['date'] }}

+ {% endfor %} +
Copies{{ result['copies'] }}
Copy Date{{ result['copy_date'] }}
Description{{ result['description'] }}
Publication Date{{ result['pub_date'] }}
Publishers + {% for p in result['publishers'] %} +

{{p}}

+ {% endfor %} +
Renewals + {% if result['is_post_1963'] %} + Works published after 1963 do not require renewal and are in copyright + {% else %} + {% if result['renewals'] %} + {% for renewal in result['renewals'] %} + {% include "search/render_child_renewal.html" %} + {% endfor %} + {% else %} + No renewals found + {% endif %} + {% endif %} + {% if result['is_foreign'] %} +
See note on Foreign publications + {% endif %} + + {% if result['is_interim'] %} +
See note on Interim registrations + {% endif %} +
Source + + {{ result['source']['year'] }} p. {{ result['source']['page'] }} + +
Original{{ result['original'] }}
CCEID{{ result['uuid'] }}
\ No newline at end of file diff --git a/cce_search/templates/search/new_renewal.html b/cce_search/templates/search/new_renewal.html new file mode 100644 index 0000000..a2577fa --- /dev/null +++ b/cce_search/templates/search/new_renewal.html @@ -0,0 +1,51 @@ +

Renewal {{ result['renewal_num'] }}

+ + + + + + + + + + + + + + + + + + + {% if result['new_matter'] %} + + + + + {% endif %} + + {% if result['notes'] %} + + + + + {% endif %} + + {% if result['source'] %} + + + + + {% endif %} + + + + + + +
Title{{ result['title'] }}
Authors{{ result['author'] }}
Renewal{{ result['renewal_num'] }} {{ result['renewal_date'] }}
Claimants + {% for c in result['claimants'] %} +

{{ c['name'] }} ({{ c['type'] }})

+ {% endfor %} +
New Matter{{ result['new_matter'] }}
Notes{{ result['notes'] }}
Original{{ result['source'] }}
CCEID{{ result['uuid'] }} +
\ No newline at end of file diff --git a/cce_search/templates/search/paging.html b/cce_search/templates/search/paging.html index f974523..64826e1 100644 --- a/cce_search/templates/search/paging.html +++ b/cce_search/templates/search/paging.html @@ -1,29 +1,44 @@ {% if paging["has_pages"] %} - +
+ Back To Search +
+
{% else %} {% if results %} - -{% endif %} + +{% endif %} + {% endif %} diff --git a/cce_search/templates/search/render_child_renewal.html b/cce_search/templates/search/render_child_renewal.html index a5181b4..01194c7 100644 --- a/cce_search/templates/search/render_child_renewal.html +++ b/cce_search/templates/search/render_child_renewal.html @@ -1,17 +1,13 @@ -
- +

{{ renewal['renewal_num'] }} {{ renewal['renewal_date'] }} - -

+

-
-
+

{{ renewal['author'] }} {{ renewal['title'] }} -

+

-
diff --git a/cce_search/templates/search/render_registration.html b/cce_search/templates/search/render_registration.html index fcd3206..5b06887 100644 --- a/cce_search/templates/search/render_registration.html +++ b/cce_search/templates/search/render_registration.html @@ -1,73 +1,68 @@ -
-

Registration {{ result['registrations'][0]['number'] }}

+<<<<<<< HEAD -
-
-
Title
-
{{ result['title'] }}
+

Title: {{ result['title'] }}

+
+ +======= +

Registration {{ result['registrations'][0]['number'] }}

+
+ +
+
Title
+
{{ result['title'] }}
+
+>>>>>>> 64bb8e084d56712426a580424bbea10580ed97dc -
Authors
-
-
    +
    +
    Authors
    {% for a in result['authors'] %} -
  • {{ a }}
  • +
    -{{ a }}
    +
    {% endfor %} -
-
+
-
Registrations
-
- -
+
{% if result['copies'] %} -
Copies
-
{{ result['copies'] }}
+
Copies
+ {{ result['copies'] }} {% endif %} {% if result['copy_date'] %} -
Copy Date
-
{{ result['copy_date'] }}
+
Copy Date
+ {{ result['copy_date'] }} {% endif %} {% if result['description'] %} -
Description
-
{{ result['description'] }}
+
Description
+ {{ result['description'] }} {% endif %} {% if result['pub_date'] %} -
Publication Date
-
{{ result['pub_date'] }}
+
Publication Date
+ {{ result['pub_date'] }} {% endif %} {% if result['publishers'] %} -
Publishers
-
- -
{% endif %} -
Renewals
-
+
Renewals
{% if result['is_post_1963'] %} Works published after 1963 do not require renewal and are in copyright {% else %} {% if result['renewals'] %} - {% else %} No renewals found {% endif %} @@ -80,26 +75,16 @@ {% if result['is_interim'] %}

See note on Interim registrations

{% endif %} - -
Source
-
+
Source
{{ result['source']['year'] }} p. {{ result['source']['page'] }} - -
Original
-
{{ result['original'] }}
+
Original
+ {{ result['original'] }} -
CCEID
-
+
CCEID
{{ result['uuid'] }} - - - + - - - - diff --git a/cce_search/templates/search/render_renewal.html b/cce_search/templates/search/render_renewal.html index 4e594f5..b6ed3c4 100644 --- a/cce_search/templates/search/render_renewal.html +++ b/cce_search/templates/search/render_renewal.html @@ -1,7 +1,5 @@ -
-

Renewal {{ result['renewal_num'] }}

-
+

Renewal {{ result['renewal_num'] }}

Title
{{ result['title'] }}
@@ -43,6 +41,4 @@ {{ result['uuid'] }}
-
-