Fixed a case where moving a file may be broken (when skipping duplicate MBID is active) + only check for duplicate track MBID (instead of recording MBID) as we have have several different releases sharing the same recording MBID)

This commit is contained in:
emeric
2023-02-22 13:58:18 +01:00
parent 12d967fe4f
commit 8a69d3e309
6 changed files with 29 additions and 10 deletions
+12
View File
@@ -209,6 +209,18 @@ Track::exists(Session& session, TrackId id)
return session.getDboSession().query<int>("SELECT 1 from track").where("id = ?").bind(id).resultValue() == 1;
}
std::vector<Track::pointer>
Track::findByMBID(Session& session, const UUID& mbid)
{
session.checkSharedLocked();
auto res {session.getDboSession().find<Track>()
.where("mbid = ?").bind(std::string {mbid.getAsString()})
.resultList()};
return std::vector<Track::pointer>(res.begin(), res.end());
}
std::vector<Track::pointer>
Track::findByRecordingMBID(Session& session, const UUID& mbid)
{