Sort series so the one with the exact name match is at the top.

This commit is contained in:
Damiano Galassi committed 2017-08-17 08:25:03 +02:00
1 parent 5f33ecdd35
commit 7bc19929a4
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -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
+1 -1
View File
@@ -414,6 +414,7 @@
A9FAC5FE1BAC3BAC00525E42 /* Document */,
A9AF6A7818D0537F00FAAB08 /* Queue */,
A961476113F567E10068F161 /* SBPresetManager.h */,
A961476213F567E10068F161 /* SBPresetManager.m */,
A9AB484717F0AEA2000AA72E /* SBAppDelegate.h */,
A9AB484817F0AEA2000AA72E /* SBAppDelegate.m */,
A947218D1D49D9F700858DD8 /* Preferences */,
@@ -626,7 +627,6 @@
A9AB485317F0AEAC000AA72E /* SBVideoViewController.m */,
A960E96117D4B00900FC6ED9 /* SBImageBrowserView.h */,
A960E96217D4B00900FC6ED9 /* SBImageBrowserView.m */,
A961476213F567E10068F161 /* SBPresetManager.m */,
A9B46A8612B79B240040517A /* SBView.h */,
A9B46A8712B79B240040517A /* SBView.m */,
);