MusicSearcher/src/main/java/moe/nekojimi/musicsearcher/Main.java

67 lines
2.1 KiB
Java
Raw Normal View History

2021-09-27 11:34:11 +01:00
/*
* 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;
2021-09-27 11:34:11 +01:00
2021-09-29 17:19:09 +01:00
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;
2021-10-01 13:22:59 +01:00
import moe.nekojimi.musicsearcher.providers.MetaSearcher;
2021-09-29 17:19:09 +01:00
import moe.nekojimi.musicsearcher.providers.Searcher;
2021-09-27 11:34:11 +01:00
/**
*
* @author jim
*/
2021-10-01 13:22:59 +01:00
public class Main
2021-09-27 11:34:11 +01:00
{
2021-09-29 17:19:09 +01:00
private static final Map<String, Searcher> searchers = new HashMap<>();
2021-10-01 13:22:59 +01:00
2021-09-27 11:34:11 +01:00
/**
* @param args the command line arguments
*/
2021-10-01 13:22:59 +01:00
public static void main(String[] args) throws IOException
2021-09-27 11:34:11 +01:00
{
2021-09-29 17:19:09 +01:00
// System.out.println("Hello world!");
2021-10-01 13:22:59 +01:00
2021-09-29 17:19:09 +01:00
System.out.println(searchers);
2021-10-01 13:22:59 +01:00
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)
2021-09-29 17:19:09 +01:00
{
2021-10-01 13:22:59 +01:00
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
2021-09-29 17:19:09 +01:00
}
2021-09-27 11:34:11 +01:00
}
}