Skip to content

Commit

Permalink
Scanner: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthi-chaud committed Mar 28, 2024
1 parent c1859b8 commit a551f6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup Go
uses: ./.github/actions/cache-scanner
- name: Install Dependencies and Build
run: go build
run: go build -o scanner ./app
Format:
if: ${{ needs.changes.outputs.scanner == 'true' && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions scanner/pkg/parser/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"time"

"github.com/Arthi-chaud/Blee/scanner/pkg/models"
"github.com/Arthi-chaud/Blee/scanner/pkg/config"
"github.com/Arthi-chaud/Blee/scanner/pkg/models"
)

// Metadata Extracted from the path of a file
Expand Down Expand Up @@ -102,7 +102,7 @@ func parseMovieMetadataFromMatches(matches []string, regex *regexp.Regexp) *Movi
}

func parseYearFromRegex(matches []string, regex *regexp.Regexp, p *PackageMetadataFromPath) {
for _, group_name := range []string {"PackageYear", "Year"} {
for _, group_name := range []string{"PackageYear", "Year"} {
if group_index := regex.SubexpIndex(group_name); group_index != -1 {
if parsed_year, err := strconv.Atoi(matches[group_index]); err == nil {
p.release_year = time.Date(parsed_year, 1, 1, 1, 1, 1, 1, time.UTC)
Expand Down
8 changes: 4 additions & 4 deletions scanner/pkg/parser/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestExtraParsingWithPackageFolderWithoutArtistFolder(t *testing.T) {
assert.Equal(t, res.extra.disc_index, 0)
assert.Equal(t, res.extra.track_index, 0)
assert.Equal(t, res.extra.name, "Autour D'Olivia (Documentaire)")
assert.Equal(t, res.extra.types, []models.ExtraType {models.ExtraType(models.Documentary)})
assert.Equal(t, res.extra.types, []models.ExtraType{models.ExtraType(models.Documentary)})
assert.Equal(t, res.extra.package_.artist_name, "Olivia Ruiz")
assert.Equal(t, res.extra.package_.name, "Miss Météores Live")
assert.Equal(t, res.extra.package_.release_year.Year(), 2008)
Expand All @@ -97,7 +97,7 @@ func TestExtraParsingWithPackageFolderWithArtistFolder(t *testing.T) {
assert.Equal(t, res.extra.disc_index, 0)
assert.Equal(t, res.extra.track_index, 0)
assert.Equal(t, res.extra.name, "Interview")
assert.Equal(t, res.extra.types, []models.ExtraType {models.Interview})
assert.Equal(t, res.extra.types, []models.ExtraType{models.Interview})
assert.Equal(t, res.extra.package_.artist_name, "Olivia Ruiz")
assert.Equal(t, res.extra.package_.name, "Chocolat Show")
assert.Equal(t, res.extra.package_.release_year, time.Time{})
Expand All @@ -114,7 +114,7 @@ func TestExtraParsingWithPackageFolderWithArtistFolderWithExtraFolder(t *testing
assert.Equal(t, res.extra.disc_index, 0)
assert.Equal(t, res.extra.track_index, 0)
assert.Equal(t, res.extra.name, "Interview")
assert.Equal(t, res.extra.types, []models.ExtraType {models.Interview})
assert.Equal(t, res.extra.types, []models.ExtraType{models.Interview})
assert.Equal(t, res.extra.package_.artist_name, "Olivia Ruiz")
assert.Equal(t, res.extra.package_.name, "Chocolat Show")
assert.Equal(t, res.extra.package_.release_year, time.Time{})
Expand All @@ -131,7 +131,7 @@ func TestExtraParsingWithPackageFolderWithoutArtistFolderWithIndexesWithoutTypes
assert.Equal(t, res.extra.disc_index, 1)
assert.Equal(t, res.extra.track_index, 2)
assert.Equal(t, res.extra.name, "Extra1")
assert.Equal(t, res.extra.types, []models.ExtraType {models.Other})
assert.Equal(t, res.extra.types, []models.ExtraType{models.Other})
assert.Equal(t, res.extra.package_.artist_name, "Artist")
assert.Equal(t, res.extra.package_.name, "Package")
assert.Equal(t, res.extra.package_.release_year.Year(), 2000)
Expand Down

0 comments on commit a551f6c

Please sign in to comment.