mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
Merge pull request #191 from Demizo/feature_duration_matching
[Feature] Add Duration Match Algorithm (Needs Testing)
This commit is contained in:
commit
9ba46e3060
@ -351,7 +351,7 @@ class Settings extends HookConsumerWidget {
|
||||
value: SpotubeTrackMatchAlgorithm.popular,
|
||||
),
|
||||
DropdownMenuItem(
|
||||
child: Text("YouTube's choice is my choice"),
|
||||
child: Text("YouTube's Top choice"),
|
||||
value: SpotubeTrackMatchAlgorithm.youtube,
|
||||
),
|
||||
],
|
||||
|
@ -429,6 +429,10 @@ class Playback extends PersistedChangeNotifier {
|
||||
|
||||
final bool hasNoLiveInTitle =
|
||||
!PrimitiveUtils.containsTextInBracket(ytTitle, "live");
|
||||
final bool hasCloseDuration =
|
||||
(track.duration!.inSeconds - video.duration!.inSeconds)
|
||||
.abs() <=
|
||||
10; //Duration matching threshold
|
||||
|
||||
int rate = 0;
|
||||
for (final el in [
|
||||
@ -438,12 +442,14 @@ class Playback extends PersistedChangeNotifier {
|
||||
SpotubeTrackMatchAlgorithm.authenticPopular)
|
||||
authorIsArtist,
|
||||
hasNoLiveInTitle,
|
||||
hasCloseDuration,
|
||||
!video.isLive,
|
||||
]) {
|
||||
if (el) rate++;
|
||||
}
|
||||
// can't let pass any non title matching track
|
||||
if (!hasTitle) rate = rate - 2;
|
||||
|
||||
return {
|
||||
"video": video,
|
||||
"points": rate,
|
||||
|
Loading…
Reference in New Issue
Block a user