From afb0428c2d919a8cb9af38b7917e99ffe5b9ba62 Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Wed, 15 Apr 2020 11:27:34 +0200 Subject: [PATCH] Add username to scanner notifications --- api/scanner/album_scanner.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/scanner/album_scanner.go b/api/scanner/album_scanner.go index 75003547..cdebd115 100644 --- a/api/scanner/album_scanner.go +++ b/api/scanner/album_scanner.go @@ -108,7 +108,7 @@ func scan(database *sql.DB, user *models.User) { Key: notifyKey, Type: models.NotificationTypeMessage, Header: "User scan started", - Content: "Scanning has started...", + Content: fmt.Sprintf("Scanning has started for user '%s'", user.Username), Timeout: &timeout, }) @@ -204,7 +204,7 @@ func scan(database *sql.DB, user *models.User) { notification.BroadcastNotification(&models.Notification{ Key: processKey, Type: models.NotificationTypeMessage, - Header: "Scanning photo", + Header: fmt.Sprintf("Scanning photo for user '%s'", user.Username), Content: fmt.Sprintf("Scanning image at %s", photoPath), }) }) @@ -240,7 +240,7 @@ func scan(database *sql.DB, user *models.User) { notification.BroadcastNotification(&models.Notification{ Key: notifyKey, Type: models.NotificationTypeMessage, - Header: "Scan completed", + Header: fmt.Sprintf("Scan completed for user '%s'", user.Username), Content: completeMessage, Positive: true, }) @@ -252,7 +252,7 @@ func scan(database *sql.DB, user *models.User) { log.Printf("ERROR: processing photos: %s\n", err) } - log.Println("Done scanning") + log.Printf("Done scanning user '%s'\n", user.Username) } func directoryContainsPhotos(rootPath string, cache *scanner_cache) bool { @@ -391,7 +391,7 @@ func processUnprocessedPhotos(database *sql.DB, user *models.User, notifyKey str notification.BroadcastNotification(&models.Notification{ Key: processKey, Type: models.NotificationTypeProgress, - Header: fmt.Sprintf("Processing photos (%d of %d)", count, len(photosToProcess)), + Header: fmt.Sprintf("Processing photos (%d of %d) for user '%s'", count, len(photosToProcess), user.Username), Content: fmt.Sprintf("Processing photo at %s", photo.Path), Progress: &progress, }) @@ -415,7 +415,7 @@ func processUnprocessedPhotos(database *sql.DB, user *models.User, notifyKey str notification.BroadcastNotification(&models.Notification{ Key: notifyKey, Type: models.NotificationTypeMessage, - Header: "Processing completed", + Header: fmt.Sprintf("Processing photos for user '%s' has completed", user.Username), Content: fmt.Sprintf("%d photos have been processed", len(photosToProcess)), Positive: true, })