Remove bbolt database dependency
Replaced bbolt-based database handling with Fyne built-in preferences for storing application settings. Deleted migration logic, database initialization, and error handling related to bbolt, simplifying the codebase and reducing external dependencies.
This commit is contained in:
@@ -5,12 +5,12 @@ import (
|
||||
)
|
||||
|
||||
type RepositoryContract interface {
|
||||
GetPathFfmpeg() (string, error)
|
||||
SavePathFfmpeg(code string) (setting.Setting, error)
|
||||
GetPathFfprobe() (string, error)
|
||||
SavePathFfprobe(code string) (setting.Setting, error)
|
||||
GetPathFfplay() (string, error)
|
||||
SavePathFfplay(code string) (setting.Setting, error)
|
||||
GetPathFfmpeg() string
|
||||
SavePathFfmpeg(code string) setting.Setting
|
||||
GetPathFfprobe() string
|
||||
SavePathFfprobe(code string) setting.Setting
|
||||
GetPathFfplay() string
|
||||
SavePathFfplay(code string) setting.Setting
|
||||
}
|
||||
|
||||
type Repository struct {
|
||||
@@ -21,26 +21,26 @@ func NewRepository(settingRepository setting.RepositoryContract) *Repository {
|
||||
return &Repository{settingRepository: settingRepository}
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfmpeg() (string, error) {
|
||||
func (r Repository) GetPathFfmpeg() string {
|
||||
return r.settingRepository.GetValue("ffmpeg")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfmpeg(path string) (setting.Setting, error) {
|
||||
func (r Repository) SavePathFfmpeg(path string) setting.Setting {
|
||||
return r.settingRepository.CreateOrUpdate("ffmpeg", path)
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfprobe() (string, error) {
|
||||
func (r Repository) GetPathFfprobe() string {
|
||||
return r.settingRepository.GetValue("ffprobe")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfprobe(path string) (setting.Setting, error) {
|
||||
func (r Repository) SavePathFfprobe(path string) setting.Setting {
|
||||
return r.settingRepository.CreateOrUpdate("ffprobe", path)
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfplay() (string, error) {
|
||||
func (r Repository) GetPathFfplay() string {
|
||||
return r.settingRepository.GetValue("ffplay")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfplay(path string) (setting.Setting, error) {
|
||||
func (r Repository) SavePathFfplay(path string) setting.Setting {
|
||||
return r.settingRepository.CreateOrUpdate("ffplay", path)
|
||||
}
|
||||
|
@@ -353,7 +353,7 @@ func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving set
|
||||
locationURI, err = storage.ListerForURI(r)
|
||||
|
||||
if err == nil {
|
||||
_, _ = settingDirectoryForSaving.SaveDirectoryForSaving(locationURI.Path())
|
||||
_ = settingDirectoryForSaving.SaveDirectoryForSaving(locationURI.Path())
|
||||
}
|
||||
|
||||
}, locationURI)
|
||||
@@ -363,10 +363,7 @@ func newDirectoryForSaving(app kernel.AppContract, settingDirectoryForSaving set
|
||||
}
|
||||
|
||||
func getDirectoryForSaving(settingDirectoryForSaving setting.DirectoryForSavingContract) (fyne.ListableURI, error) {
|
||||
path, err := settingDirectoryForSaving.GetDirectoryForSaving()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
path := settingDirectoryForSaving.GetDirectoryForSaving()
|
||||
|
||||
if len(path) > 0 {
|
||||
path = "file://" + path
|
||||
|
Reference in New Issue
Block a user