rename book package to media
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"git.yetaga.in/alazyreader/library/book"
|
||||
"git.yetaga.in/alazyreader/library/media"
|
||||
"github.com/gdamore/tcell"
|
||||
)
|
||||
|
||||
@@ -20,16 +20,16 @@ func NewEventError(err error) *EventError {
|
||||
// save change to book
|
||||
type EventBookUpdate struct {
|
||||
tcell.EventTime
|
||||
book *book.Book
|
||||
book *media.Book
|
||||
}
|
||||
|
||||
func NewEventBookUpdate(b *book.Book) *EventBookUpdate {
|
||||
func NewEventBookUpdate(b *media.Book) *EventBookUpdate {
|
||||
e := &EventBookUpdate{book: b}
|
||||
e.SetEventNow()
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *EventBookUpdate) Book() *book.Book {
|
||||
func (e *EventBookUpdate) Book() *media.Book {
|
||||
return e.book
|
||||
}
|
||||
|
||||
|
@@ -9,10 +9,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.yetaga.in/alazyreader/library/book"
|
||||
"git.yetaga.in/alazyreader/library/config"
|
||||
"git.yetaga.in/alazyreader/library/database"
|
||||
"git.yetaga.in/alazyreader/library/importer"
|
||||
"git.yetaga.in/alazyreader/library/media"
|
||||
"git.yetaga.in/alazyreader/library/ui"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
@@ -120,7 +120,7 @@ func main() {
|
||||
}()
|
||||
|
||||
// book list and options menu (left column)
|
||||
l := ui.NewList(Titles(state.Get("library").([]book.Book)), 0)
|
||||
l := ui.NewList(Titles(state.Get("library").([]media.Book)), 0)
|
||||
menu := ui.NewBox(
|
||||
"library",
|
||||
[]string{"˄˅ select", "⏎ edit", "(n)ew", "(i)mport", "(q)uit"},
|
||||
@@ -131,7 +131,7 @@ func main() {
|
||||
ui.StyleActive,
|
||||
false,
|
||||
)
|
||||
activeBookDetails := ui.NewBookDetails(&book.Book{})
|
||||
activeBookDetails := ui.NewBookDetails(&media.Book{})
|
||||
|
||||
// book display (right column)
|
||||
activeBook := ui.NewBox(
|
||||
@@ -307,7 +307,7 @@ func main() {
|
||||
default:
|
||||
}
|
||||
// repaint
|
||||
l.SetMembers(Titles(state.Get("library").([]book.Book)))
|
||||
l.SetMembers(Titles(state.Get("library").([]media.Book)))
|
||||
container.Draw(screen)
|
||||
popup.Draw(screen)
|
||||
errorPopup.Draw(screen)
|
||||
@@ -315,7 +315,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func Titles(lb []book.Book) []ui.ListKeyValue {
|
||||
func Titles(lb []media.Book) []ui.ListKeyValue {
|
||||
r := []ui.ListKeyValue{}
|
||||
for i := range lb {
|
||||
r = append(r, ui.ListKeyValue{
|
||||
@@ -326,11 +326,11 @@ func Titles(lb []book.Book) []ui.ListKeyValue {
|
||||
return r
|
||||
}
|
||||
|
||||
func GetBookByID(id int, lb []book.Book) *book.Book {
|
||||
func GetBookByID(id int, lb []media.Book) *media.Book {
|
||||
for i := range lb {
|
||||
if lb[i].ID == id {
|
||||
return &lb[i]
|
||||
}
|
||||
}
|
||||
return &book.Book{}
|
||||
return &media.Book{}
|
||||
}
|
||||
|
@@ -8,10 +8,10 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.yetaga.in/alazyreader/library/book"
|
||||
"git.yetaga.in/alazyreader/library/config"
|
||||
"git.yetaga.in/alazyreader/library/database"
|
||||
"git.yetaga.in/alazyreader/library/frontend"
|
||||
"git.yetaga.in/alazyreader/library/media"
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ func max(a, b int) int {
|
||||
}
|
||||
|
||||
type Library interface {
|
||||
GetAllBooks(context.Context) ([]book.Book, error)
|
||||
GetAllBooks(context.Context) ([]media.Book, error)
|
||||
}
|
||||
|
||||
type Router struct {
|
||||
|
Reference in New Issue
Block a user