Skip to content
This repository has been archived by the owner on May 8, 2022. It is now read-only.

Commit

Permalink
Clear malformed XEPG database in conditionalUpdateChanges() function.…
Browse files Browse the repository at this point in the history
… Increae program and database versions. Closes #6
  • Loading branch information
SCP002 committed Apr 6, 2022
1 parent ac269c1 commit 755bd52
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ func getErrMsg(errCode int) (errMsg string) {
errMsg = fmt.Sprintf("FFmpeg binary was not found. Check the FFmpeg binary path in the xTeVe settings.")
case 2021:
errMsg = fmt.Sprintf("VLC binary was not found. Check the VLC path binary in the xTeVe settings.")
case 2022:
errMsg = fmt.Sprintf("Loaded database has broken XEPG mapping (version <= 2.1.1). Clearing it.")

case 2099:
errMsg = fmt.Sprintf("Updates have been disabled by the developer")
Expand Down
28 changes: 27 additions & 1 deletion src/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,33 @@ checkVersion:
return
}

case "2.1.0":
case "2.1.0", "2.1.1":

// Database verison <= 2.1.1 has broken XEPG mapping
showWarning(2022)

// Clear XEPG mapping
Data.XEPG.Channels = make(map[string]interface{})
Data.XEPG.XEPGCount = 0
Data.Cache.Streams = struct{ Active []string }{}

err = saveMapToJSONFile(System.File.XEPG, Data.XEPG.Channels)
if err != nil {
ShowError(err, 000)
return err
}

// Update database version
settingsMap["version"] = "2.2.0"

err = saveMapToJSONFile(System.File.Settings, settingsMap)
if err != nil {
return
}

goto checkVersion

case "2.2.0":
// If there are changes to the Database in a later update, continue here

break
Expand Down
4 changes: 2 additions & 2 deletions xteve.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ var GitHub = GitHubStruct{Branch: "master", User: "SCP002", Repo: "xTeVe", Updat
const Name = "xTeVe"

// Version : Version, the Build Number is parsed in the main func
const Version = "2.2.3.0000"
const Version = "2.2.4.0000"

// DBVersion : Database Version
const DBVersion = "2.1.1"
const DBVersion = "2.2.0"

// APIVersion : API Version
const APIVersion = "1.1.0"
Expand Down

0 comments on commit 755bd52

Please sign in to comment.