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

Commit

Permalink
Remove unfiltered channel limit. Closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
SCP002 committed Apr 14, 2022
1 parent 30dad33 commit 60a755a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
2 changes: 0 additions & 2 deletions src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 4 additions & 8 deletions src/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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)

Expand All @@ -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)))
Expand Down
6 changes: 4 additions & 2 deletions src/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/struct-system.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type SystemStruct struct {
DeviceID string
Domain string
PlexChannelLimit int
UnfilteredChannelLimit int

FFmpeg struct {
DefaultOptions string
Expand Down
8 changes: 4 additions & 4 deletions src/xepg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

1 comment on commit 60a755a

@joshjryan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Please sign in to comment.