Giter Site home page Giter Site logo

jmusixmatch's Introduction

jMusixMatch Build Status Maven Central

A Java wrapper for the MusixMatch API

Installation with Maven

<dependency>
  <groupId>com.sachinhandiekar</groupId>
  <artifactId>jMusixMatch</artifactId>
  <version>1.1.4</version>
</dependency>

If you prefer using the latest snapshot build, include the following lines to your pom.xml.

    <repositories>
        <repository>
            <id>oss.snapshots</id>
            <name>OSS Sonatype Snapshot Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.sachinhandiekar</groupId>
            <artifactId>jMusixMatch</artifactId>
             <version>1.1.5-SNAPSHOT</version>
        </dependency>
    </dependencies>

Usage

  • Declaring the MusixMatch Instance
String apiKey = "Your MusixMatch API Key";
MusixMatch musixMatch = new MusixMatch(apiKey);
  • Fuzzy Search
String trackName = "Don't stop the Party";
String artistName = "The Black Eyed Peas";

// Track Search [ Fuzzy ]
Track track = musixMatch.getMatchingTrack(trackName, artistName);
TrackData data = track.getTrack();

System.out.println("AlbumID : "    + data.getAlbumId());
System.out.println("Album Name : " + data.getAlbumName());
System.out.println("Artist ID : "  + data.getArtistId());
System.out.println("Album Name : " + data.getArtistName());
System.out.println("Track ID : "   + data.getTrackId());
  • Getting Lyrics
int trackID = data.getTrackId();

Lyrics lyrics = musixMatch.getLyrics(trackID);

System.out.println("Lyrics ID       : "     + lyrics.getLyricsId());
System.out.println("Lyrics Language : "     + lyrics.getLyricsLang());
System.out.println("Lyrics Body     : "     + lyrics.getLyricsBody());
System.out.println("Script-Tracking-URL : " + lyrics.getScriptTrackingURL());
System.out.println("Pixel-Tracking-URL : "  + lyrics.getPixelTrackingURL());
System.out.println("Lyrics Copyright : "    + lyrics.getLyricsCopyright());
  • Search Tracks
// The following will search for tracks with matching artist_name 'Eminem'
List<Track> tracks = musixMatch.searchTracks("", "Eminem", "", 10, 10, true);

for (Track trk : tracks) {
    TrackData trkData = trk.getTrack();
 
    System.out.println("AlbumID : "     + trkData.getAlbumId());
    System.out.println("Album Name : "  + trkData.getAlbumName());
    System.out.println("Artist ID : "   + trkData.getArtistId());
    System.out.println("Artist Name : " + trkData.getArtistName());
    System.out.println("Track ID : "    + trkData.getTrackId());
    System.out.println();
}

Dependencies

Contact Me

jmusixmatch's People

Contributors

dependabot[bot] avatar dummybubbletea avatar kyledhebert avatar rmeertens avatar sachin-handiekar avatar ugurk avatar vishal-chandra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jmusixmatch's Issues

Unit test for the API Endpoints

Create unit test for the below endpoints -

API Methods

  • chart.artists.get
  • chart.tracks.get
  • track.search
  • track.get
  • track.subtitle.get
  • track.lyrics.get
  • track.snippet.get
  • track.lyrics.post
  • track.lyrics.feedback.post
  • matcher.lyrics.get
  • matcher.track.get
  • matcher.subtitle.get
  • artist.get
  • artist.search
  • artist.albums.get
  • artist.related.get
  • album.get
  • album.tracks.get
  • tracking.url.get
  • catalogue.dump.get

JMusixMatch returning error

I just gone through your JMusixMatch java library on git and I must say a big kudos to you.

I'm having a slight issue. I'm trying to use the .getMatchingTrack function with another parameter aside the sample trackName and artistName u gave but I'm getting an error.

The error is : com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 999.99999296056 at line 1 column 103 path $.message.header.confidence

Please help with solution and what I might have done wrong.

Thank you as I await your prompt response.

Error: Expected a string but was BEGIN_OBJECT

Hi there,

First of all thank you for your great jobyou've done with this project.

I have been using it for a while but lately it stopped working and threw this exception. I thought maybe Musixmatch itself changed something in the response and the library is not up to date.

Give it a look.

Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 143 path $.message.body
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at org.jmusixmatch.MusixMatch.handleErrorResponse(MusixMatch.java:301)
at org.jmusixmatch.MusixMatch.getTrackResponse(MusixMatch.java:279)
at org.jmusixmatch.MusixMatch.getMatchingTrack(MusixMatch.java:249)

Thank you.

Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.