Skip to content

Commit

Permalink
chore(log): Add punctuation
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Aug 15, 2023
1 parent 296af1b commit a1836d8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions internal/device/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func Watch(ctx context.Context, entry castdns.CastEntry) {
break
} else {
if tries == 0 {
logger.Warn("Failed to connect to device. Retrying")
logger.Warn("Failed to connect to device. Retrying...")
}
tries += 1
entry, err = DiscoverCastDNSEntryByUuid(ctx, entry.UUID)
if err != nil && tries >= 10 {
logger.Warn("Failed to start application", "error", err.Error())
logger.Warn("Failed to start application.", "error", err.Error())
return
}
}
Expand All @@ -48,13 +48,13 @@ func Watch(ctx context.Context, entry castdns.CastEntry) {
_ = app.Close(false)
}()

logger.Info("Connected to cast device")
logger.Info("Connected to cast device.")

var prevVideoId string
var segments []sponsorblock.Segment

if err := app.Update(); err != nil {
logger.Warn("Failed to update application")
logger.Warn("Failed to update application.")
return
}

Expand All @@ -70,7 +70,7 @@ func Watch(ctx context.Context, entry castdns.CastEntry) {
logger.Debug("Update")

if err := app.Update(); err != nil {
logger.Warn("Failed to update application", "error", err.Error())
logger.Warn("Failed to update application.", "error", err.Error())
continue
}

Expand All @@ -83,7 +83,7 @@ func Watch(ctx context.Context, entry castdns.CastEntry) {
}

if castMedia.Media.ContentId != prevVideoId {
logger.Info("Detected video stream", "video_id", castMedia.Media.ContentId)
logger.Info("Detected video stream.", "video_id", castMedia.Media.ContentId)
segments = nil
prevVideoId = castMedia.Media.ContentId
}
Expand All @@ -93,9 +93,9 @@ func Watch(ctx context.Context, entry castdns.CastEntry) {
segments, err = sponsorblock.QuerySegments(castMedia.Media.ContentId)
if err == nil {
if len(segments) == 0 {
logger.Info("No segments found for video", "video_id", castMedia.Media.ContentId)
logger.Info("No segments found for video.", "video_id", castMedia.Media.ContentId)
} else {
logger.Info("Found segments for video", "segments", len(segments))
logger.Info("Found segments for video.", "segments", len(segments))
}
} else {
logger.Error("Failed to query segments", "error", err.Error())
Expand All @@ -104,18 +104,18 @@ func Watch(ctx context.Context, entry castdns.CastEntry) {

for _, segment := range segments {
if castMedia.CurrentTime > segment.Segment[0] && castMedia.CurrentTime < segment.Segment[1]-1 {
logger.Info("Skipping to timestamp", "category", segment.Category, "timestamp", castMedia.CurrentTime, "segment", segment.Segment)
logger.Info("Skipping to timestamp.", "category", segment.Category, "timestamp", castMedia.CurrentTime, "segment", segment.Segment)
if err := app.SeekToTime(segment.Segment[1]); err != nil {
logger.Warn("Failed to seek to timestamp", "to", segment.Segment[1], "error", err.Error())
logger.Warn("Failed to seek to timestamp.", "to", segment.Segment[1], "error", err.Error())
}
break
}
}

if err := app.Skipad(); err == nil {
logger.Info("Skipped ad")
logger.Info("Skipped ad.")
} else if !errors.Is(err, application.ErrNoMediaSkipad) {
logger.Warn("Failed to skip ad", "error", err.Error())
logger.Warn("Failed to skip ad.", "error", err.Error())
}

ticker.Reset(config.PlayingIntervalValue)
Expand Down

0 comments on commit a1836d8

Please sign in to comment.