Browse Source

Add files via upload

main
Unbewohnte 4 years ago committed by GitHub
parent
commit
6482aef066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      backgroundchanger.go

6
backgroundchanger.go

@ -113,7 +113,6 @@ func isBeatmap(filename string) bool {
return false return false
} }
// checks given filename for most common image extentions
func isImage(filename string) bool { func isImage(filename string) bool {
var imageExtentions []string = []string{"jpeg", "jpg", "png", "JPEG", "JPG", "PNG"} var imageExtentions []string = []string{"jpeg", "jpg", "png", "JPEG", "JPG", "PNG"}
for _, extention := range imageExtentions { for _, extention := range imageExtentions {
@ -144,7 +143,8 @@ func getBackgroundName(pathToOSUbeatmap string) (string, error) {
for _, chunk := range contentBetween { for _, chunk := range contentBetween {
if isImage(chunk) { if isImage(chunk) {
return chunk[1 : len(chunk)-1], nil log.Println(strings.Split(chunk, "\"")[1])
return strings.Split(chunk, "\"")[1], nil
} }
} }
return "", nil return "", nil
@ -205,7 +205,6 @@ func replaceBackgrounds(beatmapFolder, replacementPicPath string) (successful, f
if err != nil { if err != nil {
failed++ failed++
log.Println("ERROR: Error removing old background : ", err, " file: ", backgroundPath) log.Println("ERROR: Error removing old background : ", err, " file: ", backgroundPath)
continue
} }
// create new background file // create new background file
@ -221,7 +220,6 @@ func replaceBackgrounds(beatmapFolder, replacementPicPath string) (successful, f
err = copyFile(replacementPicPath, backgroundPath) err = copyFile(replacementPicPath, backgroundPath)
if err != nil { if err != nil {
failed++ failed++
continue
} }
successful++ successful++
} }

Loading…
Cancel
Save