-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUserInterface.cpp
More file actions
114 lines (103 loc) · 3.33 KB
/
Copy pathUserInterface.cpp
File metadata and controls
114 lines (103 loc) · 3.33 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//
// Created by Morgan Ziegler on 12/10/19.
//
#include <iostream>
#include "Library.h"
#include <sstream>
int maine(){
std::string command = "";
Library djBoard = Library();
std::cout << "Enter help for a list of commands" << std::endl;
std::cout << "Enter your command: " <<std::endl;
std::getline(std::cin, command);
while (command != "quit" ){
std::stringstream splitter (command);
std::string words;
getline(splitter, words, '<');
if (command == "help"){
djBoard.help();
}
else if (command == "library"){
djBoard.displaySongs();
}
else if (words == "artist"){
std::string artist;
getline(splitter, artist, '>');
djBoard.displayArtist(artist);
}
else if (words == "song"){
std::string title;
std::string artist;
getline(splitter, artist, ',');
getline(splitter, title, '>');
djBoard.displaySong(artist,title);
}
else if(words == "import"){
std::string filename;
getline(splitter, filename, '>');
djBoard.AddSongsFromFile(filename);
}
else if(words == "discontinue"){
std::string filename;
getline(splitter, filename, '>');
djBoard.discontinue(filename);
}
else if(command == "playlists"){
djBoard.displayPlaylists();
}
else if(words == "playlist"){
std::string name;
getline(splitter, name, '>');
djBoard.displayPlaylist(name);
}
else if(words == "new"){
std::string name;
getline(splitter, name, '>');
djBoard.newPlaylist(name);
}
else if(words == "add"){
std::string name;
std::string title;
std::string artist;
getline(splitter, name, ',');
getline(splitter, artist, ',');
getline(splitter, title, '>');
djBoard.addToPlaylist(name,artist,title);
}
else if(words == "remove"){
std::string name;
std::string title;
std::string artist;
getline(splitter, name, ',');
getline(splitter, artist, ',');
getline(splitter, title, '>');
djBoard.removeFromPlaylist(name,artist,title);
}
else if(words == "playnext"){
std::string name;
getline(splitter, name, '>');
djBoard.playNext(name);
}
else if(words == "newrandom"){
std::string name;
std::string duration;
std::string test;
getline(splitter, name, ',');
getline(splitter, duration, '>');
getline(splitter, test, ':');
if (duration == test){
std::cout << "Not a valid use of the command, don't forget to put the duration" << std::endl;
}
else{
djBoard.newRandomPlaylist(name, duration);
}
}
else{
std::cout << "That is not a valid command, enter help for a list of commands" << std::endl;
}
std::cout << "\nEnter your command: " <<std::endl;
std::getline(std::cin, command);
}
djBoard.quit();
return 0;
}