Skip to content

Commit

Permalink
Update plugins setting and set metadata to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
yorukot committed Apr 15, 2024
1 parent 19a3ee8 commit c1f942d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/components/config_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type ThemeType struct {
// Configuration settings
type ConfigType struct {
Theme string `toml:"theme"`
FooterPanelList []string `toml:"footer_panel_list"`
Metadata bool `toml:"metadata"`
}

type HotkeysType struct {
Expand Down
29 changes: 19 additions & 10 deletions src/components/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,18 +449,27 @@ func returnMetaData(m model) model {
return m
}

fileInfos := et.ExtractMetadata(filePath)
for _, fileInfo := range fileInfos {
if fileInfo.Err != nil {
outPutLog("Return meta data function error", fileInfo, fileInfo.Err)
continue
}
if Config.Metadata {
fileInfos := et.ExtractMetadata(filePath)

for _, fileInfo := range fileInfos {
if fileInfo.Err != nil {
outPutLog("Return meta data function error", fileInfo, fileInfo.Err)
continue
}

for k, v := range fileInfo.Fields {
temp := [2]string{k, fmt.Sprintf("%v", v)}
m.fileMetaData.metaData = append(m.fileMetaData.metaData, temp)
for k, v := range fileInfo.Fields {
temp := [2]string{k, fmt.Sprintf("%v", v)}
m.fileMetaData.metaData = append(m.fileMetaData.metaData, temp)
}
}
} else {
fileName := [2]string{"FileName", fileInfo.Name()}
fileSize := [2]string{"FileSize", formatFileSize(fileInfo.Size())}
fileModifyData := [2]string{"FileModifyDate", fileInfo.ModTime().String()}
m.fileMetaData.metaData = append(m.fileMetaData.metaData, fileName, fileSize, fileModifyData)
}

channel <- channelMessage{
messageId: id,
loadMetadata: true,
Expand Down Expand Up @@ -817,4 +826,4 @@ func generateSearchBar() textinput.Model {
ti.Blur()
ti.CharLimit = 156
return ti
}
}
18 changes: 12 additions & 6 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ const (
trashDirectoryInfo string = "/Trash/info"
)

type GitHubRelease struct {
TagName string `json:"tag_name"`
}

func main() {
output := termenv.NewOutput(os.Stdout)
terminalBackgroundColor := output.BackgroundColor()
Expand Down Expand Up @@ -223,11 +219,15 @@ func CheckForUpdates() {
return
}

type GitHubRelease struct {
TagName string `json:"tag_name"`
}

var release GitHubRelease
if err := json.Unmarshal(body, &release); err != nil {
return
}

if versionToNumber(release.TagName) > versionToNumber(currentVersion) {
fmt.Printf("A new version %s is available.\n", release.TagName)
fmt.Printf("Please update.\n\n\n %s\n\n", latestVersionGithub)
Expand Down Expand Up @@ -391,4 +391,10 @@ const configTomlString string = `# change your theme
theme = "gruvbox"
# useless for now
bottom_panel_list = ["processes", "metadata", "clipboard"]`
footer_panel_list = ["processes", "metadata", "clipboard"]
# ==========PLUGINS========== #
# Show more detailed metadata, please install exiftool before enabling this plugin!
metadata = false`
8 changes: 7 additions & 1 deletion src/superfile/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
theme = "gruvbox"

# useless for now
bottom_panel_list = ["processes", "metadata", "clipboard"]
footer_panel_list = ["processes", "metadata", "clipboard"]


# ==========PLUGINS========== #

# Show more detailed metadata, please install exiftool before enabling this plugin!
metadata = false
2 changes: 0 additions & 2 deletions src/superfile/plugins.toml

This file was deleted.

0 comments on commit c1f942d

Please sign in to comment.