Package us.jyg.freshet.manager

Examples of us.jyg.freshet.manager.SongManager


    public void seek(SongManager songManager) {
        String libPath = System.getProperty("freshet.libpath");
        log.info("Starting seeker();");
        if (libPath != null && !"".equals(libPath)) {
            final String[] paths = libPath.split(";");
            final SongManager finalSongManager = songManager;
             new Thread("SEEKER") {
                public void run() {
                    if (building) {
                        log.debug("Seeker waiting for db to finish building...");
                    } else {
                        log.debug("Seeker starting again...");
                        for(int i=0; i< paths.length; i++) {
                            Miner miner = new Miner(paths[i]);
                            log.debug("Seeker mining at: " + paths[i]);
                            File f;
                            while( (f=miner.next()) != null) {
                                if (f.getName().matches(".*[mM][pP]3")) {
                                    if (!finalSongManager.songIsInDb(f)) {
                                        try {
                                            SongData songData = new SongData(f);
                                            Song song = finalSongManager.saveSong(songData);
                                            log.debug("Added: " + song.getName() + " ("+song.getId() +")"+
                                                    ", " + song.getAlbum().getName() +
                                                    ", " + song.getArtist().getName() +
                                                    ", " + song.getGenre().getName());
                                        } catch (SongDataException sdE) {
View Full Code Here


public class Loader {
  protected final static Log log = LogFactory.getLog(Loader.class);
 
  public static void main(String[] args) {
    FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext("resources/Spring/applicationContext.xml");   
    SongManager songManager = (SongManager)ctx.getBean("songManager", SongManager.class);
   
    Miner miner = new Miner("/shared/My Music/a");
    File f;
    int count = 0;
    while( (f=miner.next()) != null) {
      try {
        if (f.getName().matches(".*[mM][pP]3")) {
          SongData songData = new SongData(f);
          Song song = songManager.saveSong(songData);
          count++;
          log.debug("Saved: " + song.getName() + " ("+song.getId() +")"+
              ", " + song.getAlbum().getName() +
              ", " + song.getArtist().getName() +
              ", " + song.getGenre().getName());
View Full Code Here

TOP

Related Classes of us.jyg.freshet.manager.SongManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.