Commit 4b279f6 1 parent 46e2295 commit 4b279f6 Copy full SHA for 4b279f6
File tree 1 file changed +21
-2
lines changed
1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ package sound
15
15
16
16
import (
17
17
"fmt"
18
+ "math"
18
19
"os/exec"
19
20
"time"
20
21
@@ -189,7 +190,7 @@ func (p *Player) procWatcher() {
189
190
p .hndl .Post (ev .RequestShutdown )
190
191
}
191
192
192
- func (p * Player ) load (filename string ) {
193
+ func (p * Player ) load (filename string , starttime int ) {
193
194
if p .proc == nil || p .ctrl == nil {
194
195
p .start ()
195
196
}
@@ -199,10 +200,28 @@ func (p *Player) load(filename string) {
199
200
// Wait for track to load
200
201
for loaded := "" ; loaded != "\" " + filename + "\" " ; loaded , _ = p .ctrl .Path () {
201
202
}
203
+ for {
204
+ pos , _ := p .ctrl .PercentPosition ()
205
+ if pos != 0 {
206
+ break
207
+ }
208
+ }
209
+
210
+ p .ctrl .Seek (starttime , mpv .SeekModeAbsolute )
202
211
}
203
212
204
213
func (p * Player ) play (q * data.QueueItem ) {
205
- p .load (q .Path )
214
+ _ , s , err := data .Stamps .Stat (q .Path )
215
+ if err != nil {
216
+ tmp := uint64 (0 )
217
+ s = & tmp
218
+ }
219
+ if * s > uint64 (math .MaxInt ) {
220
+ tmp := uint64 (math .MaxInt )
221
+ s = & tmp
222
+ }
223
+
224
+ p .load (q .Path , int (* s ))
206
225
207
226
if q .State != data .StatePending {
208
227
Plr .Now = q
You can’t perform that action at this time.
0 commit comments