aboutsummaryrefslogtreecommitdiff
path: root/youtube.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-12-28 13:27:05 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2022-12-28 13:27:05 +0100
commitaa5c7fc159b0f5175ede96d46b8d2a2669a176a4 (patch)
tree58964be878af574263b8d1994f3097860db2192e /youtube.go
parente15e1c6a4cb4a534d649cfc3d1be68498fddac48 (diff)
downloadWRMS-aa5c7fc159b0f5175ede96d46b8d2a2669a176a4.tar.gz
WRMS-aa5c7fc159b0f5175ede96d46b8d2a2669a176a4.zip
llog: use variable argument list
Mirror more closely the fmt interface and reduce the verbosity of the log call sites. Additionally the log message is only created if we are actually going to log it.
Diffstat (limited to 'youtube.go')
-rw-r--r--youtube.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/youtube.go b/youtube.go
index 8997bc9..547e555 100644
--- a/youtube.go
+++ b/youtube.go
@@ -27,11 +27,11 @@ type YoutubeDlSearchResult struct {
func (b *YoutubeBackend) Search(pattern string) []Song {
searchOption := fmt.Sprintf("ytsearch%d:%s", b.searchResults, pattern)
- llog.Debug(fmt.Sprintf("Search youtube using: youtube-dl -j %s", searchOption))
+ llog.Debug("Search youtube using: youtube-dl -j %s", searchOption)
results, err := exec.Command("youtube-dl", "-j", searchOption).Output()
if err != nil {
- llog.Error(fmt.Sprintf("youtube-dl failed with: %s", err))
+ llog.Error("youtube-dl failed with: %s", err)
}
songs := []Song{}
@@ -43,12 +43,12 @@ func (b *YoutubeBackend) Search(pattern string) []Song {
result := YoutubeDlSearchResult{}
err = json.Unmarshal([]byte(l), &result)
if err != nil {
- llog.Debug(fmt.Sprintf("Parsing youtube-dl results '%s' failed", l))
- llog.Error(fmt.Sprintf("Parsing youtube-dl results failed with: %s", err))
+ llog.Debug("Parsing youtube-dl results '%s' failed", l)
+ llog.Error("Parsing youtube-dl results failed with: %s", err)
}
songs = append(songs, NewSong(result.Title, "", "youtube", result.Id))
}
- llog.Debug(fmt.Sprintf("youtube found %d matching videos", len(songs)))
+ llog.Debug("youtube found %d matching videos", len(songs))
return songs
}