├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── 76df3287-6cda-33eb-8e9a-044b5e15ffdd_829521842.jpg ├── INSTALL.txt ├── src ├── main │ └── java │ │ └── org │ │ ├── musicbrainz │ │ ├── utils │ │ │ └── package.html │ │ ├── package.html │ │ ├── webservice │ │ │ ├── impl │ │ │ │ └── package.html │ │ │ ├── WebServiceException.java │ │ │ ├── AuthorizationException.java │ │ │ ├── ResponseException.java │ │ │ ├── ResourceNotFoundException.java │ │ │ ├── package.html │ │ │ ├── RequestException.java │ │ │ └── WebService.java │ │ ├── query │ │ │ ├── search │ │ │ │ ├── readysearches │ │ │ │ │ ├── EntitySearchInterface.java │ │ │ │ │ ├── WorkSearchbyTitle.java │ │ │ │ │ ├── LabelSearchbyName.java │ │ │ │ │ ├── ArtistSearchbyName.java │ │ │ │ │ ├── RecordingSearchbyTitle.java │ │ │ │ │ ├── WorkSearchbyArtistId.java │ │ │ │ │ ├── ReleaseGroupSearchbyTitle.java │ │ │ │ │ ├── ReleaseSearchbyTitle.java │ │ │ │ │ └── AnnotationSearchbyEntityId.java │ │ │ │ ├── CollectionSearchWs2.java │ │ │ │ ├── WorkSearchWs2.java │ │ │ │ ├── LabelSearchWs2.java │ │ │ │ ├── ReleaseSearchWs2.java │ │ │ │ ├── ArtistSearchWs2.java │ │ │ │ ├── RecordingSearchWs2.java │ │ │ │ ├── AnnotationSearchWs2.java │ │ │ │ ├── ReleaseGroupSearchWs2.java │ │ │ │ └── SearchWs2.java │ │ │ ├── submission │ │ │ │ ├── SubmissionQueryWs2.java │ │ │ │ ├── UserTagSubmissionWs2.java │ │ │ │ ├── UserRatingSubmissionWs2.java │ │ │ │ ├── SubmissionException.java │ │ │ │ ├── EntityElement.java │ │ │ │ ├── CollectionReleasesHandlerWs2.java │ │ │ │ └── EntityTypeElementList.java │ │ │ ├── browse │ │ │ │ ├── WorkBrowseWs2.java │ │ │ │ ├── LabelBrowseWs2.java │ │ │ │ ├── ArtistBrowseWs2.java │ │ │ │ ├── ReleaseBrowseWs2.java │ │ │ │ ├── RecordingBrowseWs2.java │ │ │ │ └── ReleaseGroupBrowseWs2.java │ │ │ └── QueryWs2.java │ │ ├── wsxml │ │ │ ├── element │ │ │ │ ├── package.html │ │ │ │ └── ListElement.java │ │ │ ├── MbXMLParseException.java │ │ │ ├── MbXMLException.java │ │ │ ├── package.html │ │ │ ├── MbXmlWriter.java │ │ │ └── MbXmlParser.java │ │ ├── filter │ │ │ ├── browsefilter │ │ │ │ ├── LabelBrowseFilterWs2.java │ │ │ │ ├── WorkBrowseFilterWs2.java │ │ │ │ ├── ArtistBrowseFilterWs2.java │ │ │ │ ├── RecordingBrowseFilterWs2.java │ │ │ │ ├── ReleaseGroupBrowseFilterWs2.java │ │ │ │ ├── ReleaseBrowseFilterWs2.java │ │ │ │ └── BrowseFilterWs2.java │ │ │ ├── FilterWs2.java │ │ │ ├── DiscTocFilterWs2.java │ │ │ ├── searchfilter │ │ │ │ ├── AnnotationSearchtFilterWs2.java │ │ │ │ ├── WorkSearchFilterWs2.java │ │ │ │ ├── LabelSearchFilterWs2.java │ │ │ │ ├── ArtistSearchFilterWs2.java │ │ │ │ ├── RecordingSearchFilterWs2.java │ │ │ │ ├── ReleaseGroupSearchFilterWs2.java │ │ │ │ ├── ReleaseSearchFilterWs2.java │ │ │ │ └── SearchFilterWs2.java │ │ │ └── ReleaseStatusFilterWs2.java │ │ ├── model │ │ │ ├── searchresult │ │ │ │ ├── AnnotationResultWs2.java │ │ │ │ ├── WorkResultWs2.java │ │ │ │ ├── LabelResultWs2.java │ │ │ │ ├── ArtistResultWs2.java │ │ │ │ ├── ReleaseResultWs2.java │ │ │ │ ├── CollectionResultWs2.java │ │ │ │ ├── RecordingResultWs2.java │ │ │ │ ├── ReleaseGroupResultWs2.java │ │ │ │ ├── SearchResultWs2.java │ │ │ │ └── listelement │ │ │ │ │ ├── WorkSearchResultsWs2.java │ │ │ │ │ ├── LabelSearchResultsWs2.java │ │ │ │ │ ├── AnnotationSearchResultsWs2.java │ │ │ │ │ ├── ArtistSearchResultsWs2.java │ │ │ │ │ ├── RecordingSearchResultsWs2.java │ │ │ │ │ ├── ReleaseSearchResultsWs2.java │ │ │ │ │ ├── CollectionSearchResultsWs2.java │ │ │ │ │ └── ReleaseGroupSearchResultsWs2.java │ │ │ ├── OffsetWs2.java │ │ │ ├── entity │ │ │ │ ├── listelement │ │ │ │ │ ├── WorkListWs2.java │ │ │ │ │ ├── OffsetListWs2.java │ │ │ │ │ ├── DiscListWs2.java │ │ │ │ │ ├── ArtistListWs2.java │ │ │ │ │ ├── ReleaseListWs2.java │ │ │ │ │ ├── LabelListWs2.java │ │ │ │ │ ├── RecordingListWs2.java │ │ │ │ │ ├── CollectionListWs2.java │ │ │ │ │ └── ReleaseGroupListWs2.java │ │ │ │ └── CollectionWs2.java │ │ │ ├── TagWs2.java │ │ │ ├── RatingsWs2.java │ │ │ ├── AnnotationListWs2.java │ │ │ ├── AnnotationWs2.java │ │ │ ├── RelationListWs2.java │ │ │ ├── LifeSpanWs2.java │ │ │ ├── TrackListWs2.java │ │ │ ├── ReleaseEventListWs2.java │ │ │ ├── ArtistCreditWs2.java │ │ │ ├── LabelInfoListWs2.java │ │ │ ├── CoverArtArchiveWs2.java │ │ │ ├── LabelInfoWs2.java │ │ │ ├── NameCreditWs2.java │ │ │ ├── ReleaseEventWs2.java │ │ │ ├── PuidWs2.java │ │ │ ├── IsrcWs2.java │ │ │ └── AliasWs2.java │ │ ├── MBWS2Exception.java │ │ ├── discid │ │ │ └── DiscIdException.java │ │ ├── coverart │ │ │ ├── ImageGetter.java │ │ │ └── GetterExample.java │ │ └── includes │ │ │ ├── WorkIncludesWs2.java │ │ │ ├── ReleaseGroupIncludesWs2.java │ │ │ ├── RecordingIncludesWs2.java │ │ │ └── CollectionIncludesWs2.java │ │ └── mc2 │ │ └── util │ │ └── exceptions │ │ └── MC2Exception.java └── test │ └── resources │ └── log4j.xml ├── nbproject ├── genfiles.properties └── project.xml ├── AUTHORS.txt ├── .github └── workflows │ ├── publish.yaml │ └── main.yaml ├── COPYING.txt ├── README.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | 3 | ## Android Studio/IntelliJ 4 | .idea 5 | *.iml -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/schnatterer/musicbrainzws2-java/nusicFork/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /76df3287-6cda-33eb-8e9a-044b5e15ffdd_829521842.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/schnatterer/musicbrainzws2-java/nusicFork/76df3287-6cda-33eb-8e9a-044b5e15ffdd_829521842.jpg -------------------------------------------------------------------------------- /INSTALL.txt: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ------------------------- 3 | 4 | Use the ant targets in build/build.xml to run the unit tests, 5 | build the project or generate the javadoc. -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/utils/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |Various utilities to simplify common tasks.
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |Provides a collection of classes for MusicBrainz XML Web Service 2.
7 |Default implementation of a web service.
7 | 8 | 9 | 10 | @see org.musicbrainz.webservice.WebService 11 | 12 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/query/search/readysearches/EntitySearchInterface.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.query.search.readysearches; 2 | 3 | import java.util.List; 4 | 5 | public interface EntitySearchInterface { 6 | 7 | public List getFullList(); 8 | public List getFirstPage(); 9 | public List getNextPage(); 10 | 11 | public boolean hasMore(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/wsxml/element/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |This package contains some helper classes for the parser (mainly representing xml elements)
7 | 8 | 9 | @see org.musicbrainz.wsxml.MbXmlParser 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/filter/browsefilter/LabelBrowseFilterWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.filter.browsefilter; 2 | 3 | import java.util.Map; 4 | 5 | public class LabelBrowseFilterWs2 extends BrowseFilterWs2 6 | { 7 | 8 | public LabelBrowseFilterWs2() { 9 | super(); 10 | } 11 | @Override 12 | public MapA parser for the Music Metadata XML Format (MMD).
7 |8 | This module contains {@link org.musicbrainz.wsxml.impl.JDOMParserWs2}, which parses the 9 | Music Metadata XML Format (MMD) returned by the MusicBrainz webservice. 10 | There are also DOM helper functions in this module used by the parser which probably 11 | aren't useful to users. 12 |
13 |14 | You can implement your own {@link org.musicbrainz.wsxml.MbXmlParser} and inject it 15 | through one of the {@link org.musicbrainz.query.QueryWs2} constructors to use it.
16 | 17 | 18 | @see org.musicbrainz.wsxml.impl.JDOMParserWs2 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/webservice/ResponseException.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.webservice; 2 | 3 | /** 4 | * Server returned invalid data. 5 | */ 6 | public class ResponseException extends WebServiceException { 7 | 8 | /** 9 | * 10 | */ 11 | public ResponseException() { 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | /** 16 | * @param message 17 | * @param cause 18 | */ 19 | public ResponseException(String message, Throwable cause) { 20 | super(message, cause); 21 | // TODO Auto-generated constructor stub 22 | } 23 | 24 | /** 25 | * @param message 26 | */ 27 | public ResponseException(String message) { 28 | super(message); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @param cause 34 | */ 35 | public ResponseException(Throwable cause) { 36 | super(cause); 37 | // TODO Auto-generated constructor stub 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/test/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |Classes for interacting with the MusicBrainz XML web service.
8 |Implementations of the {@link org.musicbrainz.webservice.WebService} interface talk to 9 | a server implementing the MusicBrainz XML web service. They mainly handle URL generation 10 | and network I/O. Extend {@link org.musicbrainz.webservice.DefaultWebServiceWs2} if maximum 11 | control is needed.
12 |The {@link org.musicbrainz.query.QueryWs2} class provides a convenient interface to 13 | the most commonly used features of the web service. By default it uses 14 | {@link org.musicbrainz.webservice.impl.HttpClientWebServiceWs2} to retrieve data and 15 | {@link org.musicbrainz.wsxml.impl.JDOMParserWs2} to parse the responses. The results are 16 | object trees using the MusicBrainz domain model.
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/filter/FilterWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.filter; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | *A filter for collections.
7 | * 8 | *This is the interface all filters have to implement. Filter classes 9 | * are initialized with a set of criteria and are then applied to 10 | * collections of items. The criteria are usually strings or integer 11 | * values, depending on the filter.
12 | * 13 | * @author Patrick Ruhkopf 14 | */ 15 | public interface FilterWs2 { 16 | 17 | /** 18 | * Create a map of query parameters. 19 | * 20 | * This method creates a list of (parameter, value)
21 | * tuples, based on the contents of the implementing subclass.
22 | * parameter is a string containing a parameter name
23 | * and value an arbitrary string. No escaping of those
24 | * strings is required.
25 | *
26 | * @return A map containing (key, value) pairs.
27 | */
28 | public MapRepresents a Tag for an entity (not release at the moment). 7 | * count is the times this tag has been added by different people.
8 | */ 9 | public class TagWs2 10 | { 11 | public TagWs2(){ 12 | 13 | } 14 | public TagWs2(String name){ 15 | this.name = name; 16 | } 17 | private static Logger log = Logger.getLogger(TagWs2.class.getName()); 18 | /** 19 | * The tag 20 | */ 21 | private String name; 22 | /** 23 | * The count of peoples who adds this tag 24 | */ 25 | private Long count; 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | /** 35 | * @return the count 36 | */ 37 | public Long getCount() { 38 | return count; 39 | } 40 | 41 | /** 42 | * @param count the count to set 43 | */ 44 | public void setCount(Long count) { 45 | this.count = count; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/query/submission/UserRatingSubmissionWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.query.submission; 2 | 3 | import org.musicbrainz.model.RatingsWs2; 4 | import org.musicbrainz.model.TagWs2; 5 | import org.musicbrainz.model.entity.EntityWs2; 6 | import org.musicbrainz.webservice.WebService; 7 | 8 | /** 9 | * List of Ratings to be submitted to the Web Service. 10 | * 11 | **/ 12 | public class UserRatingSubmissionWs2 extends SubmissionWs2{ 13 | 14 | 15 | public UserRatingSubmissionWs2(){ 16 | 17 | super(RATING_POST); 18 | 19 | } 20 | public UserRatingSubmissionWs2(WebService ws){ 21 | super(ws, RATING_POST); 22 | } 23 | @Override 24 | protected EntityElement setData(EntityWs2 entity, String entityType) { 25 | 26 | EntityElement el = new EntityElement(); 27 | el.setEntityType(entityType); 28 | el.setId(entity.getId()); 29 | 30 | RatingsWs2 rating = entity.getUserRating(); 31 | //rating must be postet in percent ratio. 32 | el.setUserRating(Math.round(rating.getAverageRating()/5*100)); 33 | 34 | return el; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/model/RatingsWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.model; 2 | 3 | import java.util.logging.Logger; 4 | 5 | /** 6 | 7 | */ 8 | public class RatingsWs2 9 | { 10 | 11 | private static Logger log = Logger.getLogger(RatingsWs2.class.getName()); 12 | 13 | /** 14 | * the numebr of people who votes 15 | */ 16 | private Long votesCount=0L; 17 | /** 18 | * the average rating 19 | */ 20 | private Float averageRating=0F; 21 | 22 | /** 23 | * @return the votesCount 24 | */ 25 | public Long getVotesCount() { 26 | return votesCount; 27 | } 28 | 29 | /** 30 | * @param votesCount the votesCount to set 31 | */ 32 | public void setVotesCount(Long votesCount) { 33 | this.votesCount = votesCount; 34 | } 35 | 36 | /** 37 | * @return the averageRating 38 | */ 39 | public Float getAverageRating() { 40 | return averageRating; 41 | } 42 | 43 | /** 44 | * @param averageRating the averageRating to set 45 | */ 46 | public void setAverageRating(Float averageRating) { 47 | this.averageRating = averageRating; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/model/AnnotationListWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.musicbrainz.model.AnnotationWs2; 7 | import org.musicbrainz.wsxml.element.ListElement; 8 | 9 | 10 | /** 11 | * A list of Annotations 12 | */ 13 | public class AnnotationListWs2 extends ListElement{ 14 | 15 | private ListAnnotation Text for any Entity
7 | * 8 | */ 9 | public class AnnotationWs2 extends EntityWs2 10 | { 11 | 12 | private String type; 13 | private String name; 14 | private String entity; 15 | private String text; 16 | 17 | public AnnotationWs2() { 18 | 19 | } 20 | 21 | public String getType() { 22 | return type; 23 | } 24 | public void setType(String type) { 25 | this.type = type; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | public void setName(String title) { 32 | this.name = title; 33 | } 34 | 35 | public String getEntity() { 36 | return entity; 37 | } 38 | public void setEntity(String entity) { 39 | this.entity = entity; 40 | } 41 | 42 | public String getText() { 43 | return text; 44 | } 45 | public void setText(String text) { 46 | this.text = text; 47 | } 48 | 49 | 50 | @Override 51 | public String toString() { 52 | return "annotation mbid: "+getEntity(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/filter/browsefilter/ReleaseGroupBrowseFilterWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.filter.browsefilter; 2 | 3 | import java.util.Map; 4 | import org.musicbrainz.filter.ReleaseTypeFilterWs2; 5 | 6 | public class ReleaseGroupBrowseFilterWs2 extends BrowseFilterWs2 7 | { 8 | private ReleaseTypeFilterWs2 releaseTypeFilter =new ReleaseTypeFilterWs2(); 9 | 10 | public ReleaseGroupBrowseFilterWs2() { 11 | super(); 12 | } 13 | 14 | @Override 15 | public MapA List of disc offsets referred by a disc
12 | 13 | */ 14 | public class OffsetListWs2 extends ListElement 15 | { 16 | private static Logger log = Logger.getLogger(OffsetListWs2.class.getName()); 17 | 18 | private ListA List of Disc Info (Disc & catalog number)referred by a release
13 | 14 | */ 15 | public class DiscListWs2 extends ListElement 16 | { 17 | private static Logger log = Logger.getLogger(DiscListWs2.class.getName()); 18 | 19 | /** 20 | * A string containing the complete credit as join 21 | * of credit names in the list. 22 | */ 23 | 24 | private ListArrayList if {@link #artists} is null.
36 | *
37 | * @param artist
38 | */
39 | public void addArtist(ArtistWs2 artist)
40 | {
41 | if (artists == null) {
42 | artists = new ArrayListA Life Span definition. 8 | * * The definition of the begin date depends on the Entity 9 | * type. For persons, this is the day of birth, for groups 10 | * and Labels is the day was founded 11 | * 12 | * The returned date has the format 'YYYY', 'YYYY-MM', or 13 | * 'YYYY-MM-DD', depending on how much detail is known. 14 | * 15 | * * The definition of the end date depends on the artist's 16 | * type. For persons, this is the day of death, for groups 17 | * and Labels it is the day was dissolved. 18 | * 19 | * The returned date has the format 'YYYY', 'YYYY-MM', or 20 | * 'YYYY-MM-DD', depending on how much detail is known. 21 | 22 | *
23 | */ 24 | public class LifeSpanWs2 25 | { 26 | private static Logger log = Logger.getLogger(LifeSpanWs2.class.getName()); 27 | 28 | private String begin; 29 | private String end; 30 | private boolean ended=false; 31 | 32 | public LifeSpanWs2(String begin, String end, boolean ended) 33 | { 34 | this.begin= begin; 35 | this.end = end; 36 | this.ended = ended; 37 | } 38 | public String getBegin(){ 39 | return begin; 40 | } 41 | public String getEnd(){ 42 | return end; 43 | } 44 | public boolean getEnded(){ 45 | return ended; 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/model/searchresult/listelement/AnnotationSearchResultsWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.model.searchresult.listelement; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.musicbrainz.model.AnnotationListWs2; 7 | import org.musicbrainz.model.searchresult.AnnotationResultWs2; 8 | import org.musicbrainz.wsxml.element.ListElement; 9 | 10 | public class AnnotationSearchResultsWs2 extends ListElement{ 11 | 12 | protected ListArrayList if {@link #collections} is null.
36 | *
37 | * @param collection
38 | */
39 | public void addCollection(CollectionWs2 collection)
40 | {
41 | if (collections == null) {
42 | collections = new ArrayListA filter for the work collection.
7 | * 8 | *Note that the name and query properties
9 | * may not be used together.
A filter for the label collection.
7 | * 8 | *Note that the name and query properties
9 | * may not be used together.
A filter for the artist collection.
7 | * 8 | *Note that the name and query properties
9 | * may not be used together.
ArrayList if {@link #artistResults} is null.
19 | *
20 | * @param artistResult The artist result to add
21 | */
22 | public void addArtistResult(ArtistResultWs2 artistResult)
23 | {
24 | if (getArtistResults() == null) {
25 | artistResults = new ArrayListA filter for the recording collection.
8 | * 9 | *Note that these filter properties properties and query
10 | * may not be used together.
A List of Track Info (Track & catalog number)referred by a release
13 | * 14 | */ 15 | public class TrackListWs2 extends ListElement 16 | { 17 | private static Logger log = Logger.getLogger(TrackListWs2.class.getName()); 18 | 19 | private ListA filter for the release group collection.
7 | * 8 | *Note that these filter properties properties and query
9 | * may not be used together.
A List of Media (Medium) referred by a release
13 | 14 | */ 15 | public class ReleaseEventListWs2 extends ListElement 16 | { 17 | private static Logger log = Logger.getLogger(ReleaseEventListWs2.class.getName()); 18 | 19 | private ListArrayList if {@link #recordingResults} is null.
27 | *
28 | * @param recordingResult The track result to add
29 | */
30 | public void addRecordingResult(RecordingResultWs2 recordingResult)
31 | {
32 | if (recordingResults == null) {
33 | recordingResults = new ArrayListArrayList if {@link #releaseResults} is null.
21 | *
22 | * @param releaseResult The release result to add
23 | */
24 |
25 | public void addReleaseResult(ReleaseResultWs2 releaseResult)
26 | {
27 | if (releaseResults == null) {
28 | releaseResults = new ArrayListArrayList if {@link #collectionResults} is null.
19 | *
20 | * @param collectionResult The collection result to add
21 | */
22 | public void addCollectionResult(CollectionResultWs2 collectionResult)
23 | {
24 | if (getCollectionResults() == null) {
25 | collectionResults = new ArrayListA filter for the release collection.
7 | * 8 | *Note that these filter properties properties and query
9 | * may not be used together.
List.
9 | *
10 | * @author Patrick Ruhkopf
11 | */
12 | public abstract class ListElement {
13 |
14 | /**
15 | * The actual number of list items,
16 | * see {@link #getCount()}
17 | */
18 | protected Long count;
19 |
20 | /**
21 | * The offset of the list items
22 | * see {@link #getOffset()}
23 | */
24 | protected Long offset;
25 |
26 | /**
27 | * Returns the offset of the list.
28 | *
29 | * This is used if the List is incomplete
30 | * (ie. the web service only returned part of all list items).
31 | * Note that the offset value is zero-based, which means
32 | * item 0 is the first item.
33 | *
34 | * @return the offset or null
35 | */
36 | public Long getOffset() {
37 | return offset;
38 | }
39 |
40 | /**
41 | * @param offset the offset to set
42 | */
43 | public void setOffset(Long offset) {
44 | this.offset = offset;
45 | }
46 |
47 |
48 | /**
49 | * Returns the actual number of existing list items.
50 | *
51 | * This may or may not match with the number of elements that
52 | * the List holds. If the count is higher than the
53 | * List, it indicates that the list is incomplete.
54 | *
55 | * @return the count or null
56 | */
57 | public Long getCount() {
58 | return count;
59 | }
60 |
61 | /**
62 | * @param count the count to set
63 | */
64 | public void setCount(Long count) {
65 | this.count = count;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/org/musicbrainz/model/ArtistCreditWs2.java:
--------------------------------------------------------------------------------
1 | package org.musicbrainz.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 | import java.util.logging.Logger;
6 |
7 | /**
8 | * An Artist Credit used instead of Artist for collaborations or 9 | * performance name variations.
10 | 11 | */ 12 | public class ArtistCreditWs2 13 | { 14 | private static Logger log = Logger.getLogger(ArtistCreditWs2.class.getName()); 15 | 16 | /** 17 | * A string containing the complete credit as join 18 | * of credit names in the list. 19 | */ 20 | private String artistCreditString=""; 21 | private ListA List of Label Info (Label & catalog number)referred by a release
12 | 13 | */ 14 | public class LabelInfoListWs2 extends ListElement 15 | { 16 | private static Logger log = Logger.getLogger(LabelInfoListWs2.class.getName()); 17 | 18 | /** 19 | * A string containing the complete credit as join 20 | * of credit names in the list. 21 | */ 22 | private String labelInfoString=""; 23 | 24 | private ListArrayList if {@link #releaseGroupResults} is null.
21 | *
22 | * @param releaseGroupResult The release result to add
23 | */
24 |
25 | public void addReleaseGroupResult(ReleaseGroupResultWs2 releaseGroupResult)
26 | {
27 | if (releaseGroupResults == null) {
28 | releaseGroupResults = new ArrayListA Cover Art Archive definition. 12 | * 13 | * ... nothing found in MB documentation. 14 | * see http://tickets.musicbrainz.org/browse/MBS-4536 15 | 16 | *
17 | */ 18 | public class CoverArtArchiveWs2 19 | { 20 | private static Logger log = Logger.getLogger(CoverArtArchiveWs2.class.getName()); 21 | 22 | /** 23 | * @return the log 24 | */ 25 | public static Logger getLog() { 26 | return log; 27 | } 28 | 29 | 30 | private boolean artwork=false; 31 | private boolean front=false; 32 | private boolean back=false; 33 | private int count=0; 34 | private String mbId; 35 | private ListA single Element (label and catalog) 8 | * of an LabelInfoList 9 | */ 10 | public class LabelInfoWs2 11 | { 12 | private static Logger log = Logger.getLogger(LabelInfoWs2.class.getName()); 13 | 14 | private String catalogNumber; 15 | private LabelWs2 label; 16 | 17 | public LabelInfoWs2(){} 18 | /** 19 | * Minimal Constructor 20 | * @param label the Label 21 | * @param catalogNumber the catalogNumber 22 | */ 23 | public LabelInfoWs2(LabelWs2 label,String catalogNumber) 24 | { 25 | this.label = label; 26 | this.catalogNumber = catalogNumber; 27 | } 28 | public String getCatalogNumber(){ 29 | return catalogNumber; 30 | } 31 | public void setCatalogNumber(String catalogNumber){ 32 | this.catalogNumber = catalogNumber; 33 | } 34 | public LabelWs2 getLabel(){ 35 | return label; 36 | } 37 | public void setLabel(LabelWs2 label){ 38 | this.label = label; 39 | } 40 | public String getLabelName(){ 41 | if (label==null) return ""; 42 | return label.getName(); 43 | } 44 | public String getLabelInfoString(){ 45 | 46 | String labelInfoString=""; 47 | 48 | if (label != null) 49 | { 50 | labelInfoString = label.getName(); 51 | } 52 | 53 | if (catalogNumber!=null&& !catalogNumber.equals("")) 54 | { 55 | if (labelInfoString != null && !labelInfoString.equals("")) 56 | labelInfoString = labelInfoString+" "; 57 | 58 | labelInfoString= labelInfoString+"cat.No: "+catalogNumber; 59 | } 60 | return labelInfoString; 61 | } 62 | /* (non-Javadoc) 63 | * @see java.lang.Object#toString() 64 | */ 65 | @Override 66 | public String toString() { 67 | 68 | return getLabelInfoString(); 69 | } 70 | 71 | 72 | } -------------------------------------------------------------------------------- /src/main/java/org/musicbrainz/model/NameCreditWs2.java: -------------------------------------------------------------------------------- 1 | package org.musicbrainz.model; 2 | 3 | import java.util.logging.Logger; 4 | import org.musicbrainz.model.entity.ArtistWs2; 5 | 6 | /** 7 | *
A single Element (artist or artist name variation)
8 | * of an Artist Credit
9 | */
10 | public class NameCreditWs2
11 | {
12 | private static Logger log = Logger.getLogger(NameCreditWs2.class.getName());
13 |
14 | String joinphrase=null;
15 | String name=null;
16 | ArtistWs2 artist=null;
17 | /**
18 | * Default Constructor
19 | */
20 | public NameCreditWs2()
21 | {
22 |
23 | }
24 |
25 | /**
26 | * Complete Constructor
27 | * @param joinphrase A string containing the join sentence used to build
28 | * the Artist Credit String ((i.e. &,/, and,...)
29 | * @param name A string containing the name variation used to build
30 | * the Artist Credit String
31 | * @param artist the ArtistWs2 referred by the element.
32 | */
33 | public NameCreditWs2(String joinphrase,
34 | String name,
35 | ArtistWs2 artist)
36 | {
37 | this.joinphrase = joinphrase;
38 | this.name = name;
39 | this.artist = artist;
40 | }
41 | public String getNameCreditString(){
42 |
43 | String credit="";
44 |
45 | if (name != null && !name.equals(""))
46 | {
47 | credit = name;
48 | }
49 | else if (artist !=null)
50 | {
51 | credit = artist.getName();
52 | }
53 |
54 | if (joinphrase!=null&& !joinphrase.equals(""))
55 | {
56 | credit= credit+joinphrase;
57 | }
58 | return credit;
59 | }
60 | public String getJoinphrase() {
61 | return joinphrase;
62 | }
63 | public void setJoinphrase(String joinphrase) {
64 | this.joinphrase = joinphrase;
65 | }
66 | public String getName() {
67 | return name;
68 | }
69 | public void setName(String name) {
70 | this.name = name;
71 | }
72 | public String getArtistName() {
73 | if (getArtist()==null) return "";
74 | return getArtist().getUniqueName();
75 | }
76 | public ArtistWs2 getArtist() {
77 | return artist;
78 | }
79 | public void setArtist(ArtistWs2 artist) {
80 | this.artist = artist;
81 | }
82 | @Override
83 | public String toString() {
84 |
85 | return getNameCreditString();
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/org/musicbrainz/query/submission/EntityElement.java:
--------------------------------------------------------------------------------
1 | package org.musicbrainz.query.submission;
2 |
3 | import java.util.List;
4 | import java.util.ArrayList;
5 | /**
6 | * Each Submission could contain requests for
7 | * many entities.
8 | * An EntityElement is the specific entity
9 | * request description.
10 | *
11 | **/
12 | public class EntityElement {
13 |
14 | /*
15 | * The entity type. Must be one of
16 | * LABEL
17 | * ARTIST
18 | * RELEASEGROUP
19 | * WORK
20 | * RECORDING
21 | *
22 | */
23 | private String entityType;
24 | /*
25 | * The entity id
26 | */
27 | private String id;
28 | /*
29 | * The tag list for the entity.
30 | * Notes that this wil replace the current tag list,
31 | * so be sure to include ALL the tags you want apply to this
32 | * entity.
33 | */
34 | private List A single Medium and relative TrackList.
10 |
11 | */
12 | public class ReleaseEventWs2
13 | {
14 | private static Logger log = Logger.getLogger(ReleaseEventWs2.class.getName());
15 |
16 | /**
17 | * @return the log
18 | */
19 | public static Logger getLog() {
20 | return log;
21 | }
22 |
23 | /**
24 | * @param aLog the log to set
25 | */
26 | public static void setLog(Logger aLog) {
27 | log = aLog;
28 | }
29 |
30 | private String dateString;
31 | private AreaWs2 area;
32 |
33 | /**
34 | * Default Constructor
35 | */
36 | public ReleaseEventWs2()
37 | {
38 |
39 | }
40 | /**
41 | * Parses the date string and returns a Date
42 | * @return A Date object
43 | */
44 | public Date getDate() {
45 | return dateFromdateString();
46 | }
47 |
48 | private Date dateFromdateString() {
49 | SimpleDateFormat f = new SimpleDateFormat("yyyy");
50 |
51 | if (dateString == null)
52 | return null;
53 |
54 | if (dateString.length() == 10)
55 | f = new SimpleDateFormat("yyyy-MM-dd");
56 |
57 | if (dateString.length() == 7)
58 | f = new SimpleDateFormat("yyyy-MM");
59 |
60 | try {
61 | return f.parse(dateString);
62 | } catch (ParseException e) {
63 | log.warning("Could not parse date string - returning null");
64 | return null;
65 | }
66 | }
67 | /**
68 | * @return the dateString
69 | */
70 | public String getDateString() {
71 | return dateString;
72 | }
73 |
74 | /**
75 | * @param dateString the dateString to set
76 | */
77 | public void setDateString(String dateString) {
78 | this.dateString = dateString;
79 | }
80 |
81 | /**
82 | * @return the area
83 | */
84 | public AreaWs2 getArea() {
85 | return area;
86 | }
87 |
88 | /**
89 | * @param area the area to set
90 | */
91 | public void setArea(AreaWs2 area) {
92 | this.area = area;
93 | }
94 | @Override
95 | public String toString(){
96 | return getArea().getName()+" "+getDateString();
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # musicbrainzws2-java
2 | [](https://github.com/schnatterer/musicbrainzws2-java/actions/workflows/main.yaml)
3 | [](https://sonarcloud.io/dashboard?id=info.schnatterer.musicbrainzws2-java%3Amusicbrainzws2-java)
4 |
5 | This is a fork of musicbrainzws2-java, originally hosted [here](https://code.google.com/archive/p/musicbrainzws2-java/). It includes several bugfixes as well as maven integration. The original [wiki](https://code.google.com/p/musicbrainzws2-java/w/list) was migrated and can now be found [here](https://github.com/schnatterer/musicbrainzws2-java/wiki).
6 | You can find the original Readme file [here](README.txt).
7 |
8 | This fork was implemented as part of the [nusic-app](https://github.com/schnatterer/nusic).
9 |
10 |
11 |
12 | ## How to use
13 |
14 | Add the [latest stable version of musicbrainzws2-java](https://search.maven.org/search?q=a:musicbrainzws2-java%20AND%20g:info.schnatterer.musicbrainzws2-java)
15 | to the dependency management tool of your choice.
16 |
17 | ```XML
18 |