public void playSong( String username, long sidSong, int clientQueuePosition ) throws IOException { MDOSong song = daoSong.get( username, sidSong ); if ( song != null ) { MessicRadioPlugin mrp = getPlugin(); File mp3song = new File( song.calculateAbsolutePath( daoSettings.getSettings() ) ); if ( mp3song.exists() ) { MessicRadioSong mrs = new MessicRadioSong(); mrs.songFile = mp3song; mrs.authorName = song.getAlbum().getAuthor().getName(); mrs.albumName = song.getAlbum().getName(); mrs.albumyear = song.getAlbum().getYear(); MDOAlbumResource mar = song.getAlbum().getCover(); if ( mar != null ) { mrs.coverImage = new File( mar.calculateAbsolutePath( daoSettings.getSettings() ) ); } mrs.songSid = song.getSid(); mrs.songName = song.getName(); mrs.trackNumber = song.getTrack(); mrs.albumGenre = ( song.getAlbum().getGenre() != null ? song.getAlbum().getGenre().getName() : "" ); mrs.albumComments = song.getAlbum().getComments(); mrs.clientQueuePosition = clientQueuePosition; mrp.castSong( mrs ); } } }
public byte[] getAlbumCover( Integer preferredWidth, Integer preferredHeight ) throws SidNotFoundMessicException, ResourceNotFoundMessicException, IOException { long songSid = getInfo().songSid; if ( songSid > 0 ) { MDOSong song = daoSong.get( songSid ); if ( song != null ) { return apialbum.getAlbumCover( new User( song.getOwner() ), song.getAlbum().getSid(), preferredWidth, preferredHeight ); } } return null; }
ai.setAlbum( song.getAlbum().getName() ); ai.setArtists( new PersonWithRole[] { new PersonWithRole( song.getAlbum().getAuthor().getName() ) } ); ai.setDate( "" + song.getAlbum().getYear() ); List<DescMeta> listdm = new ArrayList<DescMeta>(); ai.setDescMetadata( listdm ); ai.setCreator( song.getAlbum().getAuthor().getName() ); ai.setGenres( new String[] { song.getAlbum().getGenre().getName() } ); ai.setParentID( song.getOwner().getSid() + MessicContainer.SEPARATOR + song.getAlbum().getAuthor().getSid() + MessicContainer.SEPARATOR + song.getAlbum().getSid() ); ai.setId( song.getOwner().getSid() + MessicContainer.SEPARATOR + song.getAlbum().getAuthor().getSid() + MessicContainer.SEPARATOR + song.getAlbum().getSid() + MessicContainer.SEPARATOR + song.getSid() ); ai.setTitle( song.getName() ); ai.setOriginalTrackNumber( song.getTrack() );
authors.put( song.getAlbum().getAuthor(), "" );
/** * copy constructor * * @param mdosong {@link MDOSong} */ public Song( MDOSong mdosong, boolean includeAlbumInfo, boolean includeAuthorInfo ) { if ( mdosong != null ) { setSid( mdosong.getSid() ); setTrack( mdosong.getTrack() ); setName( mdosong.getName() ); setVolume( mdosong.getVolume() ); if ( includeAlbumInfo ) { Album album = new Album( mdosong.getAlbum(), includeAuthorInfo, false, false ); setAlbum( album ); } setFileName( mdosong.getLocation() ); setRate( mdosong.getRate() ); } }