Skip to content

Commit

Permalink
rename preset directory to pdfpresets
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Nov 23, 2023
1 parent 4c9838d commit 7ef9843
Show file tree
Hide file tree
Showing 37 changed files with 35 additions and 36 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ jobs:
env GOOS=darwin GOARCH=arm64 go build -o getnovel-arm64 -ldflags="-s -w" .
mkdir darwin-universal
lipo -create -output darwin-universal/getnovel getnovel-amd64 getnovel-arm64
cp -r preset darwin-universal/
cp -r pdfpresets darwin-universal/
env GOOS=linux GOARCH=amd64 go build -o linux-amd64/getnovel -ldflags="-s -w" .
cp -r preset linux-amd64/
cp -r pdfpresets linux-amd64/
env GOOS=linux GOARCH=arm go build -o linux-arm/getnovel -ldflags="-s -w" .
cp -r preset linux-arm/
cp -r pdfpresets linux-arm/
env GOOS=linux GOARCH=arm64 go build -o linux-arm64/getnovel -ldflags="-s -w" .
cp -r preset linux-arm64/
cp -r pdfpresets linux-arm64/
env GOOS=windows GOARCH=amd64 go build -o windows-amd64/getnovel.exe -ldflags="-s -w" .
cp -r preset windows-amd64/
cp -r pdfpresets windows-amd64/
env GOOS=freebsd GOARCH=amd64 go build -o freebsd-amd64/getnovel -ldflags="-s -w" .
cp -r preset freebsd-amd64/
cp -r pdfpresets freebsd-amd64/
env GOOS=openbsd GOARCH=amd64 go build -o openbsd-amd64/getnovel -ldflags="-s -w" .
cp -r preset openbsd-amd64/
cp -r pdfpresets openbsd-amd64/
env GOOS=netbsd GOARCH=amd64 go build -o netbsd-amd64/getnovel -ldflags="-s -w" .
cp -r preset netbsd-amd64/
cp -r pdfpresets netbsd-amd64/
env GOOS=dragonfly GOARCH=amd64 go build -o dragonfly-amd64/getnovel -ldflags="-s -w" .
cp -r preset dragonfly-amd64/
cp -r pdfpresets dragonfly-amd64/
- name: Upload artifact getnovel-darwin-universal
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ build_script:
# scripts that run after build
after_build:
- mkdir -p "$APPVEYOR_BUILD_FOLDER/distrib/getnovel-$PREFIX"
- cp -r "$APPVEYOR_BUILD_FOLDER/preset" "$APPVEYOR_BUILD_FOLDER/distrib/getnovel-$PREFIX/"
- cp -r "$APPVEYOR_BUILD_FOLDER/pdfpresets" "$APPVEYOR_BUILD_FOLDER/distrib/getnovel-$PREFIX/"
- cp "$APPVEYOR_BUILD_FOLDER/getnovel-$PREFIX$SUFFIX" "$APPVEYOR_BUILD_FOLDER/distrib/getnovel-$PREFIX/getnovel$SUFFIX"
- cd $APPVEYOR_BUILD_FOLDER/distrib
- zip -r -9 "getnovel-$PREFIX.zip" "getnovel-$PREFIX"
Expand Down
12 changes: 6 additions & 6 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand All @@ -27,7 +27,7 @@ func readLocalBookSource() {
continue
}

