-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
Changes from 7 commits
eb65688
b97bf61
bf29e59
93bb3ce
0d5d74b
f3b54f0
243b529
f066adc
e7186a4
e8a6042
36568dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,9 @@ const Progress = (props) => { | |
) | ||
const callbackUrl = `${window.location.origin}${callbackEndpoint}` | ||
openedTab.current = openInNewTab( | ||
`https://www.last.fm/api/auth/?api_key=${localStorage.getItem('lastfm-apikey')}&cb=${callbackUrl}`, | ||
`https://www.last.fm/api/auth/?api_key=${localStorage.getItem( | ||
'lastfm-apikey', | ||
)}&cb=${callbackUrl}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
) | ||
}, []) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,17 @@ package utils | |
import ( | ||
"os" | ||
"path/filepath" | ||
"runtime" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
func TempFileName(prefix, suffix string) string { | ||
return filepath.Join(os.TempDir(), prefix+uuid.NewString()+suffix) | ||
func RandomSocketOrFileName(prefix, suffix string) string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I rather leave this function ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good |
||
socketPath := os.TempDir() | ||
// Windows needs to use a named pipe instead of a file for the socket | ||
// see https://mpv.io/manual/master#using-mpv-from-other-programs-or-scripts | ||
if runtime.GOOS == "windows" { | ||
socketPath = `\\.\pipe\mpvsocket` | ||
} | ||
return filepath.Join(socketPath, prefix+uuid.NewString()+suffix) | ||
} |
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.
It is not a good practice to use
runtime.GOOS
in your files (unless it is a really small check). Usually we create one file for each variation and use build tags to control which version to use.For an example, see
scanner/metadata/taglib/get_filename.go
andscanner/metadata/taglib/get_filename_win.go
In your case I'd have two
Close()
methods in different files, one for windows (do nothing) and the other for all other platforms with the actual code.Let me know if it makes sense to you or if you want me to do that.
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.
yeah was wondering about this and hoping to get feedback on what best practice is for this project. makes sense and thank you for the examples - will give it a shot and report back