-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
61 lines (44 loc) · 1.18 KB
/
main.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
#include "config.hpp"
#include "lyricsChecker.hpp"
#include "mysql_store.hpp"
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char* argv[]) {
LyricChecker b;
lyrics_mysql a;
a.connect("127.0.0.1", 3306, "rduser", "letmein", "Rivendell");
int count = a.query("SELECT ARTIST,TITLE,ALBUM FROM CART WHERE GROUP_NAME=\"MUSIC\" AND SCHED_CODES IS NULL");
for (int i = 0; i < count; i++) {
cout.flush();
a.getSong(i);
cout << "Got song." << endl;
string artist,title,album;
artist = a.artist();
title = a.title();
album = a.album();
lyric_code match;
cout << "Checking lyrics." << endl;
match = b.isPositiveMatch(title, artist, album);
cout << "Lyrics checked." << endl;
time_t now = time(NULL);
tm now1 = *localtime(&now);
cout << "Song ID: " << a.title() << endl;
cout << asctime(&now1);
switch (match) {
case NOT_FOUND:
cout << "No lyrics could be found.\n\n";
a.mark("U .");
break;
case SAFE:
cout << "This song is safe for play!\n\n";
a.mark("S .");
break;
case EXPLICIT:
cout << "This song is explicit!\n\n";
a.mark("E .");
break;
}
}
return 0;
}