Skip to content

Commit

Permalink
fix scanning error
Browse files Browse the repository at this point in the history
  • Loading branch information
5rahim committed Jan 26, 2024
1 parent 3c053ac commit 4a05bc3
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 329 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## 0.1.5

- 🚑️ Fixed scanning error caused by non-existent database entries
- ⬆️ Updated dependencies

## 0.1.4

- ⚡️ Added ability to resolve hidden media
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var development = false
var version = "0.1.4"
var version = "0.1.5"

func main() {

Expand Down
9 changes: 9 additions & 0 deletions internal/core/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/seanime-app/seanime/internal/anilist"
"github.com/seanime-app/seanime/internal/anizip"
_db "github.com/seanime-app/seanime/internal/db"
"github.com/seanime-app/seanime/internal/entities"
"github.com/seanime-app/seanime/internal/events"
"github.com/seanime-app/seanime/internal/models"
"github.com/seanime-app/seanime/internal/mpchc"
Expand Down Expand Up @@ -79,6 +80,14 @@ func NewApp(options *AppOptions) *App {
os.Exit(1)
}

// Add default local file entries if there are none
if _, _, err := db.GetLocalFiles(); err != nil {
_, err := db.InsertLocalFiles(make([]*entities.LocalFile, 0))
if err != nil {
logger.Fatal().Err(err).Msgf("app: Failed to initialize local files in the database")
}
}

// Delete old local file entries
db.CleanUpLocalFiles()

Expand Down
3 changes: 0 additions & 3 deletions internal/db/localfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func (db *Database) GetLocalFiles() ([]*entities.LocalFile, uint, error) {
var res models.LocalFiles
err := db.gormdb.Last(&res).Error
if err != nil {
db.logger.Error().Err(err).Msg("Failed to save local files in the database")
return nil, 0, err
}

Expand Down Expand Up @@ -105,7 +104,6 @@ func (db *Database) upsertLocalFiles(lfs *models.LocalFiles) (*models.LocalFiles
}).Create(lfs).Error

if err != nil {
db.logger.Error().Err(err).Msg("Failed to save local files in the database")
return nil, err
}
return lfs, nil
Expand All @@ -115,7 +113,6 @@ func (db *Database) insertLocalFiles(lfs *models.LocalFiles) (*models.LocalFiles
err := db.gormdb.Create(lfs).Error

if err != nil {
db.logger.Error().Err(err).Msg("Failed to save local files in the database")
return nil, err
}
return lfs, nil
Expand Down
3 changes: 1 addition & 2 deletions seanime-web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
const nextConfig = {
output: "export",
distDir: 'web',
cleanDistDir: true,
images: {
unoptimized: true,
},
}

module.exports = nextConfig
module.exports = nextConfig
Loading

0 comments on commit 4a05bc3

Please sign in to comment.