-
-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(core/playback/mpv): jukebox mode under windows - #2767 #2774
Merged
deluan
merged 11 commits into
navidrome:master
from
apkatsikas:jukebox-mode-under-windows/2767
Apr 14, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb65688
bug(core/playback/mpv): jukebox mode under windows - #2767
apkatsikas b97bf61
bug(core/playback/mpv): jukebox mode under windows - #2767
apkatsikas bf29e59
Merge master
apkatsikas 93bb3ce
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas 0d5d74b
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas f3b54f0
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas 243b529
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas f066adc
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas e7186a4
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas e8a6042
bug(core/playback/mpv): jukebox mode under windows - navidrome#2767
apkatsikas 36568dc
Unexport SocketName, use socketName in NewTrack
apkatsikas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build !windows | ||
|
||
package mpv | ||
|
||
import "github.com/navidrome/navidrome/utils" | ||
|
||
func socketName(prefix, suffix string) string { | ||
return utils.TempFileName(prefix, suffix) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//go:build windows | ||
|
||
package mpv | ||
|
||
import ( | ||
"path/filepath" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
func socketName(prefix, suffix string) string { | ||
// Windows needs to use a named pipe for the socket | ||
// see https://mpv.io/manual/master#using-mpv-from-other-programs-or-scripts | ||
return filepath.Join(`\\.\pipe\mpvsocket`, prefix+uuid.NewString()+suffix) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//go:build !windows | ||
|
||
package mpv | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/navidrome/navidrome/log" | ||
) | ||
|
||
func (t *MpvTrack) Close() { | ||
log.Debug("Closing resources", "track", t) | ||
t.CloseCalled = true | ||
// trying to shutdown mpv process using socket | ||
if t.isSocketFilePresent() { | ||
log.Debug("sending shutdown command") | ||
_, err := t.Conn.Call("quit") | ||
if err != nil { | ||
log.Error("Error sending quit command to mpv-ipc socket", err) | ||
|
||
if t.Exe != nil { | ||
log.Debug("cancelling executor") | ||
err = t.Exe.Cancel() | ||
if err != nil { | ||
log.Error("Error canceling executor", err) | ||
} | ||
} | ||
} | ||
} | ||
|
||
if t.isSocketFilePresent() { | ||
log.Debug("Removing socketfile", "socketfile", t.IPCSocketName) | ||
err := os.Remove(t.IPCSocketName) | ||
if err != nil { | ||
log.Error("Error cleaning up socketfile", "socketfile", t.IPCSocketName, err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build windows | ||
|
||
package mpv | ||
|
||
func (t *MpvTrack) Close() { | ||
// Windows automatically handles closing | ||
// and cleaning up named pipe | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was required to run prettier before I could push due to git hooks.