Skip to content

Commit

Permalink
Imports refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
vpoluyaktov committed Nov 22, 2023
1 parent 3e0dd0a commit 2b6db68
Show file tree
Hide file tree
Showing 43 changed files with 132 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ builds:
- id: default
main: ./main.go
binary: abb_ia
ldflags: -X github.com/vpoluyaktov/abb_ia/internal/config.appVersion={{.Version}} -X github.com/vpoluyaktov/abb_ia/internal/config.buildDate={{.Date}}
ldflags: -X abb_ia/internal/config.appVersion={{.Version}} -X abb_ia/internal/config.buildDate={{.Date}}
env: [CGO_ENABLED=0]
goos:
- linux
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Internet Archive site offers a vast collection of free "old-time radio" show
To make this process easier, I developed Audiobook Builder. With this app, all you need is the name of a show or book, or a direct link on archive.org. It will download the .mp3 files for the book, re-encode them with the same bit rate, generate a list of chapters (which can be edited during the process), and ultimately create an audiobook in .m4b format.
<br>

![abb_ia](https://github.com/vpoluyaktov/abb_ia/assets/1992836/511505d9-85b2-4562-9a5b-a71c4c25d564)
![abb_ia](https://abb_ia/assets/1992836/511505d9-85b2-4562-9a5b-a71c4c25d564)

<br><br>

Expand Down
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package cmd

import (
"github.com/vpoluyaktov/abb_ia/internal/controller"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/ui"
"abb_ia/internal/controller"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
"abb_ia/internal/ui"
)

func Execute() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/vpoluyaktov/abb_ia
module abb_ia

go 1.18

Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/bogem/id3v2/v2 v2.1.4 h1:CEwe+lS2p6dd9UZRlPc1zbFNIha2mb2qzT1cCEoNWoI=
github.com/bogem/id3v2/v2 v2.1.4/go.mod h1:l+gR8MZ6rc9ryPTPkX77smS5Me/36gxkMgDayZ9G1vY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -66,7 +64,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
Expand Down
4 changes: 2 additions & 2 deletions internal/audiobookshelf/audiobookshelf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package audiobookshelf_test
import (
"testing"

"abb_ia/internal/audiobookshelf"
"abb_ia/internal/config"
"github.com/stretchr/testify/assert"
"github.com/vpoluyaktov/abb_ia/internal/audiobookshelf"
"github.com/vpoluyaktov/abb_ia/internal/config"
)

func TestLogin(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions internal/audiobookshelf/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"path/filepath"
"strconv"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"abb_ia/internal/dto"
)

type AudiobookshelfClient struct {
Expand Down Expand Up @@ -114,7 +114,6 @@ func (c *AudiobookshelfClient) GetFolders(libraries []Library, libraryName strin
return nil, fmt.Errorf("no library with name '%s' found", libraryName)
}


// Call the Audiobookshelf API for a library Scan
func (c *AudiobookshelfClient) ScanLibrary(libraryID string) error {
url := c.url + "/api/libraries/" + libraryID + "/scan"
Expand All @@ -141,7 +140,7 @@ func (c *AudiobookshelfClient) ScanLibrary(libraryID string) error {
}

// Upload audiobook to The Audibookshelf server
func (c *AudiobookshelfClient) UploadBook(ab *dto.Audiobook, libraryID string, folderID string, callback Fn ) error {
func (c *AudiobookshelfClient) UploadBook(ab *dto.Audiobook, libraryID string, folderID string, callback Fn) error {
// Open each file for upload
var filesList []*os.File
for _, part := range ab.Parts {
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"io/ioutil"
"time"

"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/logger"
"abb_ia/internal/utils"
"gopkg.in/yaml.v3"
)

Expand Down
10 changes: 5 additions & 5 deletions internal/controller/audiobookShelfController.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
"time"

"github.com/vpoluyaktov/abb_ia/internal/audiobookshelf"
"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/audiobookshelf"
"abb_ia/internal/dto"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
"abb_ia/internal/utils"
)

type AudiobookshelfController struct {
Expand Down
10 changes: 5 additions & 5 deletions internal/controller/bootController.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package controller
import (
"time"

"github.com/vpoluyaktov/abb_ia/internal/config"
"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/config"
"abb_ia/internal/dto"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
"abb_ia/internal/utils"
)

type BootController struct {
Expand Down
12 changes: 6 additions & 6 deletions internal/controller/buildController.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"strings"
"time"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/ffmpeg"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/dto"
"abb_ia/internal/ffmpeg"
"abb_ia/internal/utils"

"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
)

type BuildController struct {
Expand Down Expand Up @@ -151,7 +151,7 @@ func (c *BuildController) createMetadata(ab *dto.Audiobook) {
f.WriteString("genre=" + ab.Genre + "\n")
f.WriteString("description=" + strings.ReplaceAll(ab.Description, "\n", "\\\n") + "\n")
f.WriteString("copyright=" + ab.LicenseUrl + "\n")
f.WriteString("comment=This audiobook was created using the 'Audiobook Builder' tool: https://github.com/vpoluyaktov/abb_ia\\\n" +
f.WriteString("comment=This audiobook was created using the 'Audiobook Builder' tool: https://abb_ia\\\n" +
"The audio files used for this book were obtained from the Internet Archive site: " + ab.IaURL + "\n")

for _, chapter := range part.Chapters {
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/chaptersController.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"regexp"
"strings"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/ffmpeg"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"abb_ia/internal/dto"
"abb_ia/internal/ffmpeg"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
)

type ChaptersController struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/cleanupController.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package controller
import (
"os"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"abb_ia/internal/dto"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
)

type CleanupController struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/conductor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controller
import (
"time"

"github.com/vpoluyaktov/abb_ia/internal/mq"
"abb_ia/internal/mq"
)

type controller interface {
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/configController.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package controller

import (
"github.com/vpoluyaktov/abb_ia/internal/config"
"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"abb_ia/internal/config"
"abb_ia/internal/dto"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
)

type ConfigController struct {
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/copyController.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"path/filepath"
"time"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/dto"
"abb_ia/internal/utils"

"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
)

/**
Expand Down
10 changes: 5 additions & 5 deletions internal/controller/downloadController.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"path/filepath"
"time"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/ia_client"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/dto"
"abb_ia/internal/ia_client"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
"abb_ia/internal/utils"
)

type DownloadController struct {
Expand Down
12 changes: 6 additions & 6 deletions internal/controller/encodingController.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"strconv"
"time"

"github.com/vpoluyaktov/abb_ia/internal/config"
"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/ffmpeg"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/utils"
"abb_ia/internal/config"
"abb_ia/internal/dto"
"abb_ia/internal/ffmpeg"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
"abb_ia/internal/utils"
)

type EncodingController struct {
Expand Down
12 changes: 6 additions & 6 deletions internal/controller/searchController.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"strconv"
"strings"

"abb_ia/internal/config"
"abb_ia/internal/dto"
"abb_ia/internal/ia_client"
"abb_ia/internal/logger"
"abb_ia/internal/mq"
"abb_ia/internal/utils"
"github.com/rivo/tview"
"github.com/vpoluyaktov/abb_ia/internal/config"
"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/ia_client"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/utils"
)

type SearchController struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/dto/audiobook.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/vpoluyaktov/abb_ia/internal/config"
"abb_ia/internal/config"
)

type Audiobook struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/dto/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dto
import (
"fmt"

"github.com/vpoluyaktov/abb_ia/internal/config"
"abb_ia/internal/config"
)

type DisplayConfigCommand struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/ffmpeg/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ffmpeg
import (
"os/exec"

"github.com/vpoluyaktov/abb_ia/internal/logger"
"abb_ia/internal/logger"
)

type FFmpeg struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/ia_client/ia_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"strings"
"time"

"abb_ia/internal/logger"
"abb_ia/internal/utils"
"github.com/go-resty/resty/v2"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"github.com/vpoluyaktov/abb_ia/internal/utils"
)

const (
Expand Down Expand Up @@ -112,7 +112,7 @@ func (client *IAClient) GetItemDetails(itemId string) *ItemDetails {
logger.Error("IAClient GetItemDetails() mock load error: " + err.Error())
}
} else {
var getURL = fmt.Sprintf(IA_BASE_URL + "/details/%s/?output=json", itemId)
var getURL = fmt.Sprintf(IA_BASE_URL+"/details/%s/?output=json", itemId)
_, err := client.restyClient.R().SetResult(result).Get(getURL)
if err != nil {
logger.Error("IAClient GetItemDetails() error: " + err.Error())
Expand Down
8 changes: 4 additions & 4 deletions internal/ia_client/is_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"path/filepath"
"testing"

"abb_ia/internal/config"
"abb_ia/internal/ia_client"
"abb_ia/internal/logger"
"github.com/stretchr/testify/assert"
"github.com/vpoluyaktov/abb_ia/internal/config"
"github.com/vpoluyaktov/abb_ia/internal/ia_client"
"github.com/vpoluyaktov/abb_ia/internal/logger"
)

const (
Expand Down Expand Up @@ -51,7 +51,7 @@ func TestGetItemById(t *testing.T) {
fmt.Printf("Image: %s\n", item.Misc.Image)

// for file, meta := range item.Files {
// fmt.Printf("%s -> %s\n", file, meta.Format)
// fmt.Printf("%s -> %s\n", file, meta.Format)
// }
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/mq/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"sync"
"time"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"abb_ia/internal/dto"
"abb_ia/internal/logger"
)

/**
Expand Down
4 changes: 2 additions & 2 deletions internal/mq/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package mq
import (
"fmt"

"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/logger"
"abb_ia/internal/dto"
"abb_ia/internal/logger"
)

type Message struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/ui/buildPage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"strconv"
"strings"

"abb_ia/internal/dto"
"abb_ia/internal/mq"
"abb_ia/internal/utils"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/vpoluyaktov/abb_ia/internal/dto"
"github.com/vpoluyaktov/abb_ia/internal/mq"
"github.com/vpoluyaktov/abb_ia/internal/utils"
)

type BuildPage struct {
Expand Down
Loading

0 comments on commit 2b6db68

Please sign in to comment.