summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-24 17:41:57 +0530
committerAndinus <andinus@nand.sh>2020-03-24 17:41:57 +0530
commit813b37d0cf7e6e371418feac56d40f48176105ba (patch)
tree2e4efd2224ff84700cbf354ea0ff75775d79a8a0
parent532c060fd97c31c28f20f6f823472247edc0c30f (diff)
downloadcetus-813b37d0cf7e6e371418feac56d40f48176105ba.tar.gz
Reinitialize project and change module url
-rw-r--r--build/ci/gitlab-ci.yml26
-rw-r--r--cmd/cetus/apod.go121
-rw-r--r--cmd/cetus/bpod.go148
-rw-r--r--cmd/cetus/main.go148
-rw-r--r--go.mod4
-rw-r--r--go.sum2
-rw-r--r--pkg/apod/json.go48
-rw-r--r--pkg/apod/print.go19
-rw-r--r--pkg/apod/rand.go25
-rw-r--r--pkg/background/download.go34
-rw-r--r--pkg/background/set_darwin.go14
-rw-r--r--pkg/background/set_unix.go30
-rw-r--r--pkg/bpod/json.go55
-rw-r--r--pkg/bpod/print.go14
-rw-r--r--pkg/request/req.go44
-rwxr-xr-xscripts/install.sh65
16 files changed, 1 insertions, 796 deletions
diff --git a/build/ci/gitlab-ci.yml b/build/ci/gitlab-ci.yml
deleted file mode 100644
index 2a140ea..0000000
--- a/build/ci/gitlab-ci.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-image: golang:1.13
-
-variables:
-  REPO_NAME: framagit.org/andinus/cetus
-
-before_script:
-  - mkdir -p $GOPATH/src/$REPO_NAME
-  - cp -fr $CI_PROJECT_DIR/* $GOPATH/src/$REPO_NAME/
-  - cd $GOPATH/src/$REPO_NAME
-
-stages:
-  - build
-  - deploy
-
-compile:
-    stage: build
-    script:
-      - cd $GOPATH/src/$REPO_NAME/cmd/cetus
-      - GOOS=openbsd GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-openbsd-amd64
-      - GOOS=linux GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-linux-amd64
-      - GOOS=darwin GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-darwin-amd64
-    artifacts:
-      paths:
-        - cetus-openbsd-amd64
-        - cetus-linux-amd64
-        - cetus-darwin-amd64
diff --git a/cmd/cetus/apod.go b/cmd/cetus/apod.go
deleted file mode 100644
index cb5abae..0000000
--- a/cmd/cetus/apod.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"io/ioutil"
-	"os"
-
-	"framagit.org/andinus/cetus/pkg/apod"
-	"framagit.org/andinus/cetus/pkg/background"
-	"framagit.org/andinus/indus/notification"
-)
-
-func execAPOD() {
-	// reqInfo holds all the parameters that needs to be sent with
-	// the request. GetJson() will pack apiKey & date in params
-	// map before sending it to another function. Adding params
-	// here will not change the behaviour of the function, changes
-	// have to be made in GetJson() too.
-	reqInfo := make(map[string]string)
-	reqInfo["api"] = string(*apodAPI)
-	reqInfo["apiKey"] = string(*apodKey)
-	reqInfo["date"] = string(*apodDate)
-
-	if *apodRand {
-		reqInfo["date"] = apod.RandDate()
-	}
-
-	cacheDir := fmt.Sprintf("%s/%s", getCacheDir(), "apod")
-	os.MkdirAll(cacheDir, os.ModePerm)
-
-	// Check if the file is available locally, if it is then don't
-	// download it again and get it from disk
-	var body string
-	file := fmt.Sprintf("%s/%s", cacheDir, reqInfo["date"])
-	if _, err := os.Stat(file); err == nil {
-		data, err := ioutil.ReadFile(file)
-		chkErr(err)
-		body = string(data)
-	} else if os.IsNotExist(err) {
-		body, err = apod.GetJson(reqInfo)
-		chkErr(err)
-
-		// Write body to the cache so that it can be read
-		// later
-		err = ioutil.WriteFile(file, []byte(body), 0644)
-		chkErr(err)
-	} else {
-		chkErr(err)
-	}
-
-	if *apodDump {
-		fmt.Printf(body)
-		os.Exit(0)
-	}
-
-	res := apod.Res{}
-	err := apod.UnmarshalJson(&res, body)
-	chkErr(err)
-
-	// res.Msg will be returned when there is error on user input
-	// or the api server.
-	if len(res.Msg) != 0 {
-		fmt.Printf("Message: %s", res.Msg)
-		os.Exit(1)
-	}
-
-	// If path-only is passed then it will only print the path,
-	// even if quiet is passed. If the user wants the program to
-	// be quiet then path-only shouldn't be passed. If path-only
-	// is not passed & quiet is also not passed then print the
-	// response.
-	//
-	// Path is only printed when the media type is an image
-	// because res.HDURL is empty on non image media type.
-	if *apodPathOnly {
-		fmt.Println(res.HDURL)
-	} else if !*apodQuiet {
-		apod.Print(res)
-	}
-
-	// Send a desktop notification if notify flag was passed
-	if *apodNotify {
-		n := notification.Notif{}
-		n.Title = res.Title
-		n.Message = fmt.Sprintf("%s\n\n%s",
-			res.Date,
-			res.Explanation)
-
-		err = n.Notify()
-		chkErr(err)
-	}
-
-	// Proceed only if the command was set because if it was fetch
-	// then it's already finished & should exit now.
-	if os.Args[1] == "fetch" {
-		os.Exit(0)
-	}
-
-	// Try to set background only if the media type is an image.
-	// First it downloads the image to the cache directory and
-	// then tries to set it with feh. If the download fails then
-	// it exits with a non-zero exit code.
-	if res.MediaType != "image" {
-		os.Exit(0)
-	}
-	imgCacheDir := fmt.Sprintf("%s/%s", cacheDir, "background")
-	os.MkdirAll(imgCacheDir, os.ModePerm)
-	imgFile := fmt.Sprintf("%s/%s", imgCacheDir, reqInfo["date"])
-
-	// Check if the file is available locally, if it is
-	// then don't download it again and set it from disk
-	if _, err := os.Stat(imgFile); os.IsNotExist(err) {
-		err = background.Download(imgFile, res.HDURL)
-		chkErr(err)
-	} else {
-		chkErr(err)
-	}
-
-	err = background.Set(imgFile)
-	chkErr(err)
-}
diff --git a/cmd/cetus/bpod.go b/cmd/cetus/bpod.go
deleted file mode 100644
index cf0a4bb..0000000
--- a/cmd/cetus/bpod.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package main
-
-import (
-	"fmt"
-	"io/ioutil"
-	"os"
-	"time"
-
-	"framagit.org/andinus/cetus/pkg/background"
-	"framagit.org/andinus/cetus/pkg/bpod"
-	"framagit.org/andinus/indus/notification"
-)
-
-func execBPOD() {
-	// reqInfo holds all the parameters that needs to be sent with
-	// the request. GetJson() will pack apiKey & date in params
-	// map before sending it to another function. Adding params
-	// here will not change the behaviour of the function, changes
-	// have to be made in GetJson() too.
-	reqInfo := make(map[string]string)
-	reqInfo["api"] = string(*bpodAPI)
-
-	if *bpodRand {
-		reqInfo["random"] = "true"
-	}
-
-	cacheDir := fmt.Sprintf("%s/%s", getCacheDir(), "bpod")
-	os.MkdirAll(cacheDir, os.ModePerm)
-
-	// Check if the file is available locally, if it is then don't
-	// download it again and get it from disk.
-	//
-	// We don't know the bpod date because that will be there in
-	// response & we can't read the response without requesting
-	// it. So this will assume the bpod date to be today's date if
-	// *bpodRand is not set true. If *bpodRand is set true then we
-	// can't assume the date. Also this way too it can cause error
-	// if our assumed date doesn't matches date at the server.
-	var body string
-	var file string
-	var err error
-
-	if !*bpodRand {
-		// If not *bpodRand and the file exists then read from
-		// disk, if the file doesn't exist then get it and
-		// save it to disk.
-		file = fmt.Sprintf("%s/%s", cacheDir, time.Now().UTC().Format("2006-01-02"))
-		if _, err := os.Stat(file); err == nil {
-			data, err := ioutil.ReadFile(file)
-			chkErr(err)
-			body = string(data)
-		} else if os.IsNotExist(err) {
-			body, err = bpod.GetJson(reqInfo)
-			chkErr(err)
-
-			// Write body to the cache so that it can be
-			// read later
-			err = ioutil.WriteFile(file, []byte(body), 0644)
-			chkErr(err)
-		} else {
-			chkErr(err)
-		}
-	} else {
-		// If *bpodRand then get the file and save it to disk
-		// after unmarshal because we don't know the file name
-		// yet
-		body, err = bpod.GetJson(reqInfo)
-		chkErr(err)
-	}
-
-	// Unmarshal before dump because otherwise if we come across
-	// the date for the first time then it would just dump and
-	// exit without saving it to cache. This way we first save it
-	// to cache if *bpodRand is true.
-	res, err := bpod.UnmarshalJson(body)
-	chkErr(err)
-
-	// Correct format
-	res.Url = fmt.Sprintf("%s%s", "https://www.bing.com", res.Url)
-	dt, err := time.Parse("20060102", res.StartDate)
-	chkErr(err)
-	res.StartDate = dt.Format("2006-01-02")
-
-	file = fmt.Sprintf("%s/%s", cacheDir, res.StartDate)
-	if *bpodRand {
-		// Write body to the cache so that it can be read
-		// later
-		err = ioutil.WriteFile(file, []byte(body), 0644)
-		chkErr(err)
-	}
-
-	if *bpodDump {
-		fmt.Printf(body)
-		os.Exit(0)
-	}
-
-	// If path-only is passed then it will only print the path,
-	// even if quiet is passed. If the user wants the program to
-	// be quiet then path-only shouldn't be passed. If path-only
-	// is not passed & quiet is also not passed then print the
-	// response.
-	//
-	// Path is only printed when the media type is an image
-	// because res.HDURL is empty on non image media type.
-	if *bpodPathOnly {
-		fmt.Println(res.Url)
-	} else if !*bpodQuiet {
-		bpod.Print(res)
-	}
-
-	// Send a desktop notification if notify flag was passed
-	if *bpodNotify {
-		n := notification.Notif{}
-		n.Title = res.Title
-		n.Message = fmt.Sprintf("%s\n\n%s",
-			res.StartDate,
-			res.Copyright)
-
-		err = n.Notify()
-		chkErr(err)
-	}
-
-	// Proceed only if the command was set because if it was fetch
-	// then it's already finished & should exit now.
-	if os.Args[1] == "fetch" {
-		os.Exit(0)
-	}
-
-	// Try to set background only if the media type is an image.
-	// First it downloads the image to the cache directory and
-	// then tries to set it with feh. If the download fails then
-	// it exits with a non-zero exit code.
-	imgCacheDir := fmt.Sprintf("%s/%s", cacheDir, "background")
-	os.MkdirAll(imgCacheDir, os.ModePerm)
-	imgFile := fmt.Sprintf("%s/%s", imgCacheDir, res.StartDate)
-
-	// Check if the file is available locally, if it is then don't
-	// download it again and set it from disk
-	if _, err := os.Stat(imgFile); os.IsNotExist(err) {
-		err = background.Download(imgFile, res.Url)
-		chkErr(err)
-	} else {
-		chkErr(err)
-	}
-
-	err = background.Set(imgFile)
-	chkErr(err)
-}
diff --git a/cmd/cetus/main.go b/cmd/cetus/main.go
deleted file mode 100644
index 613c587..0000000
--- a/cmd/cetus/main.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package main
-
-import (
-	"flag"
-	"fmt"
-	"math/rand"
-	"os"
-	"time"
-)
-
-var (
-	apodAPI      *string
-	apodKey      *string
-	apodDate     *string
-	apodRand     *bool
-	apodPathOnly *bool
-	apodQuiet    *bool
-	apodDump     *bool
-
-	bpodAPI      *string
-	bpodRand     *bool
-	bpodPathOnly *bool
-	bpodQuiet    *bool
-	bpodDump     *bool
-
-	apodNotify *bool
-	bpodNotify *bool
-)
-
-func main() {
-	// Early Check: If command was not passed then print usage and
-	// exit. Later command & service both are checked, this check
-	// if for version command. If not checked then running cetus
-	// without any args will fail because os.Args[1] will panic
-	// the program & produce runtime error.
-	if len(os.Args) == 1 {
-		printUsage()
-		os.Exit(1)
-	}
-
-	version := "v0.5.2"
-
-	if os.Args[1] == "version" {
-		fmt.Printf("Cetus %s\n", version)
-		os.Exit(0)
-	}
-
-	// If command & service was not passed then print usage and
-	// exit.
-	if len(os.Args) < 3 {
-		printUsage()
-		os.Exit(1)
-	}
-
-	rand.Seed(time.Now().Unix())
-
-	apodCmd := flag.NewFlagSet("apod", flag.ExitOnError)
-	bpodCmd := flag.NewFlagSet("bpod", flag.ExitOnError)
-
-	defDate := time.Now().UTC().Format("2006-01-02")
-
-	// Flags to parse for apod service.
-	apodAPI = apodCmd.String("api", "https://api.nasa.gov/planetary/apod", "APOD API link")
-	apodKey = apodCmd.String("api-key", "DEMO_KEY", "NASA API Key for expanded usage")
-	apodDate = apodCmd.String("date", defDate, "Date of NASA APOD to retrieve")
-	apodRand = apodCmd.Bool("random", false, "Choose a date random starting from 1995-06-16")
-	apodPathOnly = apodCmd.Bool("path-only", false, "Print only the path")
-	apodQuiet = apodCmd.Bool("quiet", false, "Stay quiet")
-	apodDump = apodCmd.Bool("dump", false, "Dump received response")
-	apodNotify = apodCmd.Bool("notify", false, "Send a desktop notification with background information")
-
-	// Flags to parse for bpod service.
-	bpodAPI = bpodCmd.String("api", "https://www.bing.com/HPImageArchive.aspx", "BPOD API")
-	bpodRand = bpodCmd.Bool("random", false, "Choose a random image from last week's BPOD")
-	bpodPathOnly = bpodCmd.Bool("path-only", false, "Print only the path")
-	bpodQuiet = bpodCmd.Bool("quiet", false, "Stay quiet")
-	bpodDump = bpodCmd.Bool("dump", false, "Dump received response")
-	bpodNotify = bpodCmd.Bool("notify", false, "Send a desktop notification with background information")
-
-	// Switching on commands will cause more repetition than
-	// switching on service. If we switch on commands then switch
-	// on service will have to be replicated on every command
-	// switch. Reverse is also true, this way we will repeat
-	// command switch in every service but we do so in a better
-	// way.
-	//
-	// However we check if the correct command was passed. version
-	// command is not included because it has been dealt with
-	// earlier in the program & the program should've exited after
-	// that, if it reaches here then it's an error.
-	switch os.Args[1] {
-	case "set", "fetch":
-	default:
-		fmt.Printf("Invalid command: %q\n", os.Args[1])
-		printUsage()
-		os.Exit(1)
-	}
-
-	switch os.Args[2] {
-	case "apod", "nasa":
-		apodCmd.Parse(os.Args[3:])
-		if apodCmd.Parsed() {
-			execAPOD()
-		}
-	case "bpod", "bing":
-		bpodCmd.Parse(os.Args[3:])
-		if bpodCmd.Parsed() {
-			execBPOD()
-		}
-	default:
-		fmt.Printf("Invalid service: %q\n", os.Args[2])
-		printUsage()
-		os.Exit(1)
-	}
-}
-
-func printUsage() {
-	fmt.Println("Usage: cetus <command> <service> [<flags>]\n")
-	fmt.Println("Commands: ")
-	fmt.Println(" set     Set the latest image as background")
-	fmt.Println(" fetch   Fetch the latest image information")
-	fmt.Println(" version Print version")
-	fmt.Println("\nServices: ")
-	fmt.Println(" apod   NASA Astronomy Picture of the Day")
-	fmt.Println(" bpod   Bing Photo of the Day")
-}
-
-// Check whether user has set CETUS_CACHE_DIR, if not then use the
-// XDG_CACHE_HOME. If XDG_CACHE_HOME is not set then $HOME/.config
-// should be used, according to XDG Base Directory Specification
-func getCacheDir() string {
-	cacheDir := os.Getenv("CETUS_CACHE_DIR")
-	if len(cacheDir) == 0 {
-		cacheDir = os.Getenv("XDG_CACHE_HOME")
-	}
-	if len(cacheDir) == 0 {
-		cacheDir = fmt.Sprintf("%s/%s/%s", os.Getenv("HOME"),
-			".cache", "cetus")
-	}
-	return cacheDir
-}
-
-func chkErr(err error) {
-	if err != nil {
-		fmt.Println(err)
-		os.Exit(1)
-	}
-}
diff --git a/go.mod b/go.mod
index 2831fa0..1c3c737 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,3 @@
-module framagit.org/andinus/cetus
+module tildegit.org/andinus/cetus
 
 go 1.13
-
-require framagit.org/andinus/indus v0.1.0
diff --git a/go.sum b/go.sum
deleted file mode 100644
index 6410ae6..0000000
--- a/go.sum
+++ /dev/null
@@ -1,2 +0,0 @@
-framagit.org/andinus/indus v0.1.0 h1:3aY1smToiF4rdEYlvEeAVMU/9SEzq+3pqZpI2MUgbfA=
-framagit.org/andinus/indus v0.1.0/go.mod h1:a281k0YF06Cral0R7LK0EAVs7f2SB4MrTp+L3BMEIT8=
diff --git a/pkg/apod/json.go b/pkg/apod/json.go
deleted file mode 100644
index d484209..0000000
--- a/pkg/apod/json.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package apod
-
-import (
-	"encoding/json"
-	"fmt"
-	"regexp"
-
-	"framagit.org/andinus/cetus/pkg/request"
-)
-
-// Res holds the response from the api.
-type Res struct {
-	Copyright      string `json:"copyright"`
-	Date           string `json:"date"`
-	Explanation    string `json:"explanation"`
-	HDURL          string `json:"hdurl"`
-	MediaType      string `json:"media_type"`
-	ServiceVersion string `json:"service_version"`
-	Title          string `json:"title"`
-	URL            string `json:"url"`
-
-	Code int    `json:"code"`
-	Msg  string `json:"msg"`
-}
-
-// UnmarshalJson will take body as input & unmarshal it to res
-func UnmarshalJson(res *Res, body string) error {
-	err := json.Unmarshal([]byte(body), res)
-	if err != nil {
-		return fmt.Errorf("UnmarshalJson failed\n%s", err.Error())
-	}
-	return nil
-}
-
-// GetJson returns json response received from the api
-func GetJson(reqInfo map[string]string) (string, error) {
-	re := regexp.MustCompile("((19|20)\\d\\d)-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])")
-	if !re.MatchString(reqInfo["date"]) {
-		return "", fmt.Errorf("%s does not match format 'YYYY-MM-DD'", reqInfo["date"])
-	}
-
-	params := make(map[string]string)
-	params["api_key"] = reqInfo["apiKey"]
-	params["date"] = reqInfo["date"]
-
-	body, err := request.GetRes(reqInfo["api"], params)
-	return string(body), err
-}
diff --git a/pkg/apod/print.go b/pkg/apod/print.go
deleted file mode 100644
index a087665..0000000
--- a/pkg/apod/print.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package apod
-
-import (
-	"fmt"
-)
-
-// Print will print the json output
-func Print(res Res) {
-	fmt.Printf("Title: %s\n\n", res.Title)
-	fmt.Printf("Copyright: %s\n", res.Copyright)
-	fmt.Printf("Date: %s\n\n", res.Date)
-	fmt.Printf("Media Type: %s\n", res.MediaType)
-	if res.MediaType == "image" {
-		fmt.Printf("URL: %s\n\n", res.HDURL)
-	} else {
-		fmt.Printf("URL: %s\n\n", res.URL)
-	}
-	fmt.Printf("Explanation: %s\n", res.Explanation)
-}
diff --git a/pkg/apod/rand.go b/pkg/apod/rand.go
deleted file mode 100644
index cf92784..0000000
--- a/pkg/apod/rand.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package apod
-
-import (
-	"math/rand"
-	"time"
-)
-
-// RandDate returns a random date between 1995-06-16 & today
-func RandDate() string {
-	var (
-		min   int64
-		max   int64
-		sec   int64
-		delta int64
-		date  string
-	)
-	min = time.Date(1995, 6, 16, 0, 0, 0, 0, time.UTC).Unix()
-	max = time.Now().UTC().Unix()
-	delta = max - min
-
-	sec = rand.Int63n(delta) + min
-	date = time.Unix(sec, 0).Format("2006-01-02")
-
-	return date
-}
diff --git a/pkg/background/download.go b/pkg/background/download.go
deleted file mode 100644
index 78ff135..0000000
--- a/pkg/background/download.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package background
-
-import (
-	"fmt"
-	"io"
-	"net/http"
-	"os"
-)
-
-// Download takes path and url as input and downloads the data to a
-// file, returning an error if there is one
-func Download(file string, url string) error {
-	o, err := os.Create(file)
-	if err != nil {
-		return err
-	}
-	defer o.Close()
-
-	res, err := http.Get(url)
-	if err != nil {
-		return err
-	}
-	defer res.Body.Close()
-
-	if res.StatusCode != http.StatusOK {
-		return fmt.Errorf("Unexpected Response: %s", res.Status)
-	}
-
-	_, err = io.Copy(o, res.Body)
-	if err != nil {
-		return err
-	}
-	return nil
-}
diff --git a/pkg/background/set_darwin.go b/pkg/background/set_darwin.go
deleted file mode 100644
index 2ead214..0000000
--- a/pkg/background/set_darwin.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build darwin
-
-package background
-
-import (
-	"os/exec"
-	"strconv"
-)
-
-// Set calls feh to set the background
-func Set(path string) error {
-	err := exec.Command("osascript", "-e", `tell application "System Events" to tell every desktop to set picture to `+strconv.Quote(path)).Run()
-	return err
-}
diff --git a/pkg/background/set_unix.go b/pkg/background/set_unix.go
deleted file mode 100644
index cd75ae3..0000000
--- a/pkg/background/set_unix.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build linux netbsd openbsd freebsd dragonfly
-
-package background
-
-import (
-	"fmt"
-	"os"
-	"os/exec"
-)
-
-// Set calls feh to set the background
-func Set(path string) error {
-	var err error
-	switch os.Getenv("XDG_CURRENT_DESKTOP") {
-	case "GNOME", "Unity", "Pantheon":
-		path = fmt.Sprintf("%s%s", "file://", path)
-		err = exec.Command("gsettings", "set org.gnome.desktop.background picture-uri", path).Run()
-		return err
-	case "LXDE":
-		err = exec.Command("pcmanfm", "-w", path).Run()
-		return err
-	default:
-		feh, err := exec.LookPath("feh")
-		if err != nil {
-			return err
-		}
-		err = exec.Command(feh, "--bg-fill", path).Run()
-		return err
-	}
-}
diff --git a/pkg/bpod/json.go b/pkg/bpod/json.go
deleted file mode 100644
index d895bcf..0000000
--- a/pkg/bpod/json.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package bpod
-
-import (
-	"encoding/json"
-	"fmt"
-	"math/rand"
-
-	"framagit.org/andinus/cetus/pkg/request"
-)
-
-type Res struct {
-	StartDate     string `json:"startdate"`
-	FullStartDate string `json:"fullstartdate"`
-	EndDate       string `json:"enddate"`
-	Url           string `json:"url"`
-	UrlBase       string `json:"urlbase"`
-	Copyright     string `json:"copyright"`
-	CopyrightLink string `json:"copyrightlink"`
-	Title         string `json:"title"`
-	Hsh           string `json:"hsh"`
-}
-
-type List struct {
-	Photos []Res `json:"images"`
-}
-
-// UnmarshalJson will take body as input & unmarshal it to res
-func UnmarshalJson(body string) (Res, error) {
-	list := List{}
-	res := Res{}
-
-	err := json.Unmarshal([]byte(body), &list)
-	if err != nil {
-		return res, fmt.Errorf("UnmarshalJson failed\n%s", err.Error())
-	}
-
-	res = list.Photos[rand.Intn(len(list.Photos))]
-	return res, nil
-}
-
-// GetJson returns json response received from the api
-func GetJson(reqInfo map[string]string) (string, error) {
-	params := make(map[string]string)
-	params["format"] = "js"
-	params["n"] = "1"
-
-	// if random is true then fetch 7 photos
-	if reqInfo["random"] == "true" {
-		params["n"] = "7"
-
-	}
-
-	body, err := request.GetRes(reqInfo["api"], params)
-	return string(body), err
-}
diff --git a/pkg/bpod/print.go b/pkg/bpod/print.go
deleted file mode 100644
index 75bf948..0000000
--- a/pkg/bpod/print.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package bpod
-
-import (
-	"fmt"
-)
-
-// Print will print the json output
-func Print(res Res) {
-	fmt.Printf("Title: %s\n\n", res.Title)
-	fmt.Printf("Copyright: %s\n", res.Copyright)
-	fmt.Printf("Copyright Link: %s\n", res.CopyrightLink)
-	fmt.Printf("Date: %s\n\n", res.StartDate)
-	fmt.Printf("URL: %s\n", res.Url)
-}
diff --git a/pkg/request/req.go b/pkg/request/req.go
deleted file mode 100644
index 350f5f6..0000000
--- a/pkg/request/req.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package request
-
-import (
-	"fmt"
-	"io/ioutil"
-	"net/http"
-	"time"
-)
-
-// GetRes returns api response
-func GetRes(api string, params map[string]string) (string, error) {
-	c := http.Client{
-		// TODO: timeout should be configurable by the user
-		Timeout: time.Second * 64,
-	}
-
-	req, err := http.NewRequest(http.MethodGet, api, nil)
-	if err != nil {
-		return "", err
-	}
-
-	q := req.URL.Query()
-	for k, v := range params {
-		q.Add(k, v)
-	}
-	req.URL.RawQuery = q.Encode()
-
-	res, err := c.Do(req)
-	if err != nil {
-		return "", err
-	}
-	defer res.Body.Close()
-
-	if res.StatusCode != 200 {
-		return "", fmt.Errorf("Unexpected response status code received: %d %s",
-			res.StatusCode, http.StatusText(res.StatusCode))
-	}
-
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		return "", err
-	}
-	return string(body), err
-}
diff --git a/scripts/install.sh b/scripts/install.sh
deleted file mode 100755
index 5fc910e..0000000
--- a/scripts/install.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-freebsdH="dae9b5b61e96919e94f7cd9510fd06ce318290fdee9dcd459005baaf67471377"
-openbsdH="49a8a899302267a103a7406032debef40d7cfd25cf856cf3a34cac969fba3490"
-linuxH="711265cc460989a42906b0ff46946dd55810682587469623ce86776223f02347"
-
-earlyCheck(){
-    os=`uname`
-    os=`echo $os | tr "[:upper:]" "[:lower:"]`
-
-    case $os in
-        *openbsd* | *linux* | *freebsd* ) ;;
-        *)
-            echo "Pre-built binary not available for your os"
-            exit 1
-            ;;
-    esac
-
-    cpu=`uname -m`
-    cpu=`echo $cpu | tr "[:upper:]" "[:lower:"]`
-
-    case $cpu in
-        *amd*64* | *x86*64* ) ;;
-        *)
-            echo "Pre-built binary not available for your cpu"
-            exit 1
-            ;;
-    esac
-}
-
-getURL(){
-    url="https://archive.org/download/cetus-v0.5.1/cetus-v0.5.1-$os-$cpu"
-}
-
-printURL(){
-    echo "You can get the Pre-built binary here:"
-    echo "$url"
-    echo
-    echo "Run these commands to install it on your device."
-    echo "# curl -L -o /usr/local/bin/cetus $url"
-    echo "# chmod +x /usr/local/bin/cetus"
-    echo
-    echo "You may want to verify the hash of the downloaded file."
-    echo "This is sha256 hash for cetus built for: $os $cpu"
-    case $os in
-        *openbsd* )
-            echo "$openbsdH"
-            ;;
-        *freebsd* )
-            echo "$freebsdH"
-            ;;
-        *linux* )
-            echo "$linuxH"
-            ;;
-    esac
-    echo
-    echo "Verify the hash by running sha256 on cetus binary."
-    echo "$ sha256 /usr/local/bin/cetus"
-}
-
-echo "Cetus v0.5.1"
-echo
-earlyCheck
-getURL
-printURL