Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b5a3c58c6 | ||
|
|
8da5468efb |
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
# The frontend is built and published separately; override to pin a version.
|
||||
ARG FRONTEND_IMAGE=gitea.sanplex.xyz/sansan/musicfrontend:latest
|
||||
# The frontend is built and published separately. Bump this when a new frontend is released.
|
||||
ARG FRONTEND_IMAGE=gitea.sanplex.xyz/sansan/musicfrontend:v1.3.0
|
||||
|
||||
# Stage 1: Build the backend on the build machine and cross-compile for the target platform,
|
||||
# so multi-platform builds need no emulation.
|
||||
|
||||
@@ -45,12 +45,12 @@ type SyncResponse struct {
|
||||
SoundtracksChangedContent []string `json:"soundtracks_changed_content"`
|
||||
SoundtracksRemoved []string `json:"soundtracks_removed"`
|
||||
CatchedErrors []string `json:"catched_errors"`
|
||||
TotalTime string `json:"total_time"`
|
||||
TotalTime string `json:"total_time" doc:"How long the sync took, as minutes and seconds, e.g. \"02:15\""`
|
||||
}
|
||||
|
||||
type ProgressResponse struct {
|
||||
Progress string `json:"progress"`
|
||||
TimeSpent string `json:"time_spent"`
|
||||
TimeSpent string `json:"time_spent" doc:"How long the sync has been running, as minutes and seconds, e.g. \"02:15\""`
|
||||
}
|
||||
|
||||
type SoundtrackStatus int
|
||||
@@ -164,8 +164,11 @@ func (s *SyncService) ResetDB(ctx context.Context) error {
|
||||
return s.q.ClearSoundtracks(ctx)
|
||||
}
|
||||
|
||||
// formatDuration shows d as minutes and seconds, "MM:SS". A sync longer than an hour
|
||||
// keeps counting minutes, e.g. "75:03".
|
||||
func formatDuration(d time.Duration) string {
|
||||
return time.Time{}.Add(d).Format("15:04:05")
|
||||
seconds := int(d / time.Second)
|
||||
return fmt.Sprintf("%02d:%02d", seconds/60, seconds%60)
|
||||
}
|
||||
|
||||
// syncRun holds the state of a single sync.
|
||||
|
||||
@@ -401,7 +401,10 @@ func TestResetDB(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFormatDuration(t *testing.T) {
|
||||
assert.Equal(t, "01:02:03", formatDuration(time.Hour+2*time.Minute+3*time.Second))
|
||||
assert.Equal(t, "00:00", formatDuration(0))
|
||||
assert.Equal(t, "00:07", formatDuration(7*time.Second+900*time.Millisecond), "parts of a second are left out")
|
||||
assert.Equal(t, "02:15", formatDuration(2*time.Minute+15*time.Second))
|
||||
assert.Equal(t, "62:03", formatDuration(time.Hour+2*time.Minute+3*time.Second), "minutes keep counting past an hour")
|
||||
}
|
||||
|
||||
func TestSyncKeepsAlternativeNamesAndCover(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user