c, err := ioutil.ReadAll(fd)
c, err := io.ReadAll(fd)
if err != nil {
log.Println("reading book source file ", configFile, " failed ", err)
continue
Expand Down Expand Up @@ -72,7 +72,7 @@ func parseConfigurations(content []byte, opts *Options) bool {
}

func readRemotePreset(opts *Options) bool {
u := "https://raw.githubusercontent.com/missdeer/getnovel/master/preset/" + opts.ConfigFile
u := "https://raw.githubusercontent.com/missdeer/getnovel/master/pdfpresets/" + opts.ConfigFile
client := &http.Client{}
req, err := http.NewRequest("GET", u, nil)
if err != nil {
Expand All @@ -91,7 +91,7 @@ func readRemotePreset(opts *Options) bool {
return false
}

c, err := ioutil.ReadAll(resp.Body)
c, err := io.ReadAll(resp.Body)
if err != nil {
log.Println("reading content failed")
return false
Expand All @@ -103,7 +103,7 @@ func readRemotePreset(opts *Options) bool {
func readLocalConfigFile(opts *Options) bool {
configFile := opts.ConfigFile
if b, e := fsutil.FileExists(configFile); e != nil || !b {
configFile = filepath.Join("preset", opts.ConfigFile)
configFile = filepath.Join("pdfpresets", opts.ConfigFile)
if b, e = fsutil.FileExists(configFile); e != nil || !b {
log.Println("cannot find configuration file", opts.ConfigFile, "on local file system")
return false
Expand All @@ -116,7 +116,7 @@ func readLocalConfigFile(opts *Options) bool {
return false
}

contentC, err := ioutil.ReadAll(contentFd)
contentC, err := io.ReadAll(contentFd)
contentFd.Close()
if err != nil {
log.Println("reading config file", configFile, "failed", err)
Expand Down
3 changes: 2 additions & 1 deletion dlutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
"io"
"io/ioutil"
"log"
"math"
Expand Down Expand Up @@ -164,7 +165,7 @@ func (du *DownloadUtil) BufferHandler(cu ContentUtil) (exit bool) {
continue
}

contentC, err := ioutil.ReadAll(contentFd)
contentC, err := io.ReadAll(contentFd)
contentFd.Close()
if err != nil {
log.Println("reading file ", du.Buffer[0].Content, " failed ", err)
Expand Down
9 changes: 4 additions & 5 deletions ebook/bs/bs2.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"net/url"
"strings"
Expand Down Expand Up @@ -73,16 +72,16 @@ func (bs *BookSourceV2) SearchBook(title string) []*Book {
charEncoding = strings.ToLower(charEncoding)
switch charEncoding {
case "gbk":
data, _ := ioutil.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), simplifiedchinese.GBK.NewEncoder()))
data, _ := io.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), simplifiedchinese.GBK.NewEncoder()))
title = string(data)
case "gb2312":
data, _ := ioutil.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), simplifiedchinese.HZGB2312.NewEncoder()))
data, _ := io.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), simplifiedchinese.HZGB2312.NewEncoder()))
title = string(data)
case "gb18030":
data, _ := ioutil.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), simplifiedchinese.GB18030.NewEncoder()))
data, _ := io.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), simplifiedchinese.GB18030.NewEncoder()))
title = string(data)
case "big5", "big-5":
data, _ := ioutil.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), traditionalchinese.Big5.NewEncoder()))
data, _ := io.ReadAll(transform.NewReader(bytes.NewReader([]byte(title)), traditionalchinese.Big5.NewEncoder()))
title = string(data)
}
}
Expand Down
7 changes: 3 additions & 4 deletions ebook/kindlegenmobi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package ebook
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -398,7 +397,7 @@ func (m *kindlegenMobiBook) writeContentHTML() {
log.Println("opening file toc.tmp for reading failed ", err)
return
}
tocC, err := ioutil.ReadAll(tocTmp)
tocC, err := io.ReadAll(tocTmp)
tocTmp.Close()
if err != nil {
log.Println("reading file toc.tmp failed ", err)
Expand All @@ -410,7 +409,7 @@ func (m *kindlegenMobiBook) writeContentHTML() {
log.Println("opening file content.tmp for reading failed ", err)
return
}
contentC, err := ioutil.ReadAll(contentTmp)
contentC, err := io.ReadAll(contentTmp)
contentTmp.Close()
if err != nil {
log.Println("reading file content.tmp failed ", err)
Expand Down Expand Up @@ -453,7 +452,7 @@ func (m *kindlegenMobiBook) writeTocNCX() {
log.Println("opening file nav.tmp for reading failed ", err)
return
}
navC, err := ioutil.ReadAll(navTmp)
navC, err := io.ReadAll(navTmp)
if err != nil {
log.Println("reading file nav.tmp failed ", err)
return
Expand Down
4 changes: 2 additions & 2 deletions ebook/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ebook

import (
"fmt"
"io/ioutil"
"io"
"log"
"os"
"strconv"
Expand Down Expand Up @@ -78,7 +78,7 @@ func (m *pdfBook) SetFontFile(file string) {
return
}

fontContent, err := ioutil.ReadAll(fontFd)
fontContent, err := io.ReadAll(fontFd)
fontFd.Close()
if err != nil {
log.Fatalln("can't read font file", err)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type Options struct {
InsecureSkipVerify bool `long:"insecureSkipVerify" description:"if true, TLS accepts any certificate"`
ListenAndServe string `long:"listenAndServe" description:"set http listen and serve address, example: :8080"`
Format string `short:"f" long:"format" description:"set generated file format, candidate values: mobi, epub, pdf"`
Format string `short:"f" long:"format" description:"set generated file format, candidate values: mobi, epub, pdf, html, txt"`
List bool `short:"l" long:"list" description:"list supported novel websites"`
LeftMargin float64 `long:"leftMargin" description:"set left margin for PDF format"`
TopMargin float64 `long:"topMargin" description:"set top margin for PDF format"`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions preset/pixel2xl → pdfpresets/pixel2xl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"format": "pdf",
"pageType": "pixel2xl",
"titleFontSize": 12,
"contentFontSize": 10,
"pageWidth": 217.4,
"pageHeight": 447.6
{
"format": "pdf",
"pageType": "pixel2xl",
"titleFontSize": 12,
"contentFontSize": 10,
"pageWidth": 217.4,
"pageHeight": 447.6
}

0 comments on commit 7ef9843

Please sign in to comment.