generated from Nekojimi/JavaMavenTemplate
67 lines
2.1 KiB
Java
67 lines
2.1 KiB
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package moe.nekojimi.musicsearcher;
|
|
|
|
import com.amihaiemil.eoyaml.Yaml;
|
|
import com.amihaiemil.eoyaml.YamlInput;
|
|
import com.amihaiemil.eoyaml.YamlMapping;
|
|
import com.amihaiemil.eoyaml.YamlSequence;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.Constructor;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import moe.nekojimi.musicsearcher.providers.MetaSearcher;
|
|
import moe.nekojimi.musicsearcher.providers.Searcher;
|
|
|
|
/**
|
|
*
|
|
* @author jim
|
|
*/
|
|
public class Main
|
|
{
|
|
private static final Map<String, Searcher> searchers = new HashMap<>();
|
|
|
|
/**
|
|
* @param args the command line arguments
|
|
*/
|
|
public static void main(String[] args) throws IOException
|
|
{
|
|
// System.out.println("Hello world!");
|
|
|
|
|
|
System.out.println(searchers);
|
|
String query = "eminem lose yourself";
|
|
|
|
MetaSearcher metaSearch = MetaSearcher.loadYAML(new File("searchproviders.yml"));
|
|
|
|
try
|
|
{
|
|
List<Result> results = metaSearch.searchAndWait(Query.fullText(query));
|
|
// for (Searcher searcher: searchers.values())
|
|
// {
|
|
// System.out.println("Searching " + searcher.getName() + " for " + query);
|
|
// try
|
|
// {
|
|
// List<Result> results = searcher.searchAndWait(Query.fullText(query));
|
|
for (Result result : results)
|
|
System.out.println("\t" + result);
|
|
// } catch (InterruptedException | ExecutionException ex) {
|
|
// Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
|
// }
|
|
// }
|
|
} catch (ExecutionException | InterruptedException ex)
|
|
{
|
|
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
|
}
|
|
}
|
|
}
|