-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cpp
171 lines (136 loc) · 4.6 KB
/
Player.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include <iostream>
#include <string>
#include "Song.h"
#include "Playlist.h"
#include <fstream>
#include "StringHelper.h"
#include <vector>
using namespace std;
// Your driver program should allow users to create new named playlist,
// view all the playlists, merge (intersect) exisiting playlists into a new list,
// and play a playlist.
// A list of all created playlists should be stored in a file "Playlist.list".
// The songs in each playlist should be stored in a file named to match the list and
// the file extension ".playlist". This is a CSV format.
//
int main()
{
vector<Playlist> lists;//vector of playlists
vector<Song> songs; //vector of songs
Playlist name;
string pName;
string title, album,artist;
int length, year;
ifstream listFile;
string in;
vector<string> totalList;
listFile.open("Playlist.list");//open lists of file
while (!list.eof())
{
getline(listFile,in);
totalList.push_back(in);
}
int selection,selection2;
string song1,titleName,title,artist,album,listName;
int year,length;
Song song1;
char mode,option1,option2;
//INCLUDE A DO WHILE
do{
cout<<"----------WELCOME to the AutoPlayer----------"<<endl;
cout<<"1 - Open an existing playlist"<<endl;
cout<<"2 - Create new list"<<endl;
cout<<"3 - Exit"<<endl;
cout<<"Selection: ";
cin>>selection;
if(selection==1)
{int i
for( i=0;i<size();i++)
{
cout<<i+1<<totalList.size()<<endl;
cout<<totalList[i]<<endl;//print contents of Playlist.list
}
cout<<"Selection: ";
cin>>option;
cout<<"You are now playing: "<<
cout<<"Selection: ";
cin>>option1;
if(toUpper(option1)=='A')//add song
{
cout<<"Song Details: "<<endl;
cout<<"Title"<<endl;
cin>>title;
cout<<"Artist: ";
cin>>artist;
cout<<endl;
cout<<"Album: ";
cin>>album;
cout<<endl;
cout<<"Year: ";
cin>>year;
cout<<endl;
cout<<"Length(in seconds): ";
cin>>length;
cout<<endl;
songs.push_back(new Song(title,artist,album,length,year));//adds new song to song vector create dynamic song object
//add song to playlist at location of selected playlist
}
else if(toUpper(option1)=='D')
{
cout<<"Title"<<endl;
cin>>title;
cout<<"Artist: ";
cin>>artist;
cout<<endl;
//call deleting function
}
else if(toUpper(option1)=='P')
{
//call play function
}
else if(toUpper(option1)=='M')
{
cout<<"Enter mode: "<<endl;
cout<<"N - Normal"<<endl;
cout<<"R - Repeat"<<endl;
cout<<"L - Loop"<<endl;
cin>>mode;
//call mode function
}
else if(toUpper(option1)=='S')
{
//call function to print all songs
}
}//End opening playlist
if(selection==2)
{
if(option2==1)//create
{
cout<<"Name of new playlist ";
cin>>pName;
new Playlist(pName);
//insert menu
}
if(option2==2)//merge
{
cout<<"Name of new playlist ";
cin>>pName;
new Playlist(pName);
cout<<"List of playlists"<<endl;
cout<<
}
if(option2==3)
{
cout<<"Name of new playlist ";
cin>>pName;
new Playlist(pName);
for( i=0;i<size();i++)
{
cout<<i+1<<totalList.size()<<endl;
cout<<totalList[i]<<endl;//print contents of Playlist.list
}
}
}
}while(selection!=3);//end do while
return 0;
}