Skip to content

Commit

Permalink
Merge pull request #52 from marcelGoerentz/Fix_Buffer_In_RAM
Browse files Browse the repository at this point in the history
Fix safe in RAM bug
  • Loading branch information
marcelGoerentz authored Dec 31, 2024
2 parents e4bb6e4 + b1a5545 commit 192980a
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Update repo variable
run: |
bash ${GITHUB_WORKSPACE}/Utility/update_build_number_variable.sh ${{ secrets.API_TOKEN }} ${{ github.repository }} ${{ env.NEW_VERSION }}
bash ${GITHUB_WORKSPACE}/Utility/update_build_number_variable.sh ${{ secrets.API_TOKEN }} ${{ github.repository }} ${{ env.NEW_BUILD }}
- name: Set up and Build
uses: actions/setup-go@v5
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
with:
token: "${{ secrets.GITHUB_TOKEN }}"
files: dist/*
name: v${{ env.NEW_VERSION }}
tag_name: v${{ env.NEW_VERSION }}
make_latest: true

buildDockerImages:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Threadfin
## Discord
https://discord.gg/hrqg9tgcMZ
https://discord.gg/gwkpMxepPA

## M3U Proxy for Plex DVR and Emby/Jellyfin Live TV. Based on xTeVe.

Expand Down Expand Up @@ -149,7 +149,7 @@ When the branch is changed, an update is only performed if there is a new versio
## Build from source code [Go / Golang]

#### Requirements
* [Go](https://golang.org) (go1.18 or newer)
* [Go](https://golang.org) (go1.23 or newer)

#### Dependencies
* [go-ssdp](https://github.com/koron/go-ssdp)
Expand Down
3 changes: 1 addition & 2 deletions src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ func Init() (err error) {

// Ordnerpfade festlegen
var tempFolder = os.TempDir() + string(os.PathSeparator) + System.AppName + string(os.PathSeparator)
tempFolder = getPlatformPath(strings.Replace(tempFolder, "//", "/", -1))

if len(System.Folder.Config) == 0 {
System.Folder.Config = GetUserHomeDirectory() + string(os.PathSeparator) + "." + System.AppName + string(os.PathSeparator)
} else {
System.Folder.Config = strings.TrimRight(System.Folder.Config, string(os.PathSeparator)) + string(os.PathSeparator)
}

System.Folder.Config = getPlatformPath(System.Folder.Config)
System.Folder.Config = getPlatformPath(System.Folder.Config) + string(os.PathSeparator)

System.Folder.Backup = System.Folder.Config + "backup" + string(os.PathSeparator)
System.Folder.Data = System.Folder.Config + "data" + string(os.PathSeparator)
Expand Down
8 changes: 5 additions & 3 deletions src/internal/up2date/client/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ func DoUpdate(fileType, filenameBIN string) (err error) {

// Restart binary (Linux and UNIX)
file, _ := os.Executable()
os.RemoveAll(oldBinary)
err = os.RemoveAll(oldBinary)
if err != nil {
fmt.Println(err)
}
err = syscall.Exec(file, os.Args, os.Environ())
if err != nil {
restorOldBinary(oldBinary, newBinary)
Expand Down Expand Up @@ -199,8 +202,7 @@ func getFilenameFromPath(path string) string {

func getPlatformPath(path string) string {

var newPath = filepath.Dir(path) + string(os.PathSeparator)

var newPath = filepath.Dir(path)
return newPath
}

Expand Down
2 changes: 1 addition & 1 deletion src/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func maintenance() {

// Update Threadfin (Binary)
if System.TimeForAutoUpdate == t.Format("1504") {
BinaryUpdate()
BinaryUpdate(false)
}

}
Expand Down
1 change: 1 addition & 0 deletions src/struct-system.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ type SettingsStruct struct {
BufferSize int `json:"buffer.size.kb"`
BufferTimeout float64 `json:"buffer.timeout"`
CacheImages bool `json:"cache.images"`
ChangeVersion bool `json:"changeVersion"`
EpgSource string `json:"epgSource"`
FFmpegOptions string `json:"ffmpeg.options"`
FFmpegPath string `json:"ffmpeg.path"`
Expand Down
5 changes: 2 additions & 3 deletions src/toolchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ func checkVFSFolder(path string, vfs avfs.VFS) (err error) {
vm.VolumeAdd(path)
}

err = vfs.MkdirAll(getPlatformPath(path), 0755)
err = vfs.MkdirAll(getPlatformPath(path + string(os.PathSeparator)), 0755)
if err == nil {

debug = fmt.Sprintf("Create virtual filesystem Folder:%s", path)
ShowDebug(debug, 1)

Expand Down Expand Up @@ -165,7 +164,7 @@ func checkFilePermission(dir string) (err error) {

// Ordnerpfad für das laufende OS generieren
func getPlatformPath(path string) string {
return filepath.Dir(path) + string(os.PathSeparator)
return filepath.Dir(path)
}

// Dateipfad für das laufende OS generieren
Expand Down
18 changes: 4 additions & 14 deletions src/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

// BinaryUpdate : Binary Update Prozess. Git Branch master und beta wird von GitHub geladen.
func BinaryUpdate() (err error) {
func BinaryUpdate(changeVersion bool) (err error) {

if !System.GitHub.Update {
ShowWarning(2099)
Expand Down Expand Up @@ -104,20 +104,10 @@ func BinaryUpdate() (err error) {

var path_to_file string
do_upgrade := false
if updater.Branch == "beta" {
if System.Beta {
existsNewerVersion(updater.Response)
} else {
do_upgrade = true
}
if !changeVersion {
do_upgrade = existsNewerVersion(updater.Response)
} else {
if System.Beta {
do_upgrade = true
} else {
if existsNewerVersion(updater.Response) {
do_upgrade = true
}
}
do_upgrade = true
}

// Versionsnummer überprüfen
Expand Down
64 changes: 32 additions & 32 deletions src/webUI.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ func WS(w http.ResponseWriter, r *http.Request) {
os.Exit(0)
}

if Settings.ChangeVersion {
System.Beta = !System.Beta // Toggle Beta
BinaryUpdate(true)
}

}

case "saveFilesM3U":
Expand Down
2 changes: 1 addition & 1 deletion threadfin.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func main() {
}

// Update binary
err = src.BinaryUpdate()
err = src.BinaryUpdate(false)
if err != nil {
src.ShowError(err, 0)
}
Expand Down

0 comments on commit 192980a

Please sign in to comment.