plex

package
v0.0.0-...-288be38 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ec2RunningStatus = "Running"
	Ec2StoppedStatus = "Stopped"
)

Variables

View Source
var MonitorPlexCmd = &cobra.Command{
	Use:   "monitor",
	Short: "To Monitor Plex Sessions",
	Long:  "to monitor plex sessions and shut it down if no activity.",
	Run: func(cmd *cobra.Command, args []string) {
		enabledLambdaMonitor, err := strconv.ParseBool(monitorEnabled)
		if err == nil && enabledLambdaMonitor {
			EnabledMonitorRule()
			os.Exit(0)
		} else if err == nil && !enabledLambdaMonitor {
			DisabledMonitorRule()
			os.Exit(0)
		} else {
			Monitor(slackNotification)
		}
	},
}
View Source
var (
	RootPlexCmd = &cobra.Command{
		Use:   "plex",
		Short: "To Control Plex Media Server",
	}
)
View Source
var StartPlexCmd = &cobra.Command{
	Use:   "start",
	Short: "To Start Plex",
	Long:  "to start the Plex Media Server.",
	Run: func(cmd *cobra.Command, args []string) {
		shutdownCh := make(chan struct{})
		go Indicator(shutdownCh)
		Start()
		close(shutdownCh)
		m := make(map[string]string)
		m["plex_status"] = "started"
		jsonString, _ := json.Marshal(m)
		fmt.Println("\n" + string(jsonString))
	},
}
View Source
var StatusPlexCmd = &cobra.Command{
	Use:   "status",
	Short: "To Get Plex Status",
	Long:  "to get the status of the Plex Media Server.",
	Run: func(cmd *cobra.Command, args []string) {
		status := Status()
		m := make(map[string]interface{})
		m["plex_status"] = status
		jsonString, _ := json.Marshal(m)
		fmt.Println(strings.ToLower(string(jsonString)))
	},
}
View Source
var StopPlexCmd = &cobra.Command{
	Use:   "stop",
	Short: "To Stop Plex",
	Long:  "to stop the Plex Media Server.",
	Run: func(cmd *cobra.Command, args []string) {
		shutdownCh := make(chan struct{})
		go Indicator(shutdownCh)
		Stop(slackNotification)
		close(shutdownCh)
		m := make(map[string]string)
		m["plex_status"] = "stopped"
		jsonString, _ := json.Marshal(m)
		fmt.Println("\n" + string(jsonString))
	},
}
View Source
var TokenPlexCmd = &cobra.Command{
	Use:   "token",
	Short: "To Get Plex Token",
	Long:  "to get a Plex token for API calls.",
	Run: func(cmd *cobra.Command, args []string) {
		Token()
	},
}

Functions

func DisabledMonitorRule

func DisabledMonitorRule()

func EnabledMonitorRule

func EnabledMonitorRule()

func Indicator

func Indicator(shutdownCh <-chan struct{})

func Monitor

func Monitor(slackNotification string)

func ShowError

func ShowError(err error)

func Start

func Start()

func Status

func Status() string

func Stop

func Stop(slackNotification string)

func Token

func Token()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL