Examples of Song


Examples of us.jyg.freshet.dao.model.Song

      saveSong(song);
      return song;
  }

  public Song renameSong(Integer songId, String newName) {
    Song s = songDao.getSong(songId);
    if (s != null)
      s.setName(newName);
    songDao.saveObject(s);
    return songDao.getSong(songId);
   
  }
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

    return songDao.getSong(songId);
   
  }
 
  public void setSongWeight(Integer id, Integer weight) {
    Song song = songDao.getSong(id);
    song.setWeight(weight);
    songDao.saveObject(song);
  }
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

  public Song getRandomSong(SongAttribute attr) {
    // base random number
    double randomPercent = (new Random()).nextDouble();
    List<Integer> weights = songDao.getWeights(attr);
    // get a total sum of the weights
    Song randomSong = null;
    if (weights.size() > 0) {
      double totalWeightSum = 0;
      for (Iterator itr=weights.iterator(); itr.hasNext();)
        totalWeightSum += ((Integer)itr.next()).intValue();
      // the target weight is the number we want to reach when adding weights from the list of songs
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

        }
        try {
                    ObjectOutputStream oos = new ObjectOutputStream(baos);
          Iterator i = getSongs().iterator();
          while(i.hasNext()) {
            Song s = (Song)i.next();
            oos.writeObject(s);
          }
          oos.close();
          baos.close();
        } catch (Exception e) {
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

        if (f.getName().matches(".*[mM][pP]3")) {
          SongData songData = new SongData(f);
          Album album = albumDao.getAlbum(songData.getAlbum());
          Artist artist = artistDao.getArtist(songData.getArtist());
          Genre genre = genreDao.getGenre(songData.getGenre());
          Song song = new Song(songData.getName(), songData.getPath(), songData
              .getTrack(), album, artist, genre);
          songDao.saveSong(song);
//          log.debug("Saved: " + song.getName() + " ("+song.getId() +")"+
//              ", " + song.getAlbum().getName() +
//              ", " + song.getArtist().getName() +
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

  }
 
  public void testGetSong() {
    for(Iterator itr=songs.iterator(); itr.hasNext();) {
      Integer id = ((Song)itr.next()).getId();
      Song song = songDao.getSong(id);
      assertNotNull(song);
      Album album = song.getAlbum();
      assertNotNull(album);
      String albumName = album.getName();
      assertNotNull(albumName);
      assertFalse(albumName.equals(""));
    }
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

      assertFalse(albumName.equals(""));
    }
  }

  public void testGetSongs(SongAttribute attr) {
    Song song = (Song)songDao.getSongs().get(0);
    Album album = song.getAlbum();
    assertNotNull(album);
    assertNotNull(album.getId());
    assertTrue(album.getId() > 0);
    assertNotNull(album.getName());
//    List<Song> songs = songDao.getSongs(album);
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

      try {
        Thread.sleep(1000);
      } catch (InterruptedException iE) {
        log.error("Empty Randomzier sleeper woken up... weird .");
      }
      Song s = SongQ.getInstance().next();
      log.debug(s.getName());
    }
  }
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

    songFactory.create("test/data");
    SongQ songQ = SongQ.getInstance();
    assertEquals(0, songQ.size());
    List<Song> allSongs = songManager.getSongs();
    for (Iterator itr=allSongs.iterator(); itr.hasNext();) {
      Song song = (Song)itr.next();
      songQ.up(song, "test");
    }
    assertEquals(allSongs.size(), songQ.size());
  }
View Full Code Here

Examples of us.jyg.freshet.dao.model.Song

    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());
        }
      } catch (SongDataException sdE) {
        log.error("Could not process file: " +f.getAbsolutePath());
      }
      if (count % 100 == 0) log.debug("Count " + count);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.