cmd

package
v3.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2025 License: CC-BY-4.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PID_FILE_NAME = ".jiotv_go.pid"
View Source
var PID_FILE_PATH string

Functions

func AutoStart

func AutoStart(extraArgs string) error

AutoStart adds or updates an auto start command for the current executable in the bashrc file. It checks if auto start already exists, gets user consent if needed, and adds the command to run the executable on startup, passing any extra args. It supports Linux, Android and OSX systems.

func DeleteEPG

func DeleteEPG() error

DeleteEPG deletes the existing epg.xml.gz file if it exists. It logs status messages about deleting or not finding the file. Returns any errors encountered except os.ErrNotExist.

func GenEPG

func GenEPG() error

GenEPG generates a new epg.xml.gz file with updated EPG data by first deleting any existing epg.xml.gz file. It initializes the utils.Log global logger, calls epg.GenXMLGz() to generate the XML, and returns any errors.

func IsUpdateAvailable

func IsUpdateAvailable(currentVersion, customVersion string) string

IsUpdateAvailable checks if a newer version of the application is available by calling getLatestRelease() to fetch the latest release information from GitHub.

func JioTVServer

func JioTVServer(jiotvServerConfig JioTVServerConfig) error

JioTVServer starts the JioTV server. It loads the config, initializes logging, secure URLs, and EPG. It then configures the Fiber app with middleware and routes. It starts listening on the provided host and port. Returns an error if listening fails.

func LoginOTP

func LoginOTP() error

LoginOTP handles the login flow using OTP. It takes the mobile number as input, sends an OTP, verifies the entered OTP by the user and logs in the user. Returns any error encountered.

func LoginPassword

func LoginPassword() error

LoginPassword handles the login flow using password. It takes the mobile number and password as input, verifies the credentials by calling the Login API and logs in the user if successful. Returns any error encountered.

func Logout

func Logout() error

Logout logs the user out by removing the saved login credentials file. It checks if the file exists before removing to avoid errors. Logs messages to provide feedback to the user. Returns any errors encountered.

func PrintIfUpdateAvailable

func PrintIfUpdateAvailable(c *cli.Context)

PrintIfUpdateAvailable checks if a newer version of the application is available

func RunInBackground

func RunInBackground(args string, configPath string) error

RunInBackground starts the JioTV Go server as a background process by executing the current binary with the provided arguments. It stores the process ID in a file in the user's home directory so it can be stopped later. Returns any errors encountered while starting the process.

func StopBackground

func StopBackground(configPath string) error

StopBackground stops the background JioTV Go server process that was previously started with RunInBackground. It reads the PID from the PID file, sends a kill signal to that process, and deletes the PID file. Returns any errors encountered.

func Update

func Update(currentVersion, customVersion string) error

Finally, it prints a message that the update was successful and the app should be restarted.

Types

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

Asset defines the structure of an asset from the GitHub API release response. It contains the asset name and browser download URL.

type JioTVServerConfig added in v3.12.0

type JioTVServerConfig struct {
	Host        string
	Port        string
	ConfigPath  string
	TLS         bool
	TLSCertPath string
	TLSKeyPath  string
}

type Release

type Release struct {
	Assets  []Asset `json:"assets"`
	TagName string  `json:"tag_name"`
}

Release represents a GitHub release. It contains the release tag name and associated assets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