Skip to content

Commit 17ab869

Browse files
committed
fix: DRYing code
catting the cache file alot of times would leading to increased latency.
1 parent 6792c16 commit 17ab869

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/mac-player.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ main() {
217217
fi
218218

219219
if [ ! -f "$cache_file" ] || [ $(($(date +%s) - $(stat -f%c "$cache_file"))) -ge "$RATE" ]; then
220-
trackStatus "$PAUSE_ICON" "$PLAY_ICON" > "$cache_file"
221-
sliceTrack "$(cat $cache_file)" "$MAX_LENGTH" > "$cache_file"
220+
local full_track
221+
full_track=$(trackStatus "$PAUSE_ICON" "$PLAY_ICON")
222+
sliceTrack "$full_track" "$MAX_LENGTH" > "$cache_file"
222223
fi
223224

224225
cat "$cache_file"

0 commit comments

Comments
 (0)