//Comments //Filename //Purpose #include #include #include #include using namespace std; /////////////////////////////MISC PROGRAM FUNCTIONS////////////////////////// void instructions (); void getline (istream& instream, string& str, char sentinel); /////////////////////////////PLAYLIST FORMAT DEPENDANT FUNCTIONS///////////// int countEntriesM3U (char file[]); //count functions can probably be merged int countEntriesB4S (char file[]); void processM3U (ifstream& inputfile, string& title, string& filename, int& gulplength, string& sfName, int& flag); void processB4S (ifstream& inputfile, string& title, string& filename, int& gulplength, string& sfName); //////////////////////////////PLAYLIST INDEPENDANT FUNCTIONS////////////////// void parseID3 (ifstream& mp3, int& ID3, string defaultPath, string& songTitle, string& artistName); void writeEntry (ofstream& outputfile, int gulplength, int ID3, char file[], string songTitle, string artistName, string sfName, string title); void writeFooter (ofstream& outputfile); void makeHeader (ofstream& outputfile, int elementcount); int main (int argc, char* argv[]) { if (argc == 1) { instructions (); } else if (argc != 3) { cout < '"< to end program."; getline(cin, badUser, '\n'); return 0; } ////////////////////////////////// string defaultPath; //base directory containing the playlist file string title = ""; //non-ID3 based title string filename = ""; //MP3 filename without path info string sfName; //used in case MP3 doesn't conform to standard naming convention char empty = 0; //used for .get char file[500]; //filenames int gulplength = 0; //necessary part of .nra format int elementcount = -1; //number of songs in current list int flag = 0; //used to tell various things char first = 0; //used for .get in ID3 parsing...probably redundant string songTitle, artistName; //used for ID3 info string tag = ""; //used to cache ID3 tag...probably unnecessary int ID3 = 0; //used to tell if ID3 tag is present int ID3count = 0; //used to traverse ID3 tag ifstream mp3; //self-explanatory string devcppsux; //needed because Dev-CPP doesn't have the correct implementation of the //.insert function... string filetype; //denotes the filetype of source list // ////////////////////////////////// if (argc == 1) /////////////////INPUT GATHERING AND CHECKING//////////////////////////////// { cout << "Enter the full name and path of the input playlist file: "; cin.getline(file, 500, '\n'); if (file[0] == '"') //drag and drop handling { while (file[flag] != '\0') { file[flag] = file[flag + 1]; flag++; } file[flag - 2] = '\0'; flag = 0; } } else { strcpy(file, argv[1]); cout << "Converting " < to end program."< to begin."; cin.getline(any, 100, '\n'); cout << endl<'); found = 1; } } } } } } filename.at(filename.length() - 1) = '\0'; sfName = filename; for (int count9 = 0; count9 < sfName.length(); count9++) { if (((char)sfName.at(count9)) == 92) { sfName.erase(0, count9 + 1); count9 = -1; } } sfName.erase(sfName.length() -1, 1); inputfile.get(empty); inputfile.get(empty); inputfile.get(empty); while (empty != '>') inputfile.get(empty); getline (inputfile, title, '<'); inputfile.get(empty); for (int count = 0; count < 4; count++) { while (empty != '<') { inputfile.get(empty); } inputfile.get(empty); } if (empty == '/') { inputfile.seekg(0, ios::end); inputfile.get(empty); } gulplength += (title.length()); gulplength += sfName.length(); } void parseID3 (ifstream& mp3, int& ID3, string defaultPath, string& songTitle, string& artistName) { //defaultPath is an unnecessary parameter mp3.seekg(0, ios::end); int mp3Length = mp3.tellg(); mp3.seekg(0); mp3.seekg((mp3Length - 128)); char first, temp; mp3.get(first); if (first == 'T') { mp3.get(first); // cout << "T found, next character is: "<