So i have some duplicate songs in my Itunes library (844 to be precise) so i thought I would write a small program to find and destroy the duplicates. The problem I have encountered is some of the directories are not being read correctly.
For example one of album’s folder name is “Greatest Hits, Vol. 2” But is read “Greatest Hits, Vol”
Obviously the “.” is causing a problem. Does anyone know of a workaround that will allow me to read the full file path name (with periods)?
small snipit of Code
QString name;
int id;
for (int a = 0; a < dir.entryList(QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot).length(); ++a)
{
name = path() + "/" + baseName() + "/" + dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot).at(a);
subFiles.append(new CKClone(id, path() + "/" + baseName() + "/" + dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot).at(a), this));
// Updating the ID number to account for descendants.
id = subFiles.last()->countDescendants(id);
}
The above code is just a small snipit and obviously doesn’t do a whole bunch on its own. It simply reads in all of the files and directories recursively.
Any help will be appreciated, Thanks
Jec
I actually tested this in PyQt and found that the problem does not occur for me. This is tested using Qt 4.8, so you may want to check if its a problem specific to your version.
Dir structure like this:
Test snippet
You might want to first try simplifying your code a bit more to see if its a bug in your code. You seem to be regenerating your list every time you loop, build a string, and append. Try saving the QStringList result of that
entryListcall once before your loop, and using that same object for the rest of the code.