Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
Use go embed for default icon
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Jan 20, 2022
1 parent 884e805 commit 8d29471
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 247 deletions.
242 changes: 0 additions & 242 deletions bindata.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/anacrolix/dms

go 1.12
go 1.16

require (
github.com/anacrolix/ffprobe v1.0.0
Expand Down
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package main

//go:generate go-bindata data/

import (
"bytes"
"encoding/json"
Expand All @@ -22,11 +20,16 @@ import (
"syscall"
"time"

_ "embed"

"github.com/anacrolix/dms/dlna/dms"
"github.com/anacrolix/dms/rrcache"
"github.com/nfnt/resize"
)

//go:embed "data/VGC Sonic.png"
var defaultIcon []byte

type dmsConfig struct {
Path string
IfName string
Expand Down Expand Up @@ -115,7 +118,7 @@ func main() {
ifName := flag.String("ifname", config.IfName, "specific SSDP network interface")
http := flag.String("http", config.Http, "http server port")
friendlyName := flag.String("friendlyName", config.FriendlyName, "server friendly name")
deviceIcon := flag.String("deviceIcon", config.DeviceIcon, "device icon")
deviceIcon := flag.String("deviceIcon", config.DeviceIcon, "device defaultIcon")
logHeaders := flag.Bool("logHeaders", config.LogHeaders, "log HTTP headers")
fFprobeCachePath := flag.String("fFprobeCachePath", config.FFprobeCachePath, "path to FFprobe cache file")
configFilePath := flag.String("config", "", "json configuration file")
Expand Down Expand Up @@ -292,7 +295,7 @@ func (cache *fFprobeCache) save(path string) error {

func getIconReader(path string) (io.ReadCloser, error) {
if path == "" {
return ioutil.NopCloser(bytes.NewReader(MustAsset("data/VGC Sonic.png"))), nil
return ioutil.NopCloser(bytes.NewReader(defaultIcon)), nil
}
return os.Open(path)
}
Expand Down

0 comments on commit 8d29471

Please sign in to comment.