version 0.9.0 and fix stdout hex encoding

This commit is contained in:
Bora M. Alper 2019-09-18 02:13:55 +01:00
parent c310d993bb
commit f749941ca0
No known key found for this signature in database
GPG Key ID: 8F1A9504E1BD114D
4 changed files with 17 additions and 4 deletions

View File

@ -56,7 +56,7 @@ func main() {
return 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 <bora@boramalper.org>.") zap.L().Info("Copyright (C) 2017-2019 Mert Bora ALPER <bora@boramalper.org>.")
zap.L().Info("Dedicated to Cemile Binay, in whose hands I thrived.") zap.L().Info("Dedicated to Cemile Binay, in whose hands I thrived.")
zap.S().Infof("Compiled on %s", compiledOn) zap.S().Infof("Compiled on %s", compiledOn)

View File

@ -61,7 +61,7 @@ func main() {
defer logger.Sync() defer logger.Sync()
zap.ReplaceGlobals(logger) 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 <bora@boramalper.org>.") zap.L().Info("Copyright (C) 2017-2019 Mert Bora ALPER <bora@boramalper.org>.")
zap.L().Info("Dedicated to Cemile Binay, in whose hands I thrived.") zap.L().Info("Dedicated to Cemile Binay, in whose hands I thrived.")
zap.S().Infof("Compiled on %s", compiledOn) zap.S().Infof("Compiled on %s", compiledOn)

View File

@ -5,3 +5,15 @@
magnetico databases with different engines (currently, only SQLite). 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/).** **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
```

View File

@ -1,6 +1,7 @@
package persistence package persistence
import ( import (
"encoding/hex"
"encoding/json" "encoding/json"
"net/url" "net/url"
"os" "os"
@ -9,7 +10,7 @@ import (
) )
type out struct { type out struct {
InfoHash []byte `json:"infoHash"` InfoHash string `json:"infoHash"`
Name string `json:"name"` Name string `json:"name"`
Files []File `json:"files"` 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 { func (s *stdout) AddNewTorrent(infoHash []byte, name string, files []File) error {
err := s.encoder.Encode(out{ err := s.encoder.Encode(out{
InfoHash: infoHash, InfoHash: hex.EncodeToString(infoHash),
Name: name, Name: name,
Files: files, Files: files,
}) })