Tuesday 10 January 2012

Open popup with jquery

/*function showModelPopup(containner, isDialog,hideOnOutsideClick,zIndex)
{
if (zIndex != undefined) {
_zindex = zIndex;
}
var windowHeight = jQuery(window).height();
var windowWidth = jQuery(window).width();
var newLeft = 0;
var newTop = 0;
var targetContainer = jQuery('.' + containner);
var numberOfModels = jQuery('.faliaModel').length;

targetContainer.addClass('_mdd' + containner);

var model = "
";
if (jQuery("._md" + containner).length == 0) {
jQuery('body').append(model);
}
if (isDialog == undefined) {
isDialog = 0;
}


if (isDialog == 0) {
jQuery("._md" + containner).fadeIn(500).height(
jQuery(document).height() + 'px');
}

jQuery("._md" + containner).css('z-index', ++_zindex);
targetContainer.css('z-index', ++_zindex);
var windowPositionTop = jQuery(window).scrollTop();

if (targetContainer.width() > windowWidth) {
targetContainer.css('width', windowWidth - 100);
newLeft = 50;
} else if (targetContainer.width() < windowWidth) { newLeft = (windowWidth - targetContainer.width()) / 2; } if (targetContainer.height() > windowHeight) {
targetContainer.css('height', windowHeight - 100);
newTop = 50;
} else if (targetContainer.height() < windowHeight) {
newTop = (windowHeight - targetContainer.height()) / 2;
}

targetContainer.css('left', newLeft);
targetContainer.css('top', windowPositionTop + newTop);
targetContainer.fadeIn(200);

targetContainer.find('.closePopup').click(function() {
hideModel();
});
jQuery('._md' + containner).click(function() {
if(hideOnOutsideClick== undefined)
hideModel();
});

function hideModel() {
jQuery('._md' + containner).fadeOut(500);
jQuery('.' + jQuery('._md' + containner).attr('rel')).fadeOut(500);
if (typeof closeOperation == 'function') {
closeOperation();
}
}
;
}

function hideModel(_container) {
jQuery('._md' + _container).fadeOut(500);
jQuery('.' + jQuery('._md' + _container).attr('rel')).fadeOut(250);
if (typeof closeOperation == 'function') {
closeOperation();
}*/

Saturday 22 October 2011

Read MetaData from a mp3 file in java

It's not a big issue to read metadata from an mp3 file . you just need to include library . The code is

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import org.cmc.music.common.ID3ReadException;
import org.cmc.music.metadata.IMusicMetadata;
import org.cmc.music.metadata.MusicMetadataSet;
import org.cmc.music.myid3.MyID3;
import org.cmc.music.myid3.id3v2.MyID3v2;
import org.cmc.music.myid3.id3v2.MyID3v2Write;


public class sound {

public static void readSound(File src){
try {
MusicMetadataSet src_set = new MyID3().read(src);
                     if (src_set != null){
                     
IMusicMetadata metadata =src_set.getSimplified();
String artist = metadata.getArtist();  
String album = metadata.getAlbum();  
String song_title = metadata.getSongTitle(); 
List commts = metadata.getComments();
String Des=metadata.getGenreName();
       System.out.println(artist);
       System.out.println(song_title);
       System.out.println(Des);
       System.out.println(album);
       System.out.println(commts);
   
}
} catch (ID3ReadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

  public static void main(String[] args) {
String path="a.mp3";
File src=new File(path);
readSound(src);
}