Skip to content

Commit

Permalink
application: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Mar 18, 2024
1 parent d64ac1d commit 19bf494
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
10 changes: 0 additions & 10 deletions application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
pb "github.com/vishen/go-chromecast/cast/proto"
"github.com/vishen/go-chromecast/playlists"
"github.com/vishen/go-chromecast/storage"
"gopkg.in/ini.v1"
"path/filepath"
)

Expand Down Expand Up @@ -1427,12 +1426,3 @@ func (a *Application) Transcode(contentType string, command string, args ...stri
a.MediaWait()
return nil
}

// plsIterator is an iterator for playlist-files.
// According to https://en.wikipedia.org/wiki/PLS_(file_format),
// The format is case-sensitive and essentially that of an INI file.
// It has entries on the form File1, Title1 etc.
type plsIterator struct {
count int
playlist *ini.Section
}
33 changes: 0 additions & 33 deletions application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import (
"encoding/json"
"testing"

"fmt"
"path/filepath"

"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/vishen/go-chromecast/application"
"github.com/vishen/go-chromecast/cast"
mockCast "github.com/vishen/go-chromecast/cast/mocks"
pb "github.com/vishen/go-chromecast/cast/proto"
"github.com/vishen/go-chromecast/playlists"
)

var mockAddr = "foo.bar"
Expand Down Expand Up @@ -46,32 +42,3 @@ func TestApplicationStart(t *testing.T) {
app := application.NewApplication(application.WithConnection(conn))
assertions.NoError(app.Start(mockAddr, mockPort))
}

func TestParsePlaylist(t *testing.T) {
var path string
if abs, err := filepath.Abs(filepath.Join("..", "testdata", "indiepop64.pls")); err != nil {
t.Fatal(err)
} else {
path = fmt.Sprintf("file://%v", abs)
}
it, err := playlists.NewIterator(path)
if err != nil {
t.Fatal(err)
}
var wantUrls = []string{
"https://ice4.somafm.com/indiepop-64-aac",
"https://ice2.somafm.com/indiepop-64-aac",
"https://ice1.somafm.com/indiepop-64-aac",
"https://ice6.somafm.com/indiepop-64-aac",
"https://ice5.somafm.com/indiepop-64-aac",
}
for i, want := range wantUrls {
if !it.HasNext() {
t.Fatal("iterator exhausted")
}
have, _ := it.Next()
if have != want {
t.Fatalf("url %d, have %v want %v", i, have, want)
}
}
}

0 comments on commit 19bf494

Please sign in to comment.