mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-11 09:27:30 +00:00
Added query for genius lyrics
This commit is contained in:
parent
e3e7c22e62
commit
40dae56fd9
@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:fl_query/fl_query.dart';
|
||||
import 'package:fl_query_hooks/fl_query_hooks.dart';
|
||||
@ -28,6 +27,20 @@ class LyricsQueries {
|
||||
});
|
||||
}
|
||||
|
||||
Query<String, dynamic> geniusLyrics(Track? track) {
|
||||
return useQuery<String, dynamic>("geniusLyrics-query/${track?.id}",
|
||||
() async {
|
||||
if (track == null) {
|
||||
throw "No Track Currently";
|
||||
}
|
||||
final lyrics = await ServiceUtils.getGeniusLyrics(
|
||||
title: track.name!,
|
||||
artists:
|
||||
track.artists?.map((s) => s.name).whereNotNull().toList() ?? []);
|
||||
return lyrics;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Query<String, dynamic> static(
|
||||
Track? track,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user