2
0

Player.pm 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package Plugins::SqueezeESP32::Player;
  2. use strict;
  3. use base qw(Slim::Player::SqueezePlay);
  4. use Slim::Utils::Log;
  5. use Slim::Utils::Prefs;
  6. my $prefs = preferences('plugin.squeezeesp32');
  7. my $log = logger('plugin.squeezeesp32');
  8. sub model { 'squeezeesp32' }
  9. sub modelName { 'SqueezeESP32' }
  10. sub hasIR { 0 }
  11. sub init {
  12. my $client = shift;
  13. $client->SUPER::init(@_);
  14. Plugins::SqueezeESP32::Plugin::config_artwork($client);
  15. }
  16. # Allow the player to define it's display width (and probably more)
  17. sub playerSettingsFrame {
  18. my $client = shift;
  19. my $data_ref = shift;
  20. my $value;
  21. my $id = unpack('C', $$data_ref);
  22. # New SETD command 0xfe for display width & height
  23. if ($id == 0xfe) {
  24. $value = (unpack('Cn', $$data_ref))[1];
  25. if ($value > 100 && $value < 400) {
  26. $prefs->client($client)->set('width', $value);
  27. my $height = (unpack('Cnn', $$data_ref))[2];
  28. $prefs->client($client)->set('height', $height || 0);
  29. $client->display->modes($client->display->build_modes);
  30. $client->display->widthOverride(1, $value);
  31. $client->update;
  32. $log->info("Setting player $value" . "x" . "$height for ", $client->name);
  33. }
  34. }
  35. $client->SUPER::playerSettingsFrame($data_ref);
  36. }
  37. sub hasScrolling {
  38. return 1;
  39. }
  40. sub reconnect {
  41. my $client = shift;
  42. $client->pluginData('artwork_md5', '');
  43. $client->SUPER::reconnect(@_);
  44. }
  45. 1;