quickshell: CacheServise

This commit is contained in:
2025-10-13 21:35:34 +02:00
parent 20821ef078
commit ba6c735850
13 changed files with 102 additions and 59 deletions

View File

@@ -9,7 +9,7 @@ Singleton {
property int linesCount: 3
property int linesAhead: linesCount / 2
property int currentIndex: linesCount - linesAhead - 1
property string offsetFile: Qt.resolvedUrl("../Assets/Config/LyricsOffset.txt")
property string offsetFile: CacheService.lyricsOffsetCacheFile
property int offset: 0 // in ms
property int offsetStep: 500 // in ms
property int referenceCount: 0
@@ -26,7 +26,7 @@ Singleton {
Logger.log("LyricsService", "Starting lyrics syncing");
// fill lyrics with empty lines
lyrics = Array(linesCount).fill(" ");
listenProcess.exec(["sh", "-c", `sl-wrap listen -l ${linesCount} -a ${linesAhead} -f ${offsetFile.slice(7)}`]);
listenProcess.exec(["sh", "-c", `sl-wrap listen -l ${linesCount} -a ${linesAhead} -f ${offsetFile}`]);
}
}
@@ -127,17 +127,14 @@ Singleton {
writeOffset();
}
} catch (e) {
Logger.log("LyricsService", "Error reading offset file:", e);
Logger.error("LyricsService", "Error reading offset file:", e);
}
}
onLoadFailed: {
Logger.log("LyricsService", "Error loading offset file:", errorString);
Logger.error("LyricsService", "Error loading offset file:", errorString);
}
onSaveFailed: {
Logger.log("LyricsService", "Error saving offset file:", errorString);
}
onSaved: {
Logger.log("LyricsService", "Offset file saved.");
Logger.error("LyricsService", "Error saving offset file:", errorString);
}
}