Sort series so the one with the exact name match is at the top.
This commit is contained in:
1 parent
5f33ecdd35
commit
7bc19929a4
2 files changed
+5
-2
No files matched your search
@@ -66,7 +66,10 @@ public struct TheTVDB : MetadataService, MetadataNameService {
|
||||
|
||||
private func searchIDs(seriesName: String, language: String) -> [Int] {
|
||||
let series = session.fetch(series: seriesName, language: language)
|
||||
let filteredSeries = series.filter { $0.status.isEmpty == false && match(series: $0, name: seriesName) }.map { $0.id }
|
||||
let sorted = series.sorted { el1, el2 -> Bool in
|
||||
return el1.seriesName == seriesName ? true : false
|
||||
}
|
||||
let filteredSeries = sorted.filter { $0.status.isEmpty == false && match(series: $0, name: seriesName) }.map { $0.id }
|
||||
|
||||
if filteredSeries.isEmpty == false {
|
||||
return filteredSeries
|
||||
|
||||
Reference in new issue
Block a user