Skip to content

Commit

Permalink
some code optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiska committed Aug 12, 2019
1 parent 01557ce commit 136d8a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions player.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func (p GenericPlayer) Open(url string) error {
// openPlayer opens a stream using the specified player and port.
func openPlayer(playerName string, port int) {
var player Player
playerName = strings.ToLower(playerName)
for _, genericPlayer := range genericPlayers {
if strings.ToLower(genericPlayer.Name) == playerName {
if strings.EqualFold(genericPlayer.Name, playerName) {
player = genericPlayer
break
}
}
if player == nil {
Expand All @@ -59,9 +59,9 @@ func openPlayer(playerName string, port int) {

// joinPlayerNames returns a list of supported video players ready for display.
func joinPlayerNames() string {
var names []string
for _, player := range genericPlayers {
names = append(names, player.Name)
names := make([]string, len(genericPlayers))
for i := range genericPlayers {
names[i] = genericPlayers[i].Name
}
return strings.Join(names, ", ")
}

0 comments on commit 136d8a9

Please sign in to comment.