1
Fork 0

Add username to scanner notifications

This commit is contained in:
viktorstrate 2020-04-15 11:27:34 +02:00
parent b254f3abaa
commit afb0428c2d
1 changed files with 6 additions and 6 deletions

View File

@ -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,
})