Package com.pugh.sockso.music

Examples of com.pugh.sockso.music.Track


        d.setProperties( p );
       
        final Artist artist = TestUtils.getArtist();
        final Album album = TestUtils.getAlbum(artist);
        final Genre genre = TestUtils.getGenre();
        final Track track = new Track.Builder()
                .artist( artist )
                .album( album )
                .genre( genre )
                .id(3)
                .name("track")
                .number(4)
                .path("")
                .dateAdded(new Date())
                .build();

        final String path = d.getTrackZipPath( track );
       
        assertTrue( path.contains(artist.getName()) );
        assertTrue( path.contains(album.getName()) );
        assertTrue( path.contains(track.getName()) );
        assertTrue( path.contains("04") ); // tens should be padded
       
    }
View Full Code Here


    public void handleRequest() throws SQLException, IOException, BadRequestException {
       
        final Request req = getRequest();
        final int trackId = Integer.parseInt( req.getUrlParam( 1 ) );

        final Track track = Track.find( getDatabase(), trackId );

        if ( track == null ) {
            throw new BadRequestException( "Invalid track ID", 404 );
        }
View Full Code Here

            rs = st.executeQuery();

            node.removeAllChildren();

            while ( rs.next() ) {
                final Track track = Track.createFromResultSet( rs );
                final MusicTreeNode child = new MusicTreeNode( track );
                node.add( child );
            }

            reloadNode( node );
View Full Code Here

                Album album = (Album) item;
                sql = Track.getSelectFromSql() +
                        " where t.album_id = '" + album.getId() + "' ";
            }
            else if ( type.equals(MusicItem.TRACK) ) {
                Track track = (Track) item;
                sql = Track.getSelectFromSql() +
                        " where t.id = '" + track.getId() + "' ";
            }

            if ( sql != null ) {
               
                ResultSet rs = null;
                PreparedStatement st = null;
               
                try {
                   
                    st = db.prepare( sql );
                    rs = st.executeQuery();
                    int index = locationToIndex( location );

                    while ( rs.next() ) {
                        Track track = Track.createFromResultSet(rs);
                        if ( index < 1 ) model.addElement( track );
                            else model.insertElementAt( track, index + 1 );
                    }

                }
View Full Code Here

           
            JLabel c = (JLabel) super.getListCellRendererComponent( list, value, index, isSelected, focus );
           
            // just displaying a normal track?
            if ( value instanceof Track ) {
                Track track = (Track) value;
                c.setText( getTrackDisplay(track) );
            }

            // this is the dummy item, so we're dragging
            else {
View Full Code Here

     */
   
    @Override
    public void handleRequest() throws SQLException, BadRequestException, IOException {
      
        final Track track = Track.find(
            getDatabase(),
            Integer.parseInt( getRequest().getUrlParam(2) )
        );

        if ( track == null ) {
View Full Code Here

            rs = st.executeQuery();
           
            if ( !rs.next() )
                throw new BadRequestException( locale.getString("www.error.trackNotFound"), 404 );
           
            final Track track = Track.createFromResultSet( rs );
            final TResolvePath tpl = new TResolvePath();
           
            tpl.setTrack( track );
            getResponse().showJson( tpl.makeRenderer() );
           
View Full Code Here

       
        final Server s = createNiceMock( Server.class );
       
        final TestResponse res = new TestResponse();
        final TXspf tpl = new TXspf();
        final Track track = TestUtils.getTrack();
        final String protocol = "hTTppTT";
       
        tpl.setRequest( req );
        tpl.setProtocol( protocol );
        tpl.setTracks( new Track[] {track} );
        tpl.setProperties( new StringProperties() );
       
        res.showTemplate( tpl.makeRenderer() );
       
        final String data = res.getOutput();
       
        assertTrue( data.length() > 0 );
        assertTrue( data.contains(track.getName()) );
        assertTrue( data.contains(protocol) );
       
    }
View Full Code Here

        final List<Album> albums = new ArrayList<Album>();

        final Artist artist = TestUtils.getArtist();
        final Album album = TestUtils.getAlbum(artist);
        final Genre genre = TestUtils.getGenre();
        final Track track = TestUtils.getTrack(artist, album, genre);

        tracks.add( track );
        artists.add( artist );
        albums.add( album );
       
        b.setResponse( res );
        b.showLatest( tracks, artists, albums );
       
        final String data = res.getOutput();

        assertTrue( data.contains(artist.getName()) );
        assertTrue( data.contains(track.getName()) );
       
    }
View Full Code Here

           
            rs = st.executeQuery();

            final List<Track> tracks = new ArrayList<Track>();
            while ( rs.next() ) {
                final Track track = Track.createFromResultSet( rs );
                track.setPlayCount( rs.getInt("playCount") );
                tracks.add( track );
            }
           
            return tracks;
View Full Code Here

TOP

Related Classes of com.pugh.sockso.music.Track

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.