среда, 4 августа 2010 г.

First results of test - mp3 (id3v2)

Old ID3EndAnalyzer:

./Rammstein - Mann gegen Mann.mp3
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment
"[Xakep Online] ";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentCreated
"2005";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize
"7096320";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf
"";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified
"1230225080";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType
"audio/mpeg",
"audio/mpeg";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title
"Mann gegen Mann";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url
"./Rammstein - Mann gegen Mann.mp3";
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator
"Rammstein";
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#publisher
":nwlrb";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#averageBitrate
"128000";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels
"2";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#codec
"MP3";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName
"Rammstein - Mann gegen Mann.mp3";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#sampleRate
"44100";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#genre
"Rock";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicAlbum
":bmqbh";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#trackNumber
"2";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio",
"http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicPiece",
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject".
:bmqbh
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title
"Rosenrot";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicAlbum".
:nwlrb
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname
"LAME 3.90.3+mod";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Contact".


Generated Mp3EndAnalyzer by Translator:

./Rammstein - Mann gegen Mann.mp3
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentSize
"7096320";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf
"";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#lastModified
"1230225080";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType
"audio/mpeg",
"audio/mpeg";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title
"Mann gegen Mann";
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url
"./Rammstein - Mann gegen Mann.mp3";
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#publisher
":cdarz";
http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName
"Rammstein - Mann gegen Mann.mp3";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#composer
":hiddq";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#genre
"(17)";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#lyricist
":owkky";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicAlbum
":nwlrb";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#performer
":bmqbh";
http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#trackNumber
"2";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicPiece",
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio",
"http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject".
:bmqbh
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname
"Rammstein";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nco#contact".
:cdarz
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname
"LAME 3.90.3+mod";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nco#contact".
:hiddq
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname
"Rammstein";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nco#contact".
:nwlrb
http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title
"Rosenrot";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicAlbum".
:owkky
http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname
"";
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
"http://www.semanticdesktop.org/ontologies/2007/03/22/nco#contact".


Extractor test:
myvector stores 9 numbers.
Name=Publisher Value = LAME 3.90.3+mod
Name=Title Value = Mann gegen Mann
Name=Publisher Value = Po-X
Name=Genre Value = (17)
Name=Album Value = Rosenrot
Name=Performer Value = Rammstein
Name=Track_number Value = 2
Name=Composer Value = Rammstein
Name=Performer Value = Rammstein


TFL input file:

Format mp3;

Metadata: id3v2, id3v1;

if(id3v2)
{
Created = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#contentCreated";
Subject = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#subject";
Title = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title";
Description = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#description";
Comment = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment";
Artist = "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator";
Album = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicAlbum";
Genre = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#genre";
Composer = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#composer";
Performer = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#performer";
Liricist = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#lyricist";
Publisher = "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#publisher";
Language = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#landuage";
Copyright = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#copyright";
Track_number = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#trackNumber";
Duration = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#duration";
Bitrate = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#averageBitrate";
Samplerate = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#sampleRate";
Codec = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#codec";
Channels = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels";


&type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
&fullname = "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#fullname";
&titleProperty = "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title";
&albumTrackCount = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#albumTrackCount";
&discNumber = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#setNumber";
&discCount = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#setCount";
&musicClass = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#musicPiece";
&audioClass = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio";
&albumClass = "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicAlbum";
&contactClass = "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#contact";

Uri a, a1, a2, a3, a4;

T: a1 - type - contactClass;
T: a1 - fullname - Performer;

T: a2 - type - contactClass;
T: a2 - fullname - Publisher;

T: a - titleProperty - Album;
T: a - type - albumClass;

T: a3 - type - contactClass;
T: a3 - fullname - Liricist;

T: a4 - type - contactClass;
T: a4 - fullname - Composer;


D: type - musicClass;
D: type - audioClass;

}


TL input file:

Binary id3v2;

ByteOrder=MSB;
BitOrder=MSB;

StartMetadataKey ID3(offset=0, size=3);
checkKey(ID3)="ID3";

MetadataKey HeaderFlag(start, offset=5, size=1);

MetadataKey ID3_size(start, offset=6, size=4);

MetadataSize=getNumber(ID3_size);

if (getBit(HeaderFlag, 6)==1)
{
MetadataKey ExHeaderSize(start, offset=10, size=4);
MetadataKey FirstFrameID(start, offset=getNumber(ExHeaderSize)+10, size=4);
MetadataSize-=(10+getNumber(ExHeaderSize));
}
else
MetadataKey FirstFrameID(start, offset=10, size=4);

key=FirstFrameID;
while(MetadataSize>0)
{
MetadataKey sizeOfTag(key, offset=0, size=4);
if(getByte(key, 0)==0x00)
{
break;
}
else {
TagSize=getNumber(sizeOfTag);
if((getValue(key)=="TALB" || getValue(key)=="TOAL") && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
SetTag Album(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TCOM" && (TagSize>1))
{
MetadataKey encoding(key, offset=6, size=1);
setTag Composer(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if((getValue(key)=="TYAR" || getValue(key)=="TDRL" || getValue(key)=="TDAT" || getValue(key)=="TDRC") && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Created(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TRCK" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Track_number(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TIT2" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Title(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TIT1" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Subject(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TIT3" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Description(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if((getValue(key)=="TPE1" || getValue(key)=="TPE2" || getValue(key)=="TPE3" || getValue(key)=="TPE4")&& TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Performer(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if((getValue(key)=="TPUB" || getValue(key)=="TENC")&& TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Publisher(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TEXT" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Liricist(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TCON" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Genre(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TLAN" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Language(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TCOP" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Copyright(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}
if(getValue(key)=="TLEN" && TagSize>1)
{
MetadataKey encoding(key, offset=6, size=1);
setTag Duration(getStringByLink(encoding, offset=0, size=getNumber(sizeOfTag)-1));
}

MetadataSize-=(10+getNumber(sizeOfTag));
shift(key, 6+getNumber(sizeOfTag));
}

}

Комментариев нет:

Отправить комментарий