GithubHelp home page GithubHelp logo

cover_finder's Introduction

Cover Finder

Cover finder is a java library for get a music cover from cover services, the library can iterate over diferent cover services searching the cover.

  • Search over diferent cover services
  • Add other cover services

How its works

Search a cover:

//Define the services to use

ICoverService lastFM =  new LastFmCoverService("your-api-key","your-secret");
ICoverService iTunes = new ITunesCoverService();

//Add the services to the invoquer
InvokerService invoquer = new InvokerService();
invoquer.addCoverService(lastFM);
invoquer.addCoverService(iTunes);

//Perfom the seearch
CoverResult cover = invoquer.execute("Master of puppets","Metallica");

If the invoquer not found the cover in the first service it will search in the second service and successively.

Providers

The providers use the cover service to get the cover in a especific format or using some extra funcionallity, you can create your own providers and using it in your especific applications. For instance mi application need a input stream of the cover and if the invoquer have not cover i need a default image,there is a example in the Using a provider secction

Using a provider

You can use a provider to get the cover in expecific format, by default the input stream provider is included, this provider use a UrlHandler to get a inputStream from url and a folderHandler to get a image from a local folder:

 //Define objects

        //Define all services

        ICoverService lastFM =  new LastFmCoverService("your-api-key","your-secret");       
        ICoverService iTunes = new ITunesCoverService();

        //Create invoker

        InvokerService invoquer = new InvokerService();

        invoquer.addCoverService(lastFM);
        invoquer.addCoverService(iTunes);

        //Create handler
        
        URLImageHandler urlHandler = new URLImageHandler();
        CustomFolderImageHandler customFolderHandler = new CustomFolderImageHandler();


        InputStreamCoverProvider coverProvider = new InputStreamCoverProvider(invoquer,urlHandler,customFolderHandler,"testFolder/test.png",InputStreamCoverProvider.MEDIUM_SIZE);


        InputStream imageStream = coverProvider.getCover("Fake name","Fake Artist");

Create your own provider

You can create your own provider implementing the ICoverProvider

Create yout own Cover services

By default Last FM and ITunes service are implemented but you can add new cover services implementing the ICoverService

More documentation

For extra examples of use you can see the test.

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.