Anders-Holst / xled_plus

Addons to the XLED package, to create nice effects for Twinkly LED lights
MIT License
33 stars 8 forks source link

xled_picture - IndexError: tuple index out of range #14

Closed nmonkee closed 11 months ago

nmonkee commented 1 year ago

error: IndexError: tuple index out of range

% python3 -m xled_plus.xled_picture xx.xx.xx.xx gifs/snowman_1.GIF 
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 98, in <module>
    PictureEffect(ctr, file).launch_movie()
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/effect_base.py", line 95, in launch_movie
    self.ctr.show_movie(self.make_movie(self.preferred_frames), self.preferred_fps)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/effect_base.py", line 90, in make_movie
    frames.append(self.getnext())
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 86, in getnext
    return self.ctr.make_layout_pattern(self.get_color, style="square")
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/highcontrol.py", line 737, in make_layout_pattern
    (r, g, b) = func(pos)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 66, in get_color
    int(round((0.5 - pos[1]) * self.yscale + self.ymid)))
IndexError: tuple index out of range

From my own utility / test bed:

def SetAnimation(ip,filename,size,ratio):
  if len(ip) > 1:
    print("[+] uploading file:",filename,"to group:",ip,"with size:",size,"ratio:",ratio)
    ctr = MultiHighControlInterface(ip)
  else:
    print("[+] uploading file:",filename,"to device:",ip[0],"with size:",size,"ratio:",ratio)
    ctr = HighControlInterface(ip[0])
  ctr.adjust_layout_aspect(ratio)
  pic = PictureEffect(ctr, filename, fit=size)
  pic.launch_movie()
[+] uploading file: gifs/snowman_1.GIF to group: ['xx.xx.xx.xx', 'xx.xx.xx.xx', 'xx.xx.xx.xx'] with size: stretch ratio: 5.0
Traceback (most recent call last):
  File "/Users/nmonkee/Desktop/Twinkly/Twinkly.py", line 303, in <module>
    SetAnimation(args.device,args.image,args.aspect,args.ratio)
  File "/Users/nmonkee/Desktop/Twinkly/Twinkly.py", line 186, in SetAnimation
    pic.launch_movie()
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/effect_base.py", line 95, in launch_movie
    self.ctr.show_movie(self.make_movie(self.preferred_frames), self.preferred_fps)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/effect_base.py", line 90, in make_movie
    frames.append(self.getnext())
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 86, in getnext
    return self.ctr.make_layout_pattern(self.get_color, style="square")
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/highcontrol.py", line 737, in make_layout_pattern
    (r, g, b) = func(pos)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 66, in get_color
    int(round((0.5 - pos[1]) * self.yscale + self.ymid)))
 [+] uploading file: gifs/snowman_1.GIF to group: ['xx.xx.xx.xx', 'xx.xx.xx.xx', 'xx.xx.xx.xx'] with size: stretch ratio: 1.0
Traceback (most recent call last):
  File "/Users/nmonkee/Desktop/Twinkly/Twinkly.py", line 303, in <module>
    SetAnimation(args.device,args.image,args.aspect,args.ratio)
  File "/Users/nmonkee/Desktop/Twinkly/Twinkly.py", line 186, in SetAnimation
    pic.launch_movie()
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/effect_base.py", line 95, in launch_movie
    self.ctr.show_movie(self.make_movie(self.preferred_frames), self.preferred_fps)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/effect_base.py", line 90, in make_movie
    frames.append(self.getnext())
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 86, in getnext
    return self.ctr.make_layout_pattern(self.get_color, style="square")
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/highcontrol.py", line 737, in make_layout_pattern
    (r, g, b) = func(pos)
  File "/opt/homebrew/lib/python3.10/site-packages/xled_plus/xled_picture.py", line 66, in get_color
    int(round((0.5 - pos[1]) * self.yscale + self.ymid)))
IndexError: tuple index out of range
Anders-Holst commented 11 months ago

Since long resolved - a layout issue