Strip slash character from cddb data before attempting to rename volume and files. Continue in spite of file errors.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32219 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b8fe3ff480
commit
dede003a3c
@ -214,7 +214,11 @@ CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData,
|
|||||||
BVolume volume(device);
|
BVolume volume(device);
|
||||||
|
|
||||||
status_t result;
|
status_t result;
|
||||||
|
status_t error = B_OK;
|
||||||
|
|
||||||
BString name = diskData->artist << " - " << diskData->title;
|
BString name = diskData->artist << " - " << diskData->title;
|
||||||
|
name.ReplaceSet("/", " ");
|
||||||
|
|
||||||
if ((result = volume.SetName(name.String())) != B_OK) {
|
if ((result = volume.SetName(name.String())) != B_OK) {
|
||||||
printf("Can't set volume name.\n");
|
printf("Can't set volume name.\n");
|
||||||
return result;
|
return result;
|
||||||
@ -225,15 +229,20 @@ CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData,
|
|||||||
volume.GetRootDirectory(&cddaRoot);
|
volume.GetRootDirectory(&cddaRoot);
|
||||||
|
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
int cnt = 0;
|
int index = 0;
|
||||||
while (cddaRoot.GetNextEntry(&entry) == B_OK) {
|
while (cddaRoot.GetNextEntry(&entry) == B_OK) {
|
||||||
TrackData* data = (TrackData*)((readResponse->tracks).ItemAt(cnt));
|
TrackData* data = (TrackData*)((readResponse->tracks).ItemAt(index));
|
||||||
|
|
||||||
// Update name.
|
// Update name.
|
||||||
if ((result = entry.Rename((data->title).String())) != B_OK) {
|
name = data->title;
|
||||||
// Failed renaming one entry. Abort processing.
|
name.ReplaceSet("/", " ");
|
||||||
printf("Failed renaming entry at index %d. Aborting.\n", cnt);
|
|
||||||
return result;
|
if ((result = entry.Rename(name.String())) != B_OK) {
|
||||||
|
printf("Failed renaming entry at index %d to \"%s\".\n", index,
|
||||||
|
name.String());
|
||||||
|
error = result;
|
||||||
|
// User can benefit from continuing through all tracks.
|
||||||
|
// Report error later.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add relevant attributes. We consider an error here as non-fatal.
|
// Add relevant attributes. We consider an error here as non-fatal.
|
||||||
@ -258,10 +267,10 @@ CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData,
|
|||||||
(data->artist).String(), (data->artist).Length());
|
(data->artist).String(), (data->artist).Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user