From 60a755af5752b8cf59fb3441122751e8e035117d Mon Sep 17 00:00:00 2001 From: SCP002 Date: Fri, 15 Apr 2022 02:25:30 +0300 Subject: [PATCH] Remove unfiltered channel limit. Closes #14 --- src/config.go | 2 -- src/data.go | 12 ++++-------- src/screen.go | 6 ++++-- src/struct-system.go | 1 - src/xepg.go | 8 ++++---- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/config.go b/src/config.go index 486d418..c9d18bf 100644 --- a/src/config.go +++ b/src/config.go @@ -47,7 +47,6 @@ func Init() (err error) { System.ServerProtocol.WEB = "http" System.ServerProtocol.XML = "http" System.PlexChannelLimit = 480 - System.UnfilteredChannelLimit = 480 System.Compatibility = "1.4.4" // FFmpeg Default Settings @@ -228,7 +227,6 @@ func StartSystem(updateProviderFiles bool) (err error) { 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.PlexChannelLimit)) - showInfo(fmt.Sprintf("Unfiltered Chan. Limit:%d", System.UnfilteredChannelLimit)) // Update Provider Data if len(Settings.Files.M3U) > 0 && Settings.FilesUpdate == true || updateProviderFiles == true { diff --git a/src/data.go b/src/data.go index 69a1b23..29cfe4d 100644 --- a/src/data.go +++ b/src/data.go @@ -790,9 +790,9 @@ func buildDatabaseDVR() (err error) { System.ScanInProgress = 1 - 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.Streams.All = make([]interface{}, 0) + Data.Streams.Active = make([]interface{}, 0) + Data.Streams.Inactive = make([]interface{}, 0) Data.Playlist.M3U.Groups.Text = []string{} Data.Playlist.M3U.Groups.Value = []string{} Data.StreamPreviewUI.Active = []string{} @@ -948,7 +948,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.UnfilteredChannelLimit && len(Settings.Filter) == 0 { + if len(Data.Streams.Active) == 0 && len(Settings.Filter) == 0 { Data.Streams.Active = Data.Streams.All Data.Streams.Inactive = make([]interface{}, 0) @@ -961,10 +961,6 @@ func buildDatabaseDVR() (err error) { showWarning(2000) } - if len(Settings.Filter) == 0 && len(Data.Streams.All) > System.UnfilteredChannelLimit { - showWarning(2001) - } - System.ScanInProgress = 0 showInfo(fmt.Sprintf("All streams:%d", len(Data.Streams.All))) showInfo(fmt.Sprintf("Active streams:%d", len(Data.Streams.Active))) diff --git a/src/screen.go b/src/screen.go index 65eb9de..fd913c8 100644 --- a/src/screen.go +++ b/src/screen.go @@ -306,9 +306,11 @@ 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.PlexChannelLimit) + errMsg = fmt.Sprintf("Plex can not handle more than %d streams. Use filter to reduce the number of streams. "+ + "If you do not use Plex, 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.UnfilteredChannelLimit) + // Free slot + return 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 f618ecc..2f5bdfe 100644 --- a/src/struct-system.go +++ b/src/struct-system.go @@ -23,7 +23,6 @@ type SystemStruct struct { DeviceID string Domain string PlexChannelLimit int - UnfilteredChannelLimit int FFmpeg struct { DefaultOptions string diff --git a/src/xepg.go b/src/xepg.go index 79959dd..d521b2d 100644 --- a/src/xepg.go +++ b/src/xepg.go @@ -248,9 +248,9 @@ func createXEPGMapping() { // Create / update XEPG Database func createXEPGDatabase() (err error) { - 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) + var allChannelNumbers = make([]float64, 0) + Data.Cache.Streams.Active = make([]string, 0) + Data.XEPG.Channels = make(map[string]interface{}) Data.XEPG.Channels, err = loadJSONFileToMap(System.File.XEPG) if err != nil { @@ -327,7 +327,7 @@ func createXEPGDatabase() (err error) { } // 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) + var xepgChannelsValuesMap = make(map[string]XEPGChannelStruct) for _, v := range Data.XEPG.Channels { var channel XEPGChannelStruct err = json.Unmarshal([]byte(mapToJSON(v)), &channel)