mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2025-07-06 06:21:39 +02:00
Compare commits
14 Commits
b396fba043
...
v6.1
Author | SHA1 | Date | |
---|---|---|---|
3eddbc3e22
|
|||
dbf59f784c
|
|||
0ffa4c8d37
|
|||
970d0c074e
|
|||
6b2b899957
|
|||
dfaa234a90
|
|||
f46e81b8cd
|
|||
dbd8721579
|
|||
a234b39064
|
|||
80a336f94d
|
|||
5ebf4930cf
|
|||
8e01595cc1
|
|||
8b3aac610d
|
|||
c2d7535d01
|
12
.github/workflows/maven.yml
vendored
12
.github/workflows/maven.yml
vendored
@ -12,13 +12,15 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 8
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
@ -4,12 +4,16 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
## [6.1] - 2022-10-31
|
||||
### Updated
|
||||
- Update dependencies in `pom.xml`
|
||||
- `iso_3166-1.json` from iso-codes 4.11.0
|
||||
|
||||
### Changed
|
||||
- Java compiler and target from JDK 7 to JDK 8
|
||||
|
||||
### Added
|
||||
- New `FixLowQualityThumbnails` script to detect and remove more low-quality thumbnails
|
||||
|
||||
### Fixed
|
||||
- `FixJpgJpgThumbnails` and `FixLowQualityThumbnails` scripts not commiting changes when operating on a site, community, or collection
|
||||
|
10
README.md
10
README.md
@ -5,7 +5,7 @@ DSpace curation tasks and other Java-based helpers used on the [CGSpace](https:/
|
||||
- **FixJpgJpgThumbnails**: fix low-quality ".jpg.jpg" thumbnails by replacing them with their originals
|
||||
- **FixLowQualityThumbnails**: remove low-quality thumbnails when PDF bitstreams are present
|
||||
|
||||
Tested on DSpace 6.3. Read more about the [DSpace curation system](https://wiki.lyrasis.org/display/DSDOC5x/Curation+System).
|
||||
Tested on DSpace 6.3. Read more about the [DSpace curation system](https://wiki.lyrasis.org/display/DSDOC6x/Curation+System).
|
||||
|
||||
## Build and Install
|
||||
|
||||
@ -52,6 +52,14 @@ This project was initially created according to the [Maven Getting Started Guide
|
||||
$ mvn -B archetype:generate -DgroupId=io.github.ilri.cgspace -DartifactId=cgspace-java-helpers -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
|
||||
```
|
||||
|
||||
To deploy a new `-SNAPSHOT` release to Maven Central (make sure OSSHRH credentials are in `~/.m2/settings.xml`):
|
||||
|
||||
```console
|
||||
$ mvn clean deploy
|
||||
```
|
||||
|
||||
See: <a href="https://central.sonatype.org/publish/publish-maven/#performing-a-snapshot-deployment">Performing a Snapshot Deployment</a>
|
||||
|
||||
## License
|
||||
This work is licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
||||
|
||||
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>io.github.ilri.cgspace</groupId>
|
||||
<artifactId>cgspace-java-helpers</artifactId>
|
||||
<version>6.1-SNAPSHOT</version>
|
||||
<version>6.1</version>
|
||||
|
||||
<name>cgspace-java-helpers</name>
|
||||
<url>https://github.com/ilri/cgspace-java-helpers</url>
|
||||
@ -94,7 +94,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||
<plugin>
|
||||
|
@ -59,10 +59,9 @@ public class FixJpgJpgThumbnails {
|
||||
DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
|
||||
if (parent != null) {
|
||||
switch (parent.getType()) {
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.COMMUNITY:
|
||||
List<Collection> collections = ((Community) parent).getCollections();
|
||||
@ -71,9 +70,13 @@ public class FixJpgJpgThumbnails {
|
||||
context,
|
||||
itemService.findAllByCollection(context, collection));
|
||||
}
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.ITEM:
|
||||
processItem(context, (Item) parent);
|
||||
|
@ -76,10 +76,9 @@ public class FixLowQualityThumbnails {
|
||||
DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
|
||||
if (parent != null) {
|
||||
switch (parent.getType()) {
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.COMMUNITY:
|
||||
List<Collection> collections = ((Community) parent).getCollections();
|
||||
@ -88,9 +87,13 @@ public class FixLowQualityThumbnails {
|
||||
context,
|
||||
itemService.findAllByCollection(context, collection));
|
||||
}
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.SITE:
|
||||
process(context, itemService.findAll(context));
|
||||
case Constants.COLLECTION:
|
||||
process(
|
||||
context,
|
||||
itemService.findByCollection(context, (Collection) parent));
|
||||
context.commit();
|
||||
break;
|
||||
case Constants.ITEM:
|
||||
processItem(context, (Item) parent);
|
||||
@ -119,6 +122,8 @@ public class FixLowQualityThumbnails {
|
||||
|
||||
private static void processItem(Context context, Item item)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
System.out.println("FixLowQualityThumbnails: processing item: " + item.getHandle());
|
||||
|
||||
// Set some state for the item before we iterate over the THUMBNAIL bundle
|
||||
boolean itemHasImThumbnail = false;
|
||||
|
||||
@ -159,7 +164,7 @@ public class FixLowQualityThumbnails {
|
||||
// ption will *always* be "Generated Thumbnail".
|
||||
if ("Generated Thumbnail".equals(thumbnailDescription)) {
|
||||
System.out.print("\u001b[33m");
|
||||
System.out.println("Deleting (" + item.getHandle() + "):");
|
||||
System.out.println("> Action: remove old thumbnail from THUMBNAIL bundle");
|
||||
System.out.println("> Name: »" + thumbnailName + "«");
|
||||
System.out.println("> Description: »" + thumbnailDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -173,7 +178,7 @@ public class FixLowQualityThumbnails {
|
||||
} else if (thumbnailDescription.toLowerCase().contains("thumbnail")
|
||||
&& !"IM Thumbnail".equals(thumbnailDescription)) {
|
||||
System.out.print("\u001b[33m");
|
||||
System.out.println("Deleting (" + item.getHandle() + "):");
|
||||
System.out.println("> Action: remove manually uploaded thumbnail from THUMBNAIL bundle");
|
||||
System.out.println("> Name: »" + thumbnailName + "«");
|
||||
System.out.println("> Description: »" + thumbnailDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -185,7 +190,7 @@ public class FixLowQualityThumbnails {
|
||||
// a thumbnail for a journal or a limited access item.
|
||||
} else {
|
||||
System.out.print("\u001b[34m");
|
||||
System.out.println("Skipping (" + item.getHandle() + "):");
|
||||
System.out.println("> Action: skip other thumbnail in THUMBNAIL bundle");
|
||||
System.out.println("> Name: »" + thumbnailName + "«");
|
||||
System.out.println("> Description: »" + thumbnailDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -250,7 +255,7 @@ public class FixLowQualityThumbnails {
|
||||
&& (originalName.toLowerCase().contains("thumbnail")
|
||||
|| originalDescription.toLowerCase().contains("thumbnail"))) {
|
||||
System.out.print("\u001b[33m");
|
||||
System.out.println("Removing (" + item.getHandle() + "):");
|
||||
System.out.println("> Action: remove thumbnail from ORIGINAL bundle");
|
||||
System.out.println("> Name: »" + originalName + "«");
|
||||
System.out.println("> Description: »" + originalDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
@ -260,7 +265,7 @@ public class FixLowQualityThumbnails {
|
||||
|
||||
} else {
|
||||
System.out.print("\u001b[34m");
|
||||
System.out.println("Skipping (" + item.getHandle() + "):");
|
||||
System.out.println("> Action: skip other bitstream in ORIGINAL bundle");
|
||||
System.out.println("> Name: »" + originalName + "«");
|
||||
System.out.println("> Description: »" + originalDescription + "«");
|
||||
System.out.print("\u001b[0m");
|
||||
|
@ -27,6 +27,7 @@
|
||||
{
|
||||
"alpha_2": "KP",
|
||||
"alpha_3": "PRK",
|
||||
"common_name": "North Korea",
|
||||
"name": "Korea, Democratic People's Republic of",
|
||||
"cgspace_name": "Korea, DPR",
|
||||
"numeric": "408",
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user