anacrolix / dms

A UPnP DLNA Digital Media Server that includes basic video transcoding. Tested on a Panasonic Viera television, several Android UPnP apps, and Chromecast.
BSD 3-Clause "New" or "Revised" License
647 stars 97 forks source link

Minor deviceIcon issue #146

Closed stuart-mclaren closed 3 months ago

stuart-mclaren commented 3 months ago

I'm using dms with 8player and it is working really well.

One really minor issue: when using the -deviceIcon option, larger icons can lose resolution.

Eg a 512x512 FreeBSD logo looks like this (note some compression artifacts):

unpatched

A one line change to main.go Changing this:

Bytes:    readIcon(config.DeviceIcon, 48), 

to this

Bytes:    readIcon(config.DeviceIcon, 512), 

removes the artifacts:

patched

I tried adding a 512 icon size in addition to the 48 and 128 sizes, but it looks like 8player always takes the first icon in the list.

It would be nice to have an option to get the 512 icon without artifacts without changing the code.

Obviously the one line change above is a hack, and 8player should probably be selecting 512 from the list when it is available.

But maybe it would be possible to add a command line option to make the use of icons more flexible - to work around quirky clients?

anacrolix commented 3 months ago

It's a great idea

stuart-mclaren commented 3 months ago

Would something like this make sense?

No change in default behaviour:

dms -deviceIcon foo.png

No change, but explicitly advertise 48 and 128

dms -deviceIcon foo.png -deviceIconSizes 48,128

Additionally advertise 256 (should work with well behaved clients)

dms -deviceIcon foo.png -deviceIconSizes 48,128,256

Advertise as 48, 128 but force 48 icon to be resized to 512, force 128 to be resized to 128 [sic] (for less well behaved clients)

dms -deviceIcon foo.png -deviceIconSizes 48,128 -deviceIconForceSizes 512,128

An alternative might be something like:

 -deviceIconSizes 48:512,128:128

The first option might be more consistent with eg allowing setting other things (eg mime type) in the future (-deviceIconMimeTypes ...)

If either of these seem ok, let me know. (I know some Go and could take a shot at implementing it.)

stuart-mclaren commented 3 months ago

https://github.com/anacrolix/dms/pull/147

Went with option 2 in the end.

anacrolix commented 3 months ago

Thanks for the contribution!

stuart-mclaren commented 3 months ago

You're welcome.

Would you be interested in a follow on one liner to replace https://i.imgur.com/qbHilI7.png in the readme with something like this?

dms-screenshot4

anacrolix commented 3 months ago

Could you add to it rather than replacing that old image? I would be interested indeed.