fix restoring queueIndex

build-linux: fix getting commit hash
This commit is contained in:
Pato05 2024-02-14 23:29:03 +01:00
parent e782643ee0
commit 99fef45fb8
No known key found for this signature in database
GPG Key ID: ED4C6F9C3D574FB6
3 changed files with 13 additions and 7 deletions

View File

@ -108,6 +108,10 @@ class AudioPlayerTask extends BaseAudioHandler {
/// Last playback position (used for restoring position when player died)
Duration? _lastPosition;
/// Last playback queueIndex (used for restoring when player died)
int? _lastQueueIndex;
AudioServiceRepeatMode _repeatMode = AudioServiceRepeatMode.none;
/// LastFM API
@ -319,6 +323,7 @@ class AudioPlayerTask extends BaseAudioHandler {
Future skipToQueueItem(int index) async {
await _maybeResume();
_lastPosition = null;
_lastQueueIndex = null;
// next or prev track?
unawaited(_logListenedTrack(
currentMediaItem.id,
@ -336,10 +341,11 @@ class AudioPlayerTask extends BaseAudioHandler {
Future play() async {
await _maybeResume();
_player.play();
//Restore position on play
//Restore position and queue index on play
if (_lastPosition != null) {
_player.seek(_lastPosition);
_player.seek(_lastPosition, index: _lastQueueIndex);
_lastPosition = null;
_lastQueueIndex = null;
}
}
@ -789,7 +795,7 @@ class AudioPlayerTask extends BaseAudioHandler {
}
final q = ((await _box.get('queue')) as List?)?.cast<MediaItem>();
_queueIndex = await _box.get('index', defaultValue: 0);
_lastQueueIndex = _queueIndex = await _box.get('index', defaultValue: 0);
_lastPosition = await _box.get('position', defaultValue: Duration.zero);
queueSource =
await _box.get('queueSource', defaultValue: const QueueSource());

View File

@ -145,7 +145,7 @@ endif()
# === Create Tarball ===
# Make a tarball out of the install bundle (only in Release mode)
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
configure_file(create-tarball.sh ${PROJECT_BINARY_DIR}
configure_file(create-tarball.sh ${PROJECT_BINARY_DIR} @ONLY
FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
add_custom_target(create_tar ALL COMMAND "${PROJECT_BINARY_DIR}/create-tarball.sh")
add_dependencies(create_tar ${BINARY_NAME})

View File

@ -1,5 +1,5 @@
#!/bin/sh
cd "${PROJECT_BINARY_DIR}/../../../.."
cd "@PROJECT_BINARY_DIR@/../../../.."
COMMIT_HASH=`git log -1 --pretty=format:%h`
cd "${BUILD_BUNDLE_DIR}"
${CMAKE_COMMAND} -E tar cvzf "${PROJECT_BINARY_DIR}/freezer-linux-${COMMIT_HASH}.tar.gz" .
cd "@BUILD_BUNDLE_DIR@"
@CMAKE_COMMAND@ -E tar cvzf "@PROJECT_BINARY_DIR@/freezer-linux-${COMMIT_HASH}.tar.gz" .