scogsdb.1.0.2.source-code.Launcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discogsdb Show documentation
Show all versions of discogsdb Show documentation
Simple Java library for Discogs's Database API
/*
* Copyright (c) 2017 BlizzedRu (Ivan Vlasov)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ru.blizzed.discogsdb.*;
import ru.blizzed.discogsdb.model.Error;
import ru.blizzed.discogsdb.model.Page;
import ru.blizzed.discogsdb.model.artist.ArtistRelease;
import ru.blizzed.discogsdb.params.DiscogsDBParams;
import ru.blizzed.discogsdb.params.SortOrderParam;
import ru.blizzed.discogsdb.params.SortParam;
import java.util.Timer;
import java.util.TimerTask;
import static ru.blizzed.discogsdb.params.DiscogsDBParams.QUERY;
public class Launcher {
public static void main(String[] args) {
DiscogsDBApi.initialize(new DiscogsAuthData("BwiHMJHYCZyxebbxlzwM", "yByYmMNvGKwiClULmspcmivxkSpzsoqf"));
try {
/*long dimmuBorgirId = DiscogsDBApi.searchArtist(DiscogsDBParams.QUERY.of("Rammstein"))
.execute()
.getContent()
.get(0)
.getId();
DiscogsDBApi.getArtist(dimmuBorgirId).execute().getNameVariations().forEach(System.out::println);*/
//DiscogsDBApi.search(QUERY.of("face"), DiscogsDBParams.PER_PAGE.of(100)).execute().getAllArtists().forEach(a -> System.out.println(a.getTitle()));
DiscogsDBApi.getArtistReleases(
18837,
DiscogsDBParams.SORT.of(SortParam.Type.YEAR),
DiscogsDBParams.SORT_ORDER.of(SortOrderParam.Type.DESC),
DiscogsDBParams.PAGE.of(1)
).execute(new DiscogsDBCaller.Listener>() {
@Override
public void onComplete(Page result, DiscogsDBCaller> discogsDBCaller) {
result.getContent().forEach(r -> System.out.println(r.getTitle()));
}
@Override
public void onError(Error error, DiscogsDBCaller> discogsDBCaller) {
System.out.println(error.getMessage());
}
@Override
public void onFailure(DiscogsDBCallException e, DiscogsDBCaller> discogsDBCaller) {
e.printStackTrace();
}
});
System.out.println(DiscogsDBApi.getMasterRelease(1073909).execute().getTitle());
} catch (Exception e) {
System.out.println(e.getMessage());
} /*catch (DiscogsDBErrorException er) {
System.out.println(er.getError().getMessage());
}*/
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy