- When guessing tags, remove leading spaces/dashes from title.

- Also add tag/title guessing to details shown in main window.
This commit is contained in:
craig.p.drummond
2012-12-10 19:55:08 +00:00
parent a8e66de29e
commit 858f4bb52e
3 changed files with 10 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
6. For playqueue items, if we only have a filename, and no artist, etc, then
attempt to ascertain artist, album, title, and track number from the
filename. These will be extracted if the filename has the following pattern:
"%artist%/%album%/%track% %title"
"%artist%/%album%/%track% %title%"
Otherwise, if we cannot extract all of these, just set the title to the
filename without path.
7. Allow editing of tags, and replaygain calculation, of files from folder view

View File

@@ -1782,10 +1782,14 @@ void MainWindow::updateCurrentSong(const Song &song)
}
#endif
if (current.isEmpty()) {
current.guessTags();
current.fillEmptyFields();
}
positionSlider->setEnabled(-1!=current.id && !currentIsStream());
coverWidget->update(current);
if (song.title.isEmpty() && song.artist.isEmpty() && !song.file.isEmpty()) {
if (current.title.isEmpty() && current.artist.isEmpty() && !current.file.isEmpty()) {
trackLabel->setText(current.file);
} else if (current.name.isEmpty()) {
trackLabel->setText(current.title);

View File

@@ -174,6 +174,10 @@ void Song::guessTags()
(2==space && title[space-2].isDigit() && title[space-1].isDigit()) ) {
track=title.left(space).toInt();
title=title.mid(space+1);
while (!title.isEmpty() && (title[0]==' ' || title[0]=='-')) {
title=title.mid(1);
}
}
}
}