-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImportExportTest.cpp
76 lines (67 loc) · 2.6 KB
/
ImportExportTest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream.h>
#pragma hdrstop
#include "ConcreteImportExportFacade.h"
#include "TagImpEx.h"
#include "../Song/SongTag.h"
#include "../lib/extlib.h"
//---------------------------------------------------------------------------
void PrintIfNotNull(const string &a_description, const string &a_data)
{
if(a_data == "")
return;
cout << a_description << ": " << a_data << "\n";
}
#pragma argsused
int main(int argc, char* argv[])
{
ImportExportFacade *cief = 0;
SongTag *st = new SongTag();
try {
cief = new ConcreteImportExportFacade();
const TagImpEx *tie = cief->createTagImpEx("ID3");
AnsiString filename = "E:\\MP3\\Men in Black.mp3";
try {
tie->importTag(filename, st);
}
catch(EAbort &) { cout << "Eabort\n"; }
PrintIfNotNull("artist", st->getLeadArtist());
PrintIfNotNull("ursprunglig artist", st->getOriginalArtists());
PrintIfNotNull("band", st->getBand());
PrintIfNotNull("titel", st->getTitle());
PrintIfNotNull("undertitel", st->getSubtitle());
PrintIfNotNull("album", st->getAlbum());
PrintIfNotNull("ursprungligt album", st->getOriginalAlbum());
PrintIfNotNull("spårnr", st->getTrackNo());
PrintIfNotNull("inspelad", st->getRecordingTime());
PrintIfNotNull("ursprungligen utgiven", st->getOriginalReleaseTime());
PrintIfNotNull("kompositör", st->getComposer());
PrintIfNotNull("textförfattare", st->getLyricist());
PrintIfNotNull("ursprunglig textförfattare", st->getOriginalLyricist());
PrintIfNotNull("tolkare", st->getInterpreter());
PrintIfNotNull("label", st->getPublisher());
PrintIfNotNull("genre", st->getContentType());
PrintIfNotNull("situation", st->getSituation());
PrintIfNotNull("tempo", st->getTempo());
PrintIfNotNull("humör", st->getMood());
PrintIfNotNull("kodad av", st->getEncoder());
PrintIfNotNull("kommentar", st->getComment());
PrintIfNotNull("språk", st->getLanguages());
PrintIfNotNull("tonart", st->getKey());
PrintIfNotNull("sångtext", st->getLyrics());
PrintIfNotNull("betyg", string(IntToStr(st->getRating()).c_str()));
tie->exportTag(filename, *st);
}
catch(...) {
cout << "oväntat undantag!\n";
}
if(cief)
delete cief;
if(st)
delete st;
cout << "\nklart.\n";
Pause();
return 0;
}
//---------------------------------------------------------------------------