summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-25 02:54:37 +0530
committerAndinus <andinus@nand.sh>2020-03-25 02:54:37 +0530
commitf86d02187b6bb9536a6af9ceadde2e7e6f9bff5d (patch)
treecf0bddf394024d3f06fe6e1681c373deb5a71dc3
parentdb077551879bf2fee3cc54f7b25c39c21965c600 (diff)
downloadcetus-f86d02187b6bb9536a6af9ceadde2e7e6f9bff5d.tar.gz
Disable random flag on bpod & warn in readme
-rw-r--r--README.org5
-rw-r--r--cmd/cetus/bpod.go20
2 files changed, 22 insertions, 3 deletions
diff --git a/README.org b/README.org
index 19d7686..f129d54 100644
--- a/README.org
+++ b/README.org
@@ -40,6 +40,11 @@ download the binary, it will just print the steps to install cetus & you have to
 run those commands manually. Better yet don't pipe it directly to sh but review
 it before running.
 
+*Warning*: Don't use random flag on BPOD, it has been disabled in v0.6.1 but
+v0.6.0 will cause issues if random flag is used with BPOD.
+
+=cetus set bpod -random # don't do this=
+
 #+BEGIN_SRC sh
 curl -s https://tildegit.org/andinus/cetus/raw/branch/master/scripts/install.sh | sh
 #+END_SRC
diff --git a/cmd/cetus/bpod.go b/cmd/cetus/bpod.go
index d16dc22..9e92edb 100644
--- a/cmd/cetus/bpod.go
+++ b/cmd/cetus/bpod.go
@@ -24,6 +24,13 @@ func execBPOD() {
 	reqInfo = make(map[string]string)
 	reqInfo["api"] = bpodApi
 
+	// Disable random flag on bpod.
+	if random {
+		log.Println("Random flag on BPOD has been disabled due to a bug")
+		log.Println("https://github.com/andinus/cetus/issues/1")
+		random = false
+	}
+
 	if random {
 		reqInfo["random"] = "true"
 	}
@@ -108,9 +115,16 @@ func execBPOD() {
 	// bug in the program. Random flag was passed so 7 images will
 	// be retrieved & 7 will get saved in this json file. This
 	// will cause error when `cetus set bpod -random` is run for
-	// the first time on specific date & then `cetus set bpod` is
-	// run, the second command will set random background because
-	// the first one has downloaded all 7 in the json file.
+	// the first time on specific date and the same date gets
+	// selected randomly & then `cetus set bpod` is run, the
+	// second command will set random background because the first
+	// one has downloaded all 7 in the json file.
+	//
+	// Solution: Marshal json again but keeping only the selected
+	// date information. This is not a perfect solution, if you
+	// have a better solution then please let me know. For time
+	// being I have to disable random flag in bpod because of this
+	// bug.
 	if random {
 		// Write body to the cache so that it can be read
 		// later.