Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
- When matching wildcard genres, look case-insensitively for smart pl…
Browse files Browse the repository at this point in the history
…aylists.

- When matching wildcard genres, if no matches found then use a fake dummy genre so that no tracks will match rules.
Issue #1519
  • Loading branch information
Craig Drummond committed Aug 12, 2019
1 parent addd65d commit 095db04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog
Expand Up @@ -40,6 +40,9 @@
32. Added Dutch translaiton - thnaks to Heimen Stoffels.
33. In dynamic/smart playlists, when specify a rating also allow to specify
unrated tracks.
34. When matching wildcard genres, look case-insensitively for smart playlists.
35. When matching wildcard genres, if no matches found then use a fake dummy
genre so that no tracks will match rules.

2.3.3
-----
Expand Down
4 changes: 4 additions & 0 deletions playlists/cantata-dynamic
Expand Up @@ -520,6 +520,10 @@ sub readRules() {
$pos++;
}
}
if ($pos == 0) {
# No genres matching pattern - add dummy genre, so that no tracks will be found
$genres[$pos]="XXXXXXXX";
}
} elsif ($key eq "Artist" || $key eq "Album" || $key eq "AlbumArtist" || $key eq "Composer" || $key eq "Comment" || $key eq "Title" || $key eq "Genre" || $key eq "File") {
$currentRule="${currentRule} ${key} \"${val}\"";
} elsif ($key eq "SimilarArtists") {
Expand Down
6 changes: 5 additions & 1 deletion playlists/smartplaylistspage.cpp
Expand Up @@ -425,11 +425,15 @@ void SmartPlaylistsPage::addSelectionToPlaylist(const QString &name, int action,
mpdGenres = MpdLibraryModel::self()->getGenres();
}
for (const QString &g: mpdGenres) {
if (g.startsWith(find)) {
if (g.startsWith(find, Qt::CaseInsensitive)) {
genres.append(g);
}
}
}
if (genres.isEmpty()) {
// No genres matching pattern - add dummy genre, so that no tracks will be found
genres.append("XXXXXXXXX");
}
} else if (RulesPlaylists::constArtistKey==rIt.key() || RulesPlaylists::constAlbumKey==rIt.key() ||
RulesPlaylists::constAlbumArtistKey==rIt.key() || RulesPlaylists::constComposerKey==rIt.key() ||
RulesPlaylists::constCommentKey==rIt.key() || RulesPlaylists::constTitleKey==rIt.key() ||
Expand Down

0 comments on commit 095db04

Please sign in to comment.