-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github repo url fixed. Few UI improvements.
- Loading branch information
1 parent
a706a87
commit 4464790
Showing
22 changed files
with
152 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package audiobookshelf | ||
|
||
import "path/filepath" | ||
|
||
// Calculate Audiobookshelf directory structure (see: https://www.audiobookshelf.org/docs#book-directory-structure) | ||
func GetDestignationPath(outputDir string, series string, author string) string { | ||
destPath := filepath.Join(outputDir, author) | ||
if series != "" { | ||
destPath = filepath.Join(destPath, author+" - "+series) | ||
} | ||
return destPath | ||
} | ||
|
||
func GetDestignationDir(series string, seriesNo string, title string, narrator string) string { | ||
abTitle := "" | ||
if series != "" && seriesNo != "" { | ||
abTitle = seriesNo + ". " | ||
} | ||
abTitle += title | ||
if narrator != "" { | ||
abTitle += " {" + narrator + "}" | ||
} | ||
return abTitle | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ func Load() { | |
"History", | ||
"Podcast", | ||
"Nonfiction", | ||
"Education", | ||
"News", | ||
"Speech", | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,44 @@ | ||
package github | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
) | ||
|
||
type GithubClient struct { | ||
token string | ||
repoOwner string | ||
repoName string | ||
} | ||
|
||
func NewClient(repoOwner string, repoName string) (*GithubClient) { | ||
c := &GithubClient{repoOwner: repoOwner, repoName: repoName} | ||
return c | ||
} | ||
|
||
func NewClient(token string) (*GithubClient, error) { | ||
c := &GithubClient{token: token} | ||
return c, nil | ||
type Release struct { | ||
TagName string `json:"tag_name"` | ||
} | ||
|
||
func (c *GithubClient) GetLatestVer(owner string, repo string) (string, error) { | ||
ver := "" | ||
func (c *GithubClient) GetLatestVersion() (string, error) { | ||
url := fmt.Sprintf("https://api.github.com/repos/%s/%s/releases/latest", c.repoOwner, c.repoName) | ||
|
||
// curl -L \ | ||
// -H "Accept: application/vnd.github+json" \ | ||
// -H "Authorization: Bearer <TOKEN>" \ | ||
// -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
// https://api.github.com/repos/vpoluyaktov/abb_ia/releases/latest | ||
resp, err := http.Get(url) | ||
if err != nil { | ||
return "", err | ||
} | ||
defer resp.Body.Close() | ||
|
||
return ver, nil | ||
if resp.StatusCode != http.StatusOK { | ||
return "", fmt.Errorf("failed to fetch latest release: %s", resp.Status) | ||
} | ||
|
||
var release Release | ||
err = json.NewDecoder(resp.Body).Decode(&release) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return release.TagName, nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.