More > JRiver Media Center 27 for Linux

Quick Start Guide for Installing LCD Matrix on rPi, reading track info

<< < (2/5) > >>

bob:

--- Quote from: bob on March 16, 2021, 09:42:38 am ---I ordered a GeeekPi IIC/I2C 2004 20x4 Character LCD Module Display, really interested in trying this!

--- End quote ---
It's working well for me.
The one concern I have is that the amount of CPU it's using seems a bit high.
Perhaps it's possible that you have a spin-wait condition in your status reading loop where there is no sleep part of the time?
Also, you might want to change the script so it doesn't quit when it can't reach the client temporarily for whatever reason (like someone restarts MC on pi).

All in all, it's a pretty cool addition!

Wheaten:
You can add a time.sleep(0.5), but then the elapsed time will jump with weird jumps. 48, 49, 51, 53, 54,......

bob:
It doesn't appear the GeekPi LCD does utf-8? I'm getting odd looking characters for accented chars (like ä)

Wheaten:
I think you're using Python V2.x. V2 will not automatically encode to UTF-8.
You need to add .encode('utf-8') behind every string, like:
Artist[:LCD_WIDTH].center(LCD_WIDTH," ").encode('utf-8')
Name[:LCD_WIDTH].center(LCD_WIDTH," ").encode('utf-8')

I can't test this as I have my Pi running with Python 3

bob:

--- Quote from: Wheaten on March 24, 2021, 01:12:12 am ---I think you're using Python V2.x. V2 will not automatically encode to UTF-8.
You need to add .encode('utf-8') behind every string, like:
Artist[:LCD_WIDTH].center(LCD_WIDTH," ").encode('utf-8')
Name[:LCD_WIDTH].center(LCD_WIDTH," ").encode('utf-8')

I can't test this as I have my Pi running with Python 3

--- End quote ---
I tried this on a couple of different devices, on my pi4 running python2 and a pi0w running python3 without any luck.
The data from MC is already being sent in utf8 so I'm not sure how encoding it to utf8 again would help.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response Status="OK">
<Item Name="ZoneID">0</Item>
<Item Name="State">2</Item>
<Item Name="FileKey">5247</Item>
<Item Name="NextFileKey">-1</Item>
<Item Name="PositionMS">1056502</Item>
<Item Name="DurationMS">1604307</Item>
<Item Name="ElapsedTimeDisplay">17:36</Item>
<Item Name="RemainingTimeDisplay">-9:08</Item>
<Item Name="TotalTimeDisplay">26:44</Item>
<Item Name="PositionDisplay">17:36 / 26:44</Item>
<Item Name="PlayingNowPosition">0</Item>
<Item Name="PlayingNowTracks">1</Item>
<Item Name="PlayingNowPositionDisplay">1 of 1</Item>
<Item Name="PlayingNowChangeCounter">249</Item>
<Item Name="Bitrate">5644</Item>
<Item Name="Bitdepth">64</Item>
<Item Name="SampleRate">352800</Item>
<Item Name="Channels">2</Item>
<Item Name="Chapter">0</Item>
<Item Name="Volume">1</Item>
<Item Name="VolumeDisplay">100%  (+0.0 dB)</Item>
<Item Name="ImageURL">MCWS/v1/File/GetImage?File=5247</Item>
<Item Name="Artist">Minnesota Orchestra - Osmo Vänskä</Item>
<Item Name="Album">Mahler: Symphony No. 10</Item>
<Item Name="Name">Symphony No.10: I. Adagio. Andante - Adagio</Item>
<Item Name="Status">Playing</Item>
</Response>
 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version