Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCommand = cli.Command{ Name: "add", Category: "QUEUE", Usage: "Add track(s) to the queue", ArgsUsage: "TRACK...", Description: "TRACK can be a file or URL or - to read the list of tracks/URLs from stdin", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "append-only", Usage: "add but don't play", }, &cli.BoolFlag{ Name: "replace, r", Usage: "add and play, stopping the current track", }, &cli.BoolFlag{ Name: "next, n", Usage: "add as next track", }, }, Action: func(ctx *cli.Context) error { c, err := mp.Connect(ctx) if err != nil { return err } tracks := []string{ctx.Args().First()} tracks = append(tracks, ctx.Args().Tail()...) if tracks[0] == "-" { tracks = []string{} in := bufio.NewScanner(os.Stdin) for in.Scan() { tracks = append(tracks, in.Text()) } if err := in.Err(); err != nil { return fmt.Errorf("Error reading from stdin: %s", err) } } switch { case ctx.Bool("append-only"): return c.LoadAppend(tracks...) case ctx.Bool("replace"): if c.Paused() { defer c.Play() } return c.LoadReplace(tracks...) case ctx.Bool("next"): return c.LoadNext(tracks...) default: return c.LoadPlay(tracks...) } }, }
View Source
var Command = cli.Command{ Name: "queue", Aliases: []string{"q", "ls"}, Usage: "Show the queue", Subcommands: []cli.Command{ AddCommand, NextCommand, PrevCommand, NowPlayingCommand, removeCommand, clearCommand, moveCommand, shuffleCommand, gotoCommand, saveCommand, loadCommand, }, Action: func(ctx *cli.Context) error { c, err := mp.Connect(ctx) if err != nil { return err } queue, err := c.Queue() if err != nil { return err } if len(queue) == 0 { fmt.Println("Queue is empty") return nil } return renderQueue(queue) }, }
View Source
var NextCommand = cli.Command{ Name: "next", Category: "QUEUE", Usage: "Skips to the next title", Action: func(ctx *cli.Context) error { c, err := mp.Connect(ctx) if err != nil { return err } return c.Next() }, }
View Source
var NowPlayingCommand = cli.Command{ Name: "now", Aliases: []string{"status"}, Category: "QUEUE", Usage: "Show currently playing song", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "watch, w", Usage: "(not done yet) keep open and refresh", }, &cli.BoolFlag{ Name: "json, j", Usage: "output json", }, }, Action: func(ctx *cli.Context) error { c, err := mp.Connect(ctx) if err != nil { return err } meta, err := c.Now() if err != nil { return err } if ctx.Bool("json") { return jsonNowPlaying(meta) } return renderNowPlaying(meta, c.Paused()) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.