Skip to content

Commit

Permalink
Merge pull request #13694 from ronso0/search-track-id
Browse files Browse the repository at this point in the history
Tracks: allow searching for track id
  • Loading branch information
daschuer committed Sep 25, 2024
2 parents a9703e7 + ea1babb commit c12d6bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/library/searchquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ QVariant getTrackValueForColumn(const TrackPointer& pTrack, const QString& colum
return static_cast<int>(pTrack->getKey());
} else if (column == LIBRARYTABLE_BPM_LOCK) {
return pTrack->isBpmLocked();
} else if (column == LIBRARYTABLE_ID) {
return pTrack->getId().toVariant();
}

return QVariant();
Expand Down
4 changes: 3 additions & 1 deletion src/library/searchqueryparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ SearchQueryParser::SearchQueryParser(TrackCollection* pTrackCollection, QStringL
m_numericFilters << "track"
<< "played"
<< "rating"
<< "bitrate";
<< "bitrate"
<< "id";
m_specialFilters << "year"
<< "key"
<< "bpm"
Expand Down Expand Up @@ -117,6 +118,7 @@ SearchQueryParser::SearchQueryParser(TrackCollection* pTrackCollection, QStringL
m_fieldToSqlColumns["location"] << "location";
m_fieldToSqlColumns["type"] << "filetype";
m_fieldToSqlColumns["datetime_added"] << "datetime_added";
m_fieldToSqlColumns["id"] << "id";

m_textFilterMatcher = QRegularExpression(QString("^-?(%1):(.*)$").arg(m_textFilters.join("|")));
m_numericFilterMatcher = QRegularExpression(
Expand Down

0 comments on commit c12d6bd

Please # to comment.