Skip to content

Commit

Permalink
Change-to-github-api (#19)
Browse files Browse the repository at this point in the history
* Format base_ts, add ability to move channel to existing channel number

Format the base_ts.ts file and change declarations of arrays and objects to use [] and {} instead of using new array and new object.

Add ability for channels to be moved to an already occupied channel number. This will shift the channel that previously occupied that channel number and all other channels after up by one number until either an empty channel number is found or the end of the channels is reached. Allows the ability to easily move channels around without the need of manually renumbering channels.

* Login page fixes, add checkbox for shift channel

Fixes login page not submitting when pressing enter, also centered the login button.

Added checkbox for new shift channel feature that is on by default. Unchecking the box reverts the mapping to the old method.

Removed "(Emby only)" from kids category as this category is now supported in Plex as well.

* Update version number

* Add TV logo lookup, general cleanup, add default TV logo

Add the ability to search Tapiosinn's tv-logo repository and easily select a TV channel logo to use from the list.

Added the ability to preview a TV channel logo URL so when selecting an image from the list or pasting one in it will show a preview of the image.

Some general linter cleanup as well as added a default TV channel logo to be used if one does not exist and added 2 scripts one for powershell and one for bash to easily generate the webUI.go file from the html folder for development.

* update webUI builder scripts to use 2 spaces instead of tabs

* Add TV logo lookup, general cleanup, add default TV logo

Add the ability to search Tapiosinn's tv-logo repository and easily select a TV channel logo to use from the list.

Added the ability to preview a TV channel logo URL so when selecting an image from the list or pasting one in it will show a preview of the image.

Some general linter cleanup as well as added a default TV channel logo to be used if one does not exist and added 2 scripts one for powershell and one for bash to easily generate the webUI.go file from the html folder for development.

* Fix HostIP and HostName for m3u and xepg

Fixes HostIP and HostName not properly being used and set for m3u and xepg file creation.

* Fix memory buffer on Windows if cache path not on C: volume

On Windows machines if buffer to memory is active and the xTeVe cache is set to a folder on a volume other than C: it will cause a panic error and the stream not to play.

This fixes that by checking if we are on Windows and if so is the cache folder path not on the C: volume, if not create the volume it is located on in the memory virtual file system.

* Fix webserver overriding globalDomain

* Fix popup menu broken due to new preview channel logo

* Add missing port for setGlobalDomain HostIP/HostName

* Converted logos to github api for speed

* Added in File Download logic for M3U and XML files

* Added Description to Logo URL

* Start of Sort By Country

* Country Matching cleanup

* Added Logging Functions to js
Cleaned Up logo json to reduce size
Changed WS to allow more than one request
Log logos with 404 or no value
Changed bad logos to use default logo
Added in country selector in settings for logo selection
Ability to Upload M3U/XML files from desktop

* Return local file paths for M3U and XML

* Restore from configuration wizard

* Update to version 2.5.2

Co-authored-by: Christopher Norton <24207721+cnorton-webdev@users.noreply.github.com>
  • Loading branch information
SenexCrenshaw and cnorton-webdev authored Aug 31, 2022
1 parent 91e9295 commit 1c9c86f
Show file tree
Hide file tree
Showing 33 changed files with 1,576 additions and 693 deletions.
9 changes: 4 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"type": "shell",
"command": "./update_version.sh",
"presentation": {
"reveal": "always",
"panel": "new"
"revealProblems": "onProblem"
}
},
{
Expand All @@ -17,6 +16,7 @@
"$tsc"
],
"group": {
"revealProblems": "onProblem",
"kind": "build",
"isDefault": true
},
Expand All @@ -25,10 +25,9 @@
{
"label": "Build webUI",
"type": "shell",
"command": "test -f './xteve' && ./xteve -buildwebui",
"command": "cd ts && bash build_webUI.sh",
"presentation": {
"reveal": "always",
"panel": "new"
"revealProblems": "onProblem"
},
"dependsOn": [
"Update Version",
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FROM alpine:latest
ARG BUILD_DATE
ARG VCS_REF
ARG XTEVE_PORT=34400
ARG XTEVE_VERSION=2.5.1
ARG XTEVE_VERSION=2.5.2

LABEL org.opencontainers.image.created="{$BUILD_DATE}" \
org.opencontainers.image.url="https://hub.docker.com/r/SenexCrenshaw/xteve/" \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
2.5.2
1 change: 1 addition & 0 deletions html/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<script language="javascript" type="text/javascript" src="js/menu_ts.js"></script>
<script language="javascript" type="text/javascript" src="js/settings_ts.js"></script>
<script language="javascript" type="text/javascript" src="js/base_ts.js"></script>
<script language="javascript" type="text/javascript" src="js/TVLogosFile.js"></script>
</head>

<body onload="javascript: readyForConfiguration(0);">
Expand Down
5 changes: 5 additions & 0 deletions html/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ input[type=button].center {
border-bottom: solid 0px #777;
}

.shiftChannelLabel {
display: inline;
margin-left: 5px;
margin-bottom: 20px;
}

.half {
display: block;
Expand Down
Binary file added html/img/tv-test-pattern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script language="javascript" type="text/javascript" src="js/settings_ts.js"></script>
<script language="javascript" type="text/javascript" src="js/logs_ts.js"></script>
<script language="javascript" type="text/javascript" src="js/base_ts.js"></script>
<script language="javascript" type="text/javascript" src="js/TVLogosFile.js"></script>

</head>

Expand Down
25 changes: 23 additions & 2 deletions html/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@
"update": "Update",
"craeteAccount": "Create Account",
"resetLogs": "Reset Logs",
"uploadLogo": "Upload Logo"
"uploadLogo": "Upload Logo",
"uploadM3U": "Upload M3U",
"uploadXML": "Upload XML"
},
"checkbox": {
"shiftChannel": {
"label": "Shift Channels",
"title": "Shift existing channels up by 1 channel number if moving a channel to an already used channel number"
}
},
"filter": {
"table": {
Expand Down Expand Up @@ -230,6 +238,11 @@
"channelLogo": {
"title": "Logo URL",
"placeholder": "",
"description": "URL for the logo. You can type in this field to search Tapiosinn's tv-logos repository"
},
"channelLogoPreview": {
"title": "Channel Logo Preview",
"placeholder": "",
"description": ""
},
"updateChannelLogo": {
Expand Down Expand Up @@ -366,7 +379,15 @@
},
"tlsMode": {
"title": "TLS (HTTPS) mode",
"description": "Changes web server protocol to HTTPS.<br>For details, see <a>https://github.com/SenexCrenshaw/xTeVe#tls-mode</a>"
"description": "Changes web server protocol to HTTPS.<br>For details, see <a href='https://github.com/SenexCrenshaw/xTeVe#tls-mode' target='_blank'>https://github.com/SenexCrenshaw/xTeVe#tls-mode</a>"
},
"tvLogos": {
"title": "Enable ability to find station logos",
"description": "Adds the ability to find station logos from Tapiosinn's tv-logos Github repository, first run may take upwards of ~30 seconds to fetch data. See <a href='https://github.com/Tapiosinn/tv-logos/' target='_blank'>https://github.com/Tapiosinn/tv-logos/</a>"
},
"logosCountry": {
"title": "Filter Tapiosinn logos by country",
"description": "Type in this field to search Tapiosinn's tv-logos repository"
},
"filesUpdate": {
"title": "Updates all files at startup",
Expand Down
9 changes: 5 additions & 4 deletions html/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ <h1 id="head-text" class="center">{{.login.headline}}</h1>

<h5>{{.login.username.title}}:</h5>
<input id="username" type="text" name="username" placeholder="Username" value="">

<h5>{{.login.password.title}}:</h5>
<input id="password" type="password" name="password" placeholder="Password" value="">

</form>
<div style="text-align: center">
<input id="submitBtn" type="submit" value="Login" onclick="login();">
</div>

</div>
</form>

<div id="box-footer">
<input id="submit" class="" type="button" value="{{.button.login}}" onclick="javascript: login();">
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion release.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.5.1",
"version": "2.5.2",
"go_version": "1.19.0"
}
11 changes: 10 additions & 1 deletion src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var Settings SettingsStruct
var Data DataStruct

// SystemFiles : All System Files
var SystemFiles = []string{"authentication.json", "pms.json", "settings.json", "xepg.json", "urls.json"}
var SystemFiles = []string{"authentication.json", "pms.json", "settings.json", "xepg.json", "urls.json", "tvlogos.json"}

// BufferInformation : Information about the Buffer (active Streams, maximum Streams)
var BufferInformation sync.Map
Expand Down Expand Up @@ -101,7 +101,9 @@ func Init() (err error) {
System.File.ServerCert = getPlatformFile(fmt.Sprintf("%sxteve.crt", System.Folder.Certificates))
System.File.ServerCertPrivKey = getPlatformFile(fmt.Sprintf("%sxteve.key", System.Folder.Certificates))
System.File.XML = getPlatformFile(fmt.Sprintf("%s%s.xml", System.Folder.Data, System.AppName))
System.File.XMLUploaded = getPlatformFile(fmt.Sprintf("%s%s_uploaded.xml", System.Folder.Data, System.AppName))
System.File.M3U = getPlatformFile(fmt.Sprintf("%s%s.m3u", System.Folder.Data, System.AppName))
System.File.M3UUploaded = getPlatformFile(fmt.Sprintf("%s%s_uploaded.m3u", System.Folder.Data, System.AppName))

System.Compressed.GZxml = getPlatformFile(fmt.Sprintf("%s%s.xml.gz", System.Folder.Data, System.AppName))

Expand Down Expand Up @@ -157,6 +159,13 @@ func Init() (err error) {
ShowError(err, 1002)
}

if Settings.EnableTapiosinnTVLogos {
// Run this in the background, can take a little bit to fetch the data
go func() {
downloadLogoJSON()
}()
}

showInfo(fmt.Sprintf("System IP Addresses:IPv4: %d | IPv6: %d", len(System.IPAddressesV4), len(System.IPAddressesV6)))
showInfo("Hostname:" + System.Hostname)

Expand Down
3 changes: 1 addition & 2 deletions src/m3u.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ func buildM3U(groups []string) (m3u string, err error) {

// Create M3U Content
sort.Float64s(channelNumbers)

var xmltvURL = fmt.Sprintf("%s://%s/xmltv/xteve.xml", System.ServerProtocol.XML, System.Domain)
xmltvURL := fmt.Sprintf("%s://%s/xmltv/xteve.xml", System.ServerProtocol.XML, System.Domain)
m3u = fmt.Sprintf(`#EXTM3U url-tvg="%s" x-tvg-url="%s"`+"\n", xmltvURL, xmltvURL)

for _, channelNumber := range channelNumbers {
Expand Down
2 changes: 2 additions & 0 deletions src/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func maintenance() {
Data.Cache.XMLTV = make(map[string]XMLTV)
buildXEPG(false)

// Check if TV logos JSON needs updating
downloadLogoJSON()
}

}
Expand Down
57 changes: 57 additions & 0 deletions src/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,34 @@ func showHighlight(str string) {

}

func showWarningFromWeb(str string) {

var max = 23
var msg = strings.SplitN(str, ":", 2)
var length = len(msg[0])
var space string

if len(msg) == 2 {

for i := length; i < max; i++ {
space = space + " "
}

msg[0] = msg[0] + ":" + space

var logMsg = fmt.Sprintf("[%s] [WARNING] %s%s", System.Name, msg[0], msg[1])

printLogOnScreen(logMsg, "warning")

logMsg = strings.Replace(logMsg, " ", "&nbsp;", -1)
WebScreenLog.Log = append(WebScreenLog.Log, time.Now().Format("2006-01-02 15:04:05")+" "+logMsg)
WebScreenLog.Warnings++
logCleanUp()

}

}

func showWarning(errCode int) {

var errMsg = getErrMsg(errCode)
Expand All @@ -121,6 +149,35 @@ func showWarning(errCode int) {

}

func ShowErrorFromWeb(str string) {

var max = 23
var msg = strings.SplitN(str, ":", 2)
var length = len(msg[0])
var space string
var mutex = sync.RWMutex{}

if len(msg) == 2 {

for i := length; i < max; i++ {
space = space + " "
}
msg[0] = msg[0] + ":" + space

var logMsg = fmt.Sprintf("[%s] [ERROR] %s%s", System.Name, msg[0], msg[1])

printLogOnScreen(logMsg, "error")
logMsg = strings.Replace(logMsg, " ", "&nbsp;", -1)

mutex.Lock()
WebScreenLog.Log = append(WebScreenLog.Log, time.Now().Format("2006-01-02 15:04:05")+" "+logMsg)
WebScreenLog.Errors++
mutex.Unlock()

}

}

// ShowError : Shows the Error Messages in the Console
func ShowError(err error, errCode int) {

Expand Down
60 changes: 36 additions & 24 deletions src/struct-system.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ type SystemStruct struct {
File struct {
Authentication string
M3U string
M3UUploaded string
PMS string
ServerCert string
ServerCertPrivKey string
Settings string
URLS string
XEPG string
XML string
XMLUploaded string
TVLogos string
}

Compressed struct {
Expand Down Expand Up @@ -121,6 +124,11 @@ type GitStruct struct {
Version string `json:"version"`
}

type LogosStruct struct {
URL string `json:"url"`
LogoInformation []LogoInformation `json:"LogoInformation"`
}

// DataStruct : All Data is stored here. (Lineup, XMLTV)
type DataStruct struct {
Cache struct {
Expand Down Expand Up @@ -169,6 +177,8 @@ type DataStruct struct {
Channels map[string]interface{}
XEPGCount int64
}

Logos LogosStruct
}

// Filter : Used for the Filter Rules
Expand Down Expand Up @@ -271,30 +281,32 @@ type Notification struct {

// SettingsStruct : Content of settings.json
type SettingsStruct struct {
API bool `json:"api"`
AuthenticationAPI bool `json:"authentication.api"`
AuthenticationM3U bool `json:"authentication.m3u"`
AuthenticationPMS bool `json:"authentication.pms"`
AuthenticationWEB bool `json:"authentication.web"`
AuthenticationXML bool `json:"authentication.xml"`
BackupKeep int `json:"backup.keep"`
BackupPath string `json:"backup.path"`
Branch string `json:"git.branch,omitempty"`
Buffer string `json:"buffer"`
BufferSize int `json:"buffer.size.kb"`
BufferTimeout float64 `json:"buffer.timeout"`
CacheImages bool `json:"cache.images"`
ClearXMLTVCache bool `json:"clearXMLTVCache"`
DefaultMissingEPG string `json:"defaultMissingEPG"`
DisallowURLDuplicates bool `json:"disallowURLDuplicates"`
EnableMappedChannels bool `json:"enableMappedChannels"`
EpgSource string `json:"epgSource"`
FFmpegOptions string `json:"ffmpeg.options"`
FFmpegPath string `json:"ffmpeg.path"`
VLCOptions string `json:"vlc.options"`
VLCPath string `json:"vlc.path"`
FileM3U []string `json:"file,omitempty"` // In the Wizard, the M3U is saved in a Slice
FileXMLTV []string `json:"xmltv,omitempty"` // Old Storage System of the provider XML File Slice (Required for the conversion to the new one)
API bool `json:"api"`
AuthenticationAPI bool `json:"authentication.api"`
AuthenticationM3U bool `json:"authentication.m3u"`
AuthenticationPMS bool `json:"authentication.pms"`
AuthenticationWEB bool `json:"authentication.web"`
AuthenticationXML bool `json:"authentication.xml"`
BackupKeep int `json:"backup.keep"`
BackupPath string `json:"backup.path"`
Branch string `json:"git.branch,omitempty"`
Buffer string `json:"buffer"`
BufferSize int `json:"buffer.size.kb"`
BufferTimeout float64 `json:"buffer.timeout"`
CacheImages bool `json:"cache.images"`
ClearXMLTVCache bool `json:"clearXMLTVCache"`
DefaultMissingEPG string `json:"defaultMissingEPG"`
DisallowURLDuplicates bool `json:"disallowURLDuplicates"`
EnableTapiosinnTVLogos bool `json:"enableTapiosinnTVLogos"`
LogosCountry string `json:"logosCountry"`
EnableMappedChannels bool `json:"enableMappedChannels"`
EpgSource string `json:"epgSource"`
FFmpegOptions string `json:"ffmpeg.options"`
FFmpegPath string `json:"ffmpeg.path"`
VLCOptions string `json:"vlc.options"`
VLCPath string `json:"vlc.path"`
FileM3U []string `json:"file,omitempty"` // In the Wizard, the M3U is saved in a Slice
FileXMLTV []string `json:"xmltv,omitempty"` // Old Storage System of the provider XML File Slice (Required for the conversion to the new one)

Files struct {
HDHR map[string]interface{} `json:"hdhr"`
Expand Down
Loading

0 comments on commit 1c9c86f

Please sign in to comment.