Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoradio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
autoradio
Commits
b062f015
Commit
b062f015
authored
5 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Make some things private
parent
4d07f9a7
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
v2.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/radioctl/radioctl.go
+28
-28
28 additions, 28 deletions
cmd/radioctl/radioctl.go
with
28 additions
and
28 deletions
cmd/radioctl/radioctl.go
+
28
−
28
View file @
b062f015
...
...
@@ -117,22 +117,22 @@ func (v *floatOptionalValue) Get() interface{} {
return
v
.
value
}
type
H
asAddFlags
interface
{
type
h
asAddFlags
interface
{
AddFlags
(
*
gonutsflag
.
FlagSet
)
}
type
C
ommandInterface
interface
{
type
c
ommandInterface
interface
{
Run
([]
string
)
Command
()
*
commander
.
Command
}
type
B
aseCommand
struct
{
type
b
aseCommand
struct
{
UsageLine
string
Short
string
Long
string
}
func
(
b
*
B
aseCommand
)
Command
()
*
commander
.
Command
{
func
(
b
*
b
aseCommand
)
Command
()
*
commander
.
Command
{
return
&
commander
.
Command
{
UsageLine
:
b
.
UsageLine
,
Short
:
b
.
Short
,
...
...
@@ -140,7 +140,7 @@ func (b *BaseCommand) Command() *commander.Command {
}
}
func
(
b
*
B
aseCommand
)
Run
(
args
[]
string
)
{
func
(
b
*
b
aseCommand
)
Run
(
args
[]
string
)
{
}
var
auClient
*
client
.
Client
...
...
@@ -159,14 +159,14 @@ func getClient() *client.Client {
return
auClient
}
func
setRelay
(
m
*
pb
.
Mount
,
relayU
rl
string
)
{
if
relayU
rl
==
""
{
func
setRelay
(
m
*
pb
.
Mount
,
relayU
RL
string
)
{
if
relayU
RL
==
""
{
// Randomly generate source credentials.
m
.
SourceUsername
=
autoradio
.
GenerateUsername
(
m
.
Path
)
m
.
SourcePassword
=
autoradio
.
GeneratePassword
()
}
else
{
// Validate the given relay URL.
u
,
err
:=
url
.
Parse
(
relayU
rl
)
u
,
err
:=
url
.
Parse
(
relayU
RL
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
@@ -213,14 +213,14 @@ func mountExists(name string, c *client.Client) bool {
// Create a new mountpoint.
type
createMountCommand
struct
{
B
aseCommand
b
aseCommand
relay
string
fallback
string
}
func
newCreateMountCommand
()
*
createMountCommand
{
return
&
createMountCommand
{
B
aseCommand
:
B
aseCommand
{
b
aseCommand
:
b
aseCommand
{
UsageLine
:
"create-mount <path>"
,
Short
:
"Create a new mountpoint"
,
Long
:
`
...
...
@@ -273,7 +273,7 @@ func (cmd *createMountCommand) Run(args []string) {
// Create a submount (transcoded stream).
type
createTranscodingMountCommand
struct
{
B
aseCommand
b
aseCommand
sourcePath
string
format
string
...
...
@@ -287,7 +287,7 @@ type createTranscodingMountCommand struct {
func
newCreateTranscodingMountCommand
()
*
createTranscodingMountCommand
{
return
&
createTranscodingMountCommand
{
B
aseCommand
:
B
aseCommand
{
b
aseCommand
:
b
aseCommand
{
UsageLine
:
"create-transcoding-mount <path>"
,
Short
:
"Create a transcoding mount"
,
Long
:
`
...
...
@@ -302,7 +302,7 @@ func (cmd *createTranscodingMountCommand) AddFlags(f *gonutsflag.FlagSet) {
f
.
StringVar
(
&
cmd
.
sourcePath
,
"source"
,
""
,
"Source mountpoint"
)
f
.
StringVar
(
&
cmd
.
format
,
"codec"
,
"mp3"
,
"Encoding format"
)
f
.
Float64Var
(
&
cmd
.
quality
,
"quality"
,
0
,
"Quality (for VBR encoders)"
)
f
.
IntVar
(
&
cmd
.
bitRate
,
"bitrate"
,
32
,
"Bitrate (
k
bps)"
)
f
.
IntVar
(
&
cmd
.
bitRate
,
"bitrate"
,
32
,
"Bitrate (
K
bps)"
)
f
.
IntVar
(
&
cmd
.
sampleRate
,
"samplerate"
,
44100
,
"Sample rate (Hz)"
)
f
.
IntVar
(
&
cmd
.
channels
,
"channels"
,
2
,
"Number of channels"
)
f
.
StringVar
(
&
cmd
.
stereoMode
,
"stereo-mode"
,
"joint_stereo"
,
"Stereo mode for mp3 codec (stereo, joint_stereo)"
)
...
...
@@ -360,7 +360,7 @@ func (cmd *createTranscodingMountCommand) Run(args []string) {
// Edit a mountpoint.
type
editMountCommand
struct
{
B
aseCommand
b
aseCommand
relay
*
stringOptionalValue
fallback
*
stringOptionalValue
transFormat
*
stringOptionalValue
...
...
@@ -376,7 +376,7 @@ var UNSET = "UNSET"
func
newEditMountCommand
()
*
editMountCommand
{
return
&
editMountCommand
{
B
aseCommand
:
B
aseCommand
{
b
aseCommand
:
b
aseCommand
{
UsageLine
:
"edit-mount <path>"
,
Short
:
"Edit an existing mountpoint"
,
Long
:
`
...
...
@@ -406,7 +406,7 @@ func (cmd *editMountCommand) AddFlags(f *gonutsflag.FlagSet) {
f
.
Var
(
cmd
.
transSource
,
"source"
,
"[transcoding] Source mountpoint"
)
f
.
Var
(
cmd
.
transFormat
,
"codec"
,
"[transcoding] Encoding format"
)
f
.
Var
(
cmd
.
transQuality
,
"quality"
,
"[transcoding] Quality (for VBR encoders)"
)
f
.
Var
(
cmd
.
transBitRate
,
"bitrate"
,
"[transcoding] Bitrate (
k
bps)"
)
f
.
Var
(
cmd
.
transBitRate
,
"bitrate"
,
"[transcoding] Bitrate (
K
bps)"
)
f
.
Var
(
cmd
.
transSampleRate
,
"samplerate"
,
"[transcoding] Sample rate (Hz)"
)
f
.
Var
(
cmd
.
transChannels
,
"channels"
,
"[transcoding] Number of channels"
)
f
.
Var
(
cmd
.
transStereoMode
,
"stereo-mode"
,
"[transcoding] Stereo mode for mp3 encoding (stereo, joint_stereo)"
)
...
...
@@ -489,12 +489,12 @@ func (cmd *editMountCommand) Run(args []string) {
// Delete an existing mountpoint.
type
deleteMountCommand
struct
{
B
aseCommand
b
aseCommand
}
func
newDeleteMountCommand
()
*
deleteMountCommand
{
return
&
deleteMountCommand
{
B
aseCommand
{
b
aseCommand
{
UsageLine
:
"delete-mount <path>"
,
Short
:
"Delete a mountpoint"
,
Long
:
`
...
...
@@ -537,12 +537,12 @@ func (cmd *deleteMountCommand) Run(args []string) {
// List known mountpoints.
type
listMountsCommand
struct
{
B
aseCommand
b
aseCommand
}
func
newListMountsCommand
()
*
listMountsCommand
{
return
&
listMountsCommand
{
B
aseCommand
{
b
aseCommand
{
UsageLine
:
"list-mounts"
,
Short
:
"List all configured mountpoints"
,
Long
:
`
...
...
@@ -581,12 +581,12 @@ func (cmd *listMountsCommand) Run(args []string) {
// Show mountpoint information.
type
showMountCommand
struct
{
B
aseCommand
b
aseCommand
}
func
newShowMountCommand
()
*
showMountCommand
{
return
&
showMountCommand
{
B
aseCommand
{
b
aseCommand
{
UsageLine
:
"show-mount <path>"
,
Short
:
"Show mountpoint information"
,
Long
:
`
...
...
@@ -615,12 +615,12 @@ func (cmd *showMountCommand) Run(args []string) {
// Backup mount configuration.
type
backupCommand
struct
{
B
aseCommand
b
aseCommand
}
func
newBackupCommand
()
*
backupCommand
{
return
&
backupCommand
{
B
aseCommand
{
b
aseCommand
{
UsageLine
:
"backup"
,
Short
:
"Backup mount configuration"
,
Long
:
`
...
...
@@ -647,12 +647,12 @@ func (cmd *backupCommand) Run(args []string) {
// Restore mount configuration.
type
restoreCommand
struct
{
B
aseCommand
b
aseCommand
}
func
newRestoreCommand
()
*
restoreCommand
{
return
&
restoreCommand
{
B
aseCommand
{
b
aseCommand
{
UsageLine
:
"restore"
,
Short
:
"Restore mount configuration"
,
Long
:
`
...
...
@@ -685,13 +685,13 @@ var cmdr = &commander.Command{
Short
:
"Manage `autoradio' configuration"
,
}
func
addCommand
(
c
C
ommandInterface
)
{
func
addCommand
(
c
c
ommandInterface
)
{
cmd
:=
c
.
Command
()
cmd
.
Run
=
func
(
unused
*
commander
.
Command
,
args
[]
string
)
error
{
c
.
Run
(
args
)
return
nil
}
if
afc
,
ok
:=
c
.
(
H
asAddFlags
);
ok
{
if
afc
,
ok
:=
c
.
(
h
asAddFlags
);
ok
{
afc
.
AddFlags
(
&
cmd
.
Flag
)
}
cmdr
.
Subcommands
=
append
(
cmdr
.
Subcommands
,
cmd
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment