Skip to content

Commit

Permalink
Small fixes: compensate for Synology task scheduler problem and corre…
Browse files Browse the repository at this point in the history
…ct libmerge return code
  • Loading branch information
rupor-github committed Nov 26, 2016
1 parent 798b6fc commit ca8c1bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions libget2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ func main() {
}
newArchives := len(links)
if newArchives > 0 {

// We may want to "merge" updates
code = 2

fmt.Printf("\nProcessed %d new archive(s)\n", newArchives)
} else {
fmt.Printf("\nProcessed no new archive(s)\n")
Expand Down
5 changes: 3 additions & 2 deletions libmerge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ func main() {
}
newName := fmt.Sprintf("fb2-%06d-%06d.zip", firstBook, lastBook)
fmt.Printf("\t--> Finalizing archive: %s\n", newName)
code = 2

newName = filepath.Join(last.dir, newName)
if err := os.Rename(tmpOut, newName); err != nil {
Expand All @@ -332,6 +331,9 @@ func main() {
last.end = lastBook
fmt.Printf("\t--> New last archive: %s\n", newName)

// We may want to rebuild inpx - have new "last" archive ready
code = 2

f, err = ioutil.TempFile(last.dir, "merge-")
if err != nil {
log.Fatalf("Unable to create temp file: %v", err)
Expand Down Expand Up @@ -368,7 +370,6 @@ func main() {

newName := fmt.Sprintf("fb2-%06d-%06d.merging", firstBook, lastBook)
fmt.Printf("\t--> Finalizing archive: %s\n", newName)
code = 2

newName = filepath.Join(last.dir, newName)
if err := os.Rename(tmpOut, newName); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion misc/libget2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[
{
"name": "is_flibusta",
"nameLib": "flibusta",
"pattern": "(?i)<a\\s+href=\"(f(?:\\.fb2)*\\.[0-9]+-[0-9]+\\.zip)\">",
"patternSQL": "(?i)<a\\s+href=\"(lib\\.lib\\w+\\.sql\\.gz)\">",
"url": "http:\/\/flibusta.is\/daily\/",
Expand All @@ -15,7 +16,7 @@
"patternSQL": "(?i)<a\\s+href=\"(lib\\.lib\\w+\\.sql\\.gz)\">",
"url": "http:\/\/flibusta.is\/daily\/",
"urlSQL": "http:\/\/flibusta.is\/sql\/",
"proxy": "socks5://192.168.50.10:9050"
"proxy": "socks5://192.168.50.10:9050"
},
{
"name": "librusec",
Expand Down
10 changes: 10 additions & 0 deletions scripts/fb2_flibusta.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash

# Synology task scheduler has a problem running scripts under non-root user

if [ "$2" != "" ]; then
user_dir=`eval echo "~$2"`
if [ "${user_dir}" != "" ]; then
cd ${user_dir}
fi
fi

# -----------------------------------------------------------------------------
# Following variables could be changed
# -----------------------------------------------------------------------------
Expand Down

0 comments on commit ca8c1bb

Please sign in to comment.