mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-13 10:47:19 +03:00
* feat(build): add a make target to build a msi installer locally * Testing wrapping the executable in cmd * build(ci): build msis in parallel * feat(server): add LogFile config option * Revert "Testing wrapping the executable in cmd" This reverts commit be29592254cb903fd4904f2f50d4d1a860795d33. * Adding --log-file for service executable * feat(ini): wip * feat(ini): parse nested ini section * fix(conf): fix fatal error messages * Now navidrome supports INI, we can use the built-in msi ini system and not require the VBScript to convert it into toml * File needs to be called .ini to be parsed as an INI and correct filename needs to be passed to the service * fix(msi): build msi locally * fix(msi): pipeline * fix(msi): pipeline * fix(msi): pipeline * fix(msi): pipeline * fix(msi): pipeline * fix(msi): Makefile * fix(msi): more clean up * fix(log): convert LF to CRLF on Windows * fix(msi): config filename should be case-insensitive * fix(msi): make it a little more idiomatic * Including the latest windows release of ffmpeg into the msi as built by https://www.gyan.dev/ffmpeg/builds/ (linked to on the official ffmpeg source) * This should version independent * Need bash expansion for the * to work * This will run twice, once for x86 and once for x64, I'll make it cache the executable for now as it'll be quicker * Silencing wget * Add ffmpeg path to the config so Navidrome knows where to find it * refactor: download ffmpeg from our repository * When going back from the "Are you ready to install?" it should go back to the Settings dialogue that you just came from * fix: comments --------- Co-authored-by: Deluan <deluan@navidrome.org>
52 lines
964 B
Go
52 lines
964 B
Go
package log
|
|
|
|
import (
|
|
"io"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func ShortDur(d time.Duration) string {
|
|
var s string
|
|
switch {
|
|
case d > time.Hour:
|
|
s = d.Round(time.Minute).String()
|
|
case d > time.Minute:
|
|
s = d.Round(time.Second).String()
|
|
case d > time.Second:
|
|
s = d.Round(10 * time.Millisecond).String()
|
|
case d > time.Millisecond:
|
|
s = d.Round(100 * time.Microsecond).String()
|
|
default:
|
|
s = d.String()
|
|
}
|
|
s = strings.TrimSuffix(s, "0s")
|
|
return strings.TrimSuffix(s, "0m")
|
|
}
|
|
|
|
func CRLFWriter(w io.Writer) io.Writer {
|
|
return &crlfWriter{w: w}
|
|
}
|
|
|
|
type crlfWriter struct {
|
|
w io.Writer
|
|
lastByte byte
|
|
}
|
|
|
|
func (cw *crlfWriter) Write(p []byte) (int, error) {
|
|
var written int
|
|
for _, b := range p {
|
|
if b == '\n' && cw.lastByte != '\r' {
|
|
if _, err := cw.w.Write([]byte{'\r'}); err != nil {
|
|
return written, err
|
|
}
|
|
}
|
|
if _, err := cw.w.Write([]byte{b}); err != nil {
|
|
return written, err
|
|
}
|
|
written++
|
|
cw.lastByte = b
|
|
}
|
|
return written, nil
|
|
}
|