From f749941ca09de44c765635f857e1045c24effa87 Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Wed, 18 Sep 2019 02:13:55 +0100 Subject: [PATCH] version 0.9.0 and fix stdout hex encoding --- cmd/magneticod/main.go | 2 +- cmd/magneticow/main.go | 2 +- pkg/README.md | 12 ++++++++++++ pkg/persistence/stdout.go | 5 +++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/magneticod/main.go b/cmd/magneticod/main.go index 7b2148a..b241f23 100644 --- a/cmd/magneticod/main.go +++ b/cmd/magneticod/main.go @@ -56,7 +56,7 @@ func main() { return } - zap.L().Info("magneticod v0.8.2 has been started.") + zap.L().Info("magneticod v0.9.0 has been started.") zap.L().Info("Copyright (C) 2017-2019 Mert Bora ALPER .") zap.L().Info("Dedicated to Cemile Binay, in whose hands I thrived.") zap.S().Infof("Compiled on %s", compiledOn) diff --git a/cmd/magneticow/main.go b/cmd/magneticow/main.go index bcb350d..fd05785 100644 --- a/cmd/magneticow/main.go +++ b/cmd/magneticow/main.go @@ -61,7 +61,7 @@ func main() { defer logger.Sync() zap.ReplaceGlobals(logger) - zap.L().Info("magneticow v0.8.2 has been started.") + zap.L().Info("magneticow v0.9.0 has been started.") zap.L().Info("Copyright (C) 2017-2019 Mert Bora ALPER .") zap.L().Info("Dedicated to Cemile Binay, in whose hands I thrived.") zap.S().Infof("Compiled on %s", compiledOn) diff --git a/pkg/README.md b/pkg/README.md index ceacb37..d54fa32 100644 --- a/pkg/README.md +++ b/pkg/README.md @@ -5,3 +5,15 @@ magnetico databases with different engines (currently, only SQLite). **For REST-ful magneticow API, see [https://app.swaggerhub.com/apis/boramalper/magneticow-api/](https://app.swaggerhub.com/apis/boramalper/magneticow-api/).** + +## Stdout Dummy Database Engine for magneticod + +Stdout dummy database engine for **magneticod** prints a new [JSON Line](http://jsonlines.org/) +for each discovered torrent so that you can pipe the stdout of **magneticod** into some other +program to build your own pipelines on the fly! + +**Example Output** + +```json + +``` diff --git a/pkg/persistence/stdout.go b/pkg/persistence/stdout.go index 1ea101c..814e4ac 100644 --- a/pkg/persistence/stdout.go +++ b/pkg/persistence/stdout.go @@ -1,6 +1,7 @@ package persistence import ( + "encoding/hex" "encoding/json" "net/url" "os" @@ -9,7 +10,7 @@ import ( ) type out struct { - InfoHash []byte `json:"infoHash"` + InfoHash string `json:"infoHash"` Name string `json:"name"` Files []File `json:"files"` } @@ -41,7 +42,7 @@ func (s *stdout) DoesTorrentExist(infoHash []byte) (bool, error) { func (s *stdout) AddNewTorrent(infoHash []byte, name string, files []File) error { err := s.encoder.Encode(out{ - InfoHash: infoHash, + InfoHash: hex.EncodeToString(infoHash), Name: name, Files: files, })