Package com.pugh.sockso.music.tag

Examples of com.pugh.sockso.music.tag.Tag


     *
     */

    protected void addFile( final int collectionId, final File file ) throws InvalidTagException, IOException {

        final Tag tag = AudioTag.getTag( file );

  log.debug( tag.toString() );

        final int artistId = addArtist( tag.getArtist() );
        int albumArtistId = artistId;

        if ( StringUtils.isBlank(tag.getAlbumArtist()) ) {
            albumArtistId = addArtist( tag.getAlbumArtist() );
        }

        final int albumId  = addAlbum( albumArtistId, tag.getAlbum(), tag.getAlbumYear() );
        final int genreId  = addGenre( tag.getGenre() );
        final int trackId  = addTrack( artistId, albumId, tag.getTrack(),
                tag.getTrackNumber(), file, collectionId, genreId );

        if ( Utils.isFeatureEnabled( p, Constants.COLLMAN_SCAN_COVERS ) ) {

            final BufferedImage coverArt = tag.getCoverArt();
           
            if ( coverArt != null ) {
                addCoverArt( albumArtistId, "ar", coverArt );
                addCoverArt( albumId, "al", coverArt );
                addCoverArt( trackId, "tr", coverArt );
View Full Code Here


   
    private void checkTrack( final Track track, final File file ) {

        try {
           
            final Tag tag = AudioTag.getTag( file );

            // has track info changed?
            checkTrackTagInfo( tag, track );
           
            // has the artist information changed?  if it has we'll get a new
View Full Code Here

        // Verify that if tag data == track name & number in db then track is not updated
        {
            Track trackBefore = cm.getTrack(1);

            Tag newTag = createNiceMock( Tag.class );
            expect(newTag.getTrack()).andReturn(trackBefore.getName());
            expect(newTag.getTrackNumber()).andReturn(trackBefore.getNumber());
            replay(newTag);

            cm.checkTrackTagInfo(newTag, trackBefore);
            Track trackAfter = cm.getTrack(1);

            assertEquals(trackBefore.getId(), trackAfter.getId());
            assertEquals(trackBefore.getName(), trackAfter.getName());
            assertEquals(trackBefore.getNumber(), trackAfter.getNumber());
        }

        // Verify that if tag track name changes then track is updated in db
        {
            Track trackBefore = cm.getTrack(2);

            Tag newTag = createNiceMock( Tag.class );
            expect(newTag.getTrack()).andReturn( trackBefore.getName() + " changed!" ).anyTimes();
            expect(newTag.getTrackNumber()).andReturn( trackBefore.getNumber() ).anyTimes();
            replay(newTag);

            cm.checkTrackTagInfo(newTag, trackBefore);
            Track trackAfter = cm.getTrack(2);

            assertEquals(trackBefore.getId(), trackAfter.getId());
            assertFalse(trackBefore.getName().equals(trackAfter.getName()));
            assertEquals(trackBefore.getNumber(), trackAfter.getNumber());
        }

        // Verify that if tag track number changes then track is updated in db
        {
            Track trackBefore = cm.getTrack(3);

            Tag newTag = createNiceMock( Tag.class );
            expect(newTag.getTrack()).andReturn( trackBefore.getName() ).anyTimes();
            expect(newTag.getTrackNumber()).andReturn( trackBefore.getNumber() + 1 ).anyTimes();
            replay(newTag);

            cm.checkTrackTagInfo(newTag, trackBefore);
            Track trackAfter = cm.getTrack(3);
View Full Code Here

       
        int firstArtistId = 0, secondArtistId = 0;

        db.fixture( "checkArtistTagChange" );

        Tag newTag = createMock( Tag.class );
        expect( newTag.getArtist() ).andReturn( artistName ).times(2);
        replay( newTag );

        Statement st = db.getConnection().createStatement();
        ResultSet rs = st.executeQuery("select * from albums where id = 1" );
       
View Full Code Here

TOP

Related Classes of com.pugh.sockso.music.tag.Tag

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.