Code clean-up
This commit is contained in:
parent
d50e36b213
commit
e4998d1046
|
@ -7,7 +7,6 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -49,37 +48,6 @@ func (i *Indexer) GetImageTags(jpeg *MediaFile) (results []*Tag) {
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
func getKeywordWithSynonyms(keyword string) []string {
|
|
||||||
var result []string
|
|
||||||
|
|
||||||
// TODO: Just a proof-of-concept for now, needs implementation via config file or dictionary
|
|
||||||
switch keyword {
|
|
||||||
case "tabby":
|
|
||||||
result = []string{keyword, "cat"}
|
|
||||||
case "lynx":
|
|
||||||
result = []string{keyword, "cat"}
|
|
||||||
case "tiger":
|
|
||||||
result = []string{keyword, "cat"}
|
|
||||||
default:
|
|
||||||
result = []string{keyword}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func getKeywordsAsString(keywords []string) string {
|
|
||||||
var result []string
|
|
||||||
|
|
||||||
for _, keyword := range keywords {
|
|
||||||
result = append(result, getKeywordWithSynonyms(keyword)...)
|
|
||||||
}
|
|
||||||
|
|
||||||
result = uniqueStrings(result)
|
|
||||||
sort.Strings(result)
|
|
||||||
|
|
||||||
return strings.ToLower(strings.Join(result, ", "))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *Indexer) appendTag(tags []*Tag, label string) []*Tag {
|
func (i *Indexer) appendTag(tags []*Tag, label string) []*Tag {
|
||||||
if label == "" {
|
if label == "" {
|
||||||
return tags
|
return tags
|
||||||
|
|
Loading…
Reference in a new issue