From c266012db3ae0f9cdcb22d16428021ab30740587 Mon Sep 17 00:00:00 2001 From: marmei <43099631+mar-mei@users.noreply.github.com> Date: Mon, 13 Jan 2020 23:17:55 +0100 Subject: [PATCH 1/7] Update changelog-beta.md 2020-01-13 --- changelog-beta.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog-beta.md b/changelog-beta.md index 4e68516..c977c5d 100644 --- a/changelog-beta.md +++ b/changelog-beta.md @@ -1,3 +1,9 @@ +#### 2.1.1.0115-beta +```diff ++ GZIP compression for xteve.xml file. (http://xteve.ip:34400/xmltv/xteve.xml.gz) +- Removed protocol setting for reverse proxy. HTTPS can also be configured in the proxy, where it makes more sense. +``` + #### 2.1.0.0106-beta ```diff + User-Agent is now also used by VLC and FFmpeg. From d3f6725ba60cb23a4ae7b257f1ee6cc242f8dd50 Mon Sep 17 00:00:00 2001 From: marmei <43099631+mar-mei@users.noreply.github.com> Date: Fri, 24 Jan 2020 19:58:00 +0100 Subject: [PATCH 2/7] Update changelog-beta.md 2020-01-24 --- changelog-beta.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog-beta.md b/changelog-beta.md index c977c5d..dae577c 100644 --- a/changelog-beta.md +++ b/changelog-beta.md @@ -1,3 +1,6 @@ +#### 2.1.1.0116-beta +If no user agent is specified, the default FFmpeg or VLC user agent is used. + #### 2.1.1.0115-beta ```diff + GZIP compression for xteve.xml file. (http://xteve.ip:34400/xmltv/xteve.xml.gz) From fd3024d7ff25e27dbf64a3b4bc7d112e0b46a05a Mon Sep 17 00:00:00 2001 From: marmei <43099631+mar-mei@users.noreply.github.com> Date: Sat, 15 Feb 2020 09:01:25 +0100 Subject: [PATCH 3/7] v2.1.2.0120 --- xteve.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xteve.go b/xteve.go index 0147035..00f8401 100644 --- a/xteve.go +++ b/xteve.go @@ -39,7 +39,7 @@ var GitHub = GitHubStruct{Branch: "master", User: "xteve-project", Repo: "xTeVe- const Name = "xTeVe" // Version : Version, die Build Nummer wird in der main func geparst. -const Version = "2.1.2.0121" +const Version = "2.1.2.0120" // DBVersion : Datanbank Version const DBVersion = "2.1.0" From bc307a7cd42ffda827ba4565053b5287c7ae9d9b Mon Sep 17 00:00:00 2001 From: marmei <43099631+mar-mei@users.noreply.github.com> Date: Wed, 19 Feb 2020 19:38:56 +0100 Subject: [PATCH 4/7] 2.1.2.0121 --- xteve.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xteve.go b/xteve.go index 00f8401..0147035 100644 --- a/xteve.go +++ b/xteve.go @@ -39,7 +39,7 @@ var GitHub = GitHubStruct{Branch: "master", User: "xteve-project", Repo: "xTeVe- const Name = "xTeVe" // Version : Version, die Build Nummer wird in der main func geparst. -const Version = "2.1.2.0120" +const Version = "2.1.2.0121" // DBVersion : Datanbank Version const DBVersion = "2.1.0" From 28fe4dcf1cef2baf63efba0d65299758cf3c69eb Mon Sep 17 00:00:00 2001 From: Raf Date: Wed, 13 May 2020 16:39:06 -0400 Subject: [PATCH 5/7] Speedup db update for large files --- src/config.go | 6 ++-- src/data.go | 12 +++---- src/screen.go | 4 +-- src/struct-system.go | 3 +- src/xepg.go | 84 +++++++++++++++++++++++++------------------- 5 files changed, 62 insertions(+), 47 deletions(-) diff --git a/src/config.go b/src/config.go index a585bf9..e11d46f 100644 --- a/src/config.go +++ b/src/config.go @@ -46,7 +46,8 @@ func Init() (err error) { System.ServerProtocol.M3U = "http" System.ServerProtocol.WEB = "http" System.ServerProtocol.XML = "http" - System.DVRLimit = 480 + System.PlexChannelLimit = 480 + System.UnfilteredChannelLimit = 480 System.Compatibility = "1.4.4" // FFmpeg Default Einstellungen @@ -229,7 +230,8 @@ func StartSystem(updateProviderFiles bool) (err error) { showInfo(fmt.Sprintf("UUID:%s", Settings.UUID)) showInfo(fmt.Sprintf("Tuner (Plex / Emby):%d", Settings.Tuner)) showInfo(fmt.Sprintf("EPG Source:%s", Settings.EpgSource)) - showInfo(fmt.Sprintf("Plex Channel Limit:%d", System.DVRLimit)) + showInfo(fmt.Sprintf("Plex Channel Limit:%d", System.PlexChannelLimit)) + showInfo(fmt.Sprintf("Unfiltered Channel Limit:%d", System.UnfilteredChannelLimit)) // Providerdaten aktualisieren if len(Settings.Files.M3U) > 0 && Settings.FilesUpdate == true || updateProviderFiles == true { diff --git a/src/data.go b/src/data.go index e88c8a2..8398c9a 100644 --- a/src/data.go +++ b/src/data.go @@ -793,9 +793,9 @@ func buildDatabaseDVR() (err error) { System.ScanInProgress = 1 - Data.Streams.All = make([]interface{}, 0) - Data.Streams.Active = make([]interface{}, 0) - Data.Streams.Inactive = make([]interface{}, 0) + Data.Streams.All = make([]interface{}, 0, System.UnfilteredChannelLimit) + Data.Streams.Active = make([]interface{}, 0, System.UnfilteredChannelLimit) + Data.Streams.Inactive = make([]interface{}, 0, System.UnfilteredChannelLimit) Data.Playlist.M3U.Groups.Text = []string{} Data.Playlist.M3U.Groups.Value = []string{} Data.StreamPreviewUI.Active = []string{} @@ -951,7 +951,7 @@ func buildDatabaseDVR() (err error) { sort.Strings(Data.Playlist.M3U.Groups.Text) sort.Strings(Data.Playlist.M3U.Groups.Value) - if len(Data.Streams.Active) == 0 && len(Data.Streams.All) <= System.DVRLimit && len(Settings.Filter) == 0 { + if len(Data.Streams.Active) == 0 && len(Data.Streams.All) <= System.UnfilteredChannelLimit && len(Settings.Filter) == 0 { Data.Streams.Active = Data.Streams.All Data.Streams.Inactive = make([]interface{}, 0) @@ -960,11 +960,11 @@ func buildDatabaseDVR() (err error) { } - if len(Data.Streams.Active) > System.DVRLimit { + if len(Data.Streams.Active) > System.PlexChannelLimit { showWarning(2000) } - if len(Settings.Filter) == 0 && len(Data.Streams.All) > System.DVRLimit { + if len(Settings.Filter) == 0 && len(Data.Streams.All) > System.UnfilteredChannelLimit { showWarning(2001) } diff --git a/src/screen.go b/src/screen.go index 56876bb..d04cfa8 100644 --- a/src/screen.go +++ b/src/screen.go @@ -300,9 +300,9 @@ func getErrMsg(errCode int) (errMsg string) { // Warnings case 2000: - errMsg = fmt.Sprintf("Plex can not handle more than %d streams. If you do not use Plex, you can ignore this warning.", System.DVRLimit) + errMsg = fmt.Sprintf("Plex can not handle more than %d streams. If you do not use Plex, you can ignore this warning.", System.PlexChannelLimit) case 2001: - errMsg = fmt.Sprintf("%s has loaded more than %d streams. Use the filter to reduce the number of streams.", System.Name, System.DVRLimit) + errMsg = fmt.Sprintf("%s has loaded more than %d streams. Use the filter to reduce the number of streams.", System.Name, System.UnfilteredChannelLimit) case 2002: errMsg = fmt.Sprintf("PMS can not play m3u8 streams") case 2003: diff --git a/src/struct-system.go b/src/struct-system.go index 37f0fcd..b039b36 100644 --- a/src/struct-system.go +++ b/src/struct-system.go @@ -20,7 +20,8 @@ type SystemStruct struct { Dev bool DeviceID string Domain string - DVRLimit int + PlexChannelLimit int + UnfilteredChannelLimit int FFmpeg struct { DefaultOptions string diff --git a/src/xepg.go b/src/xepg.go index 932f373..557166d 100644 --- a/src/xepg.go +++ b/src/xepg.go @@ -253,8 +253,9 @@ func createXEPGMapping() { // XEPG Datenbank erstellen / aktualisieren func createXEPGDatabase() (err error) { - var allChannelNumbers []float64 - Data.Cache.Streams.Active = []string{} + var allChannelNumbers = make([]float64, 0, System.UnfilteredChannelLimit) + Data.Cache.Streams.Active = make([]string, 0, System.UnfilteredChannelLimit) + Data.XEPG.Channels = make(map[string]interface{}, System.UnfilteredChannelLimit) Data.XEPG.Channels, err = loadJSONFileToMap(System.File.XEPG) if err != nil { @@ -281,6 +282,11 @@ func createXEPGDatabase() (err error) { var firstFreeNumber float64 = Settings.MappingFirstChannel + if len(allChannelNumbers) > 0 { + firstFreeNumber = allChannelNumbers[len(allChannelNumbers)-1] //Start with last assigned channel number. Avoids checking from the beginning each time + firstFreeNumber++ + } + newNumber: if indexOfFloat64(firstFreeNumber, allChannelNumbers) == -1 { @@ -296,7 +302,7 @@ func createXEPGDatabase() (err error) { showInfo("XEPG:" + "Update database") - // Kanal mit fehlenden Kanalnummern löschen + // Kanal mit fehlenden Kanalnummern löschen. Delete channel with missing channel numbers for id, dxc := range Data.XEPG.Channels { var xepgChannel XEPGChannelStruct @@ -315,17 +321,24 @@ func createXEPGDatabase() (err error) { } - var xepgChannels = make(map[string]interface{}) + // Make a map of the db channels based on their previously downloaded attributes -- filename, group, title, etc + var xepgChannelsValuesMap = make(map[string]XEPGChannelStruct, System.UnfilteredChannelLimit) + for _, v := range Data.XEPG.Channels { + var channel XEPGChannelStruct + err = json.Unmarshal([]byte(mapToJSON(v)), &channel) + if err != nil { + return + } - for k, v := range Data.XEPG.Channels { - xepgChannels[k] = v + xepgChannelsValuesMap[channel.FileM3UID+channel.Name+channel.GroupTitle+channel.TvgID+channel.TvgName+channel.TvgLogo] = channel } for _, dsa := range Data.Streams.Active { - var channelExists = false // Entscheidet ob ein Kanal neu zu Datenbank hinzugefügt werden soll. - var channelHasUUID = false // Überprüft, ob der Kanal (Stream) eindeutige ID's besitzt - var currentXEPGID string // Aktuelle Datenbank ID (XEPG). Wird verwendet, um den Kanal in der Datenbank mit dem Stream der M3u zu aktualisieren + var channelExists = false // Entscheidet ob ein Kanal neu zu Datenbank hinzugefügt werden soll. Decides whether a channel should be added to the database + var channelHasUUID = false // Überprüft, ob der Kanal (Stream) eindeutige ID's besitzt. Checks whether the channel (stream) has unique IDs + var currentXEPGID string // Aktuelle Datenbank ID (XEPG). Wird verwendet, um den Kanal in der Datenbank mit dem Stream der M3u zu aktualisieren. Current database ID (XEPG) Used to update the channel in the database with the stream of the M3u + var m3uChannel M3UChannelStructXEPG err = json.Unmarshal([]byte(mapToJSON(dsa)), &m3uChannel) @@ -335,42 +348,41 @@ func createXEPGDatabase() (err error) { Data.Cache.Streams.Active = append(Data.Cache.Streams.Active, m3uChannel.Name) - // XEPG Datenbank durchlaufen um nach dem Kanal zu suchen. - for xepg, dxc := range xepgChannels { + // Try to find the channel based on matching all known values. If that fails, then move to full channel scan + if val, ok := xepgChannelsValuesMap[m3uChannel.FileM3UID+m3uChannel.Name+m3uChannel.GroupTitle+m3uChannel.TvgID+m3uChannel.TvgName+m3uChannel.TvgLogo]; ok { + channelExists = true + channelHasUUID = false + currentXEPGID = val.XEPG + } else { - var xepgChannel XEPGChannelStruct - err = json.Unmarshal([]byte(mapToJSON(dxc)), &xepgChannel) - if err != nil { - return - } + // XEPG Datenbank durchlaufen um nach dem Kanal zu suchen. Run through the XEPG database to search for the channel (full scan) + for _, dxc := range xepgChannelsValuesMap { - // Vergleichen des Streams anhand einer UUID in der M3U mit dem Kanal in der Databank - if len(xepgChannel.UUIDValue) > 0 && len(m3uChannel.UUIDValue) > 0 { + // Vergleichen des Streams anhand einer UUID in der M3U mit dem Kanal in der Databank. Compare the stream using a UUID in the M3U with the channel in the database + if len(dxc.UUIDValue) > 0 && len(m3uChannel.UUIDValue) > 0 { - if xepgChannel.UUIDValue == m3uChannel.UUIDValue && xepgChannel.UUIDKey == m3uChannel.UUIDKey { + if dxc.UUIDValue == m3uChannel.UUIDValue && dxc.UUIDKey == m3uChannel.UUIDKey { - channelExists = true - channelHasUUID = true - currentXEPGID = xepg - break + channelExists = true + channelHasUUID = true + currentXEPGID = dxc.XEPG + break + + } + + } else { + // Vergleichen des Streams mit dem Kanal in der Databank anhand des Kanalnamens. Compare the stream to the channel in the database using the channel name + if dxc.Name == m3uChannel.Name { + channelExists = true + currentXEPGID = dxc.XEPG + break + } } - } else { - // Vergleichen des Streams mit dem Kanal in der Databank anhand des Kanalnamens - //fmt.Println(xepgChannel.Name, xepgChannel.UUIDKey, xepgChannel.UUIDValue) - if xepgChannel.Name == m3uChannel.Name { - channelExists = true - currentXEPGID = xepg - break - } - } - } - //os.Exit(0) - switch channelExists { case true: @@ -435,7 +447,7 @@ func createXEPGDatabase() (err error) { } } - + showInfo("XEPG:" + "Save DB file") err = saveMapToJSONFile(System.File.XEPG, Data.XEPG.Channels) if err != nil { return From fb5d0a39047a9d9c6ebcedee710f481900a2fc2a Mon Sep 17 00:00:00 2001 From: Raf Date: Thu, 14 May 2020 09:00:00 -0400 Subject: [PATCH 6/7] freenumbergen-start at settings.firstchannel if free --- src/xepg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xepg.go b/src/xepg.go index 557166d..7e2b925 100644 --- a/src/xepg.go +++ b/src/xepg.go @@ -282,7 +282,7 @@ func createXEPGDatabase() (err error) { var firstFreeNumber float64 = Settings.MappingFirstChannel - if len(allChannelNumbers) > 0 { + if len(allChannelNumbers) > 0 && indexOfFloat64(firstFreeNumber, allChannelNumbers) >= 0 { //channels exist and first channel number is taken firstFreeNumber = allChannelNumbers[len(allChannelNumbers)-1] //Start with last assigned channel number. Avoids checking from the beginning each time firstFreeNumber++ } From 5fceb1d34f4faebbe999c83ad894225cf6219ad3 Mon Sep 17 00:00:00 2001 From: Raf Date: Thu, 14 May 2020 10:15:42 -0400 Subject: [PATCH 7/7] update change log to match upstream beta --- changelog-beta.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/changelog-beta.md b/changelog-beta.md index dae577c..4e68516 100644 --- a/changelog-beta.md +++ b/changelog-beta.md @@ -1,12 +1,3 @@ -#### 2.1.1.0116-beta -If no user agent is specified, the default FFmpeg or VLC user agent is used. - -#### 2.1.1.0115-beta -```diff -+ GZIP compression for xteve.xml file. (http://xteve.ip:34400/xmltv/xteve.xml.gz) -- Removed protocol setting for reverse proxy. HTTPS can also be configured in the proxy, where it makes more sense. -``` - #### 2.1.0.0106-beta ```diff + User-Agent is now also used by VLC and FFmpeg.