Compare commits

..

No commits in common. "619d9fcea27f31ea3160933b299410f69dbd5fe2" and "f5ff1fdbce4e179125838e7f0344163f6f1e240a" have entirely different histories.

1 changed files with 4 additions and 62 deletions

View File

@ -47,17 +47,6 @@ func main() {
panic(error) panic(error)
} }
error = ttc_update(filepath.Join(args.Out_dir, "TamrielTradeCentre"))
if error != nil {
panic(error)
}
fmt.Println("Updated,", TCC_PRICE_TABLE_URI)
if args.Ttc {
return
}
addon_paths, error := os.ReadDir(args.Out_dir) addon_paths, error := os.ReadDir(args.Out_dir)
if error != nil { if error != nil {
panic(error) panic(error)
@ -84,7 +73,7 @@ func main() {
for _, eso_live_name := range eso_live_addon_names { for _, eso_live_name := range eso_live_addon_names {
eso_live, error := eso_live_stat_init(eso_live_name) eso_live, error := eso_live_stat_init(eso_live_name)
if error != nil { if error != nil {
continue panic(error)
} }
matching := "" matching := ""
@ -96,8 +85,8 @@ func main() {
} }
if matching == "" { if matching == "" {
fmt.Println("Removed,", eso_live.path) fmt.Println("Removing inactive addon", eso_live.path)
os.RemoveAll(eso_live.path) // TODO os.RemoveAll(eso_live.path)
continue continue
} }
@ -108,7 +97,7 @@ func main() {
fmt.Printf("Live, %s, %s\n", eso_live.name, eso_live.version) fmt.Printf("Live, %s, %s\n", eso_live.name, eso_live.version)
} }
for _, eso_ui := range eso_ui_list { for _, eso_ui := range eso_ui_list {
fmt.Printf("Updated, %s, %s\n", eso_ui.name, eso_ui.version) fmt.Printf("Update, %s, %s\n", eso_ui.name, eso_ui.version)
error = eso_ui_get_unzip(eso_ui.path, args.Out_dir) error = eso_ui_get_unzip(eso_ui.path, args.Out_dir)
if error != nil { if error != nil {
panic(error) panic(error)
@ -296,50 +285,3 @@ func eso_ui_get_unzip(esoui_url string, out_dir string) error {
return nil return nil
} }
func ttc_update(out_path string) error {
response, error := http.Get(TCC_PRICE_TABLE_URI)
if error != nil {
return error
}
defer response.Body.Close()
if response.StatusCode == http.StatusNotFound {
return errors.New(http.StatusText(response.StatusCode))
}
body, error := io.ReadAll(response.Body)
if error != nil {
return error
}
reader := bytes.NewReader(body)
zip_reader, error := zip.NewReader(reader, int64(len(body)))
if error != nil {
return error
}
for _, zipped_file := range zip_reader.File {
if zipped_file.Mode().IsDir() {
continue
}
zipped_file_open, error := zipped_file.Open()
if error != nil {
return error
}
name := filepath.Join(out_path, zipped_file.Name)
os.MkdirAll(filepath.Dir(name), os.ModePerm)
create, error := os.Create(name)
if error != nil {
return error
}
defer create.Close()
create.ReadFrom(zipped_file_open)
}
return nil
}