mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-16 10:09:28 +02:00
Use ImportResult log for dump backend
This commit is contained in:
parent
8a2ddb7772
commit
1cea9bd301
1 changed files with 8 additions and 4 deletions
|
@ -17,6 +17,8 @@ Scotty. If not, see <https://www.gnu.org/licenses/>.
|
||||||
package dump
|
package dump
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"go.uploadedlobster.com/scotty/internal/config"
|
"go.uploadedlobster.com/scotty/internal/config"
|
||||||
"go.uploadedlobster.com/scotty/internal/models"
|
"go.uploadedlobster.com/scotty/internal/models"
|
||||||
)
|
)
|
||||||
|
@ -38,9 +40,10 @@ func (b *DumpBackend) ImportListens(export models.ListensResult, importResult mo
|
||||||
for _, listen := range export.Items {
|
for _, listen := range export.Items {
|
||||||
importResult.UpdateTimestamp(listen.ListenedAt)
|
importResult.UpdateTimestamp(listen.ListenedAt)
|
||||||
importResult.ImportCount += 1
|
importResult.ImportCount += 1
|
||||||
|
msg := fmt.Sprintf("🎶 %v: \"%v\" by %v (%v)",
|
||||||
|
listen.ListenedAt, listen.TrackName, listen.ArtistName(), listen.RecordingMbid)
|
||||||
|
importResult.Log(models.Info, msg)
|
||||||
progress <- models.Progress{}.FromImportResult(importResult)
|
progress <- models.Progress{}.FromImportResult(importResult)
|
||||||
// fmt.Printf("🎶 %v: \"%v\" by %v (%v)\n",
|
|
||||||
// listen.ListenedAt, listen.TrackName, listen.ArtistName(), listen.RecordingMbid)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return importResult, nil
|
return importResult, nil
|
||||||
|
@ -50,9 +53,10 @@ func (b *DumpBackend) ImportLoves(export models.LovesResult, importResult models
|
||||||
for _, love := range export.Items {
|
for _, love := range export.Items {
|
||||||
importResult.UpdateTimestamp(love.Created)
|
importResult.UpdateTimestamp(love.Created)
|
||||||
importResult.ImportCount += 1
|
importResult.ImportCount += 1
|
||||||
|
msg := fmt.Sprintf("❤️ %v: \"%v\" by %v (%v)",
|
||||||
|
love.Created, love.TrackName, love.ArtistName(), love.RecordingMbid)
|
||||||
|
importResult.Log(models.Info, msg)
|
||||||
progress <- models.Progress{}.FromImportResult(importResult)
|
progress <- models.Progress{}.FromImportResult(importResult)
|
||||||
// fmt.Printf("❤️ %v: \"%v\" by %v (%v)\n",
|
|
||||||
// love.Created, love.TrackName, love.ArtistName(), love.RecordingMbid)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return importResult, nil
|
return importResult, nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue