Package us.jyg.freshet.dao.model

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


  public void setBrowseAlbumDisplay(FreshetForm ff, User user) {
    log.debug("entering setBrowseAlbumDisplay");
    Integer albumId = new Integer(ff.getBrowseId());
    ff.setBrowseAlbum(albumManager.getAlbum(albumId));
    ff.setBrowseItems(songManager.getSongs(ff.getBrowseAlbum()));
    Song song0 = (Song)ff.getBrowseItems().get(0);
    ff.setBrowseGenre(song0.getGenre());
    ff.setBrowseArtist(song0.getArtist());
    ff.setBrowseType(Constants.BROWSE_ALBUM);
        ff.setUser((user==null)?new Guest():user);
        ff.setNextBrowseType(Constants.BROWSE_SONG);
  }
View Full Code Here


public class QueueUpService {

    private final Log log = LogFactory.getLog(getClass());

    public void queueSong(FreshetForm ff) {
        Song song = songManager.getSong(new Integer(ff.getQueueId()));
    songQ.up(song, "");
        songManager.modifySongWeight(song, 1);
    }
View Full Code Here

    }

    public void insertSong(FreshetForm ff) {
        int qId = Integer.parseInt(ff.getQueueId());
        Song s = songManager.getSong(qId);
        if (ff.getUser()==null)
            ff.setUser(new Guest());

        songManager.modifySongWeight(s, 1);
        songQ.insertSong(s, Integer.parseInt(ff.getInsertIdx()), ff.getUser().getUsername());
View Full Code Here

    public List<Song> findSongs(String pattern) {return songDao.searchSongs(pattern);}

  public void saveSong(Song song) {songDao.saveSong(song);}

    public boolean songIsInDb(File songFile) {
        Song s = songDao.getSongByFile(songFile);
        if (s == null)
            return false;
        else
            return true;
    }
View Full Code Here

    public Song saveSong(SongData songData) {
      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);
      saveSong(song);
      return song;
  }
View Full Code Here

      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

    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

  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

        }
        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

        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

TOP

Related Classes of us.jyg.freshet.dao.model.Song

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.