dhrone / Raspdac-Display

An alternate display program for the Raspdac from Audiophonics which uses a Winstar OLED 16x2 display
MIT License
11 stars 9 forks source link

Set screen blank time when switching between artist and title #11

Closed flagone closed 7 years ago

flagone commented 8 years ago

Issue 1

Hi Dhrone, as I posted on the Audiophonics forum, I think it would be good to be able to set a user defined period to blank the screen between the display of the artist and title information (I expect 0.5 or 1 second or so). I expect it would work best if the scrolling stopped for a short period before the screen went blank. Perhaps that could be a user defined setting to go with the length of the screen blank.

Issue 2

I have adjusted your animation speed from .08 to .24. Could this be a user defined option at the front of the script.

Issue 3

Is it possible for the script to have some display options other than artist and title. Ones I have thought about are file type (flac, aac, mp3 etc) together with the bitrate and cpu temperature.

Thanks again for your work on this script.

dhrone commented 8 years ago

Could you clarify issue 2? Are you looking for this to be a configuration option that is outside the source code? In other words, are you asking that I create a config file that I read at start-up?

flagone commented 8 years ago

No I think how you have set up the configuration at the top of the code is fine. It is just to have an option similar to scroll delay which you can set without going down into the code and editing it directly.

Sent from my iPad

On 8 Sep 2016, at 11:28 PM, dhrone notifications@github.com wrote:

Could you clarify issue 2? Are you looking for this to be a configuration option that is outside the source code? In other words, are you asking that I create a config file that I read at start-up?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

dhrone commented 8 years ago

I am almost done with a complete rewrite of the code that determines what to send to the display. It uses a pages metaphor to allow what gets displayed to be much more easily modified. This includes the ability to add a blank page in-between the transition from artist to title. Testing and re-integration into the main branch of the code are next but good progress has been made.

flagone commented 8 years ago

Dhrone, thanks for your efforts. I appreciate it.

On Mon, Sep 12, 2016 at 8:44 PM, dhrone notifications@github.com wrote:

I am almost done with a complete rewrite of the code that determines what to send to the display. It uses a pages metaphor to allow what gets displayed to be much more easily modified. This includes the ability to add a blank page in-between the transition from artist to title. Testing and re-integration into the main branch of the code are next but good progress has been made.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-246311554, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNFqXTeHqcaMT0jVEjipsdizpxHfdks5qpSz-gaJpZM4J3wog .

dhrone commented 8 years ago

Progress has been made. You may want to take a look at the current version in the working branch. Not well tested but should be close to what you are looking for.

flagone commented 7 years ago

I will give it a go but probably won't be before the weekend due to work.

On 19 Sep 2016, at 9:13 AM, dhrone notifications@github.com wrote:

Progress has been made. You may want to take a look at the current version in the working branch. Not well tested but should be close to what you are looking for.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

flagone commented 7 years ago

Got it working. Thanks for your efforts.

Only difficulty was figuring out I had to run sudo pip install pylms

On Mon, Sep 19, 2016 at 10:57 PM, Ben Caldwell bencaldwell@gmail.com wrote:

I will give it a go but probably won't be before the weekend due to work.

On 19 Sep 2016, at 9:13 AM, dhrone notifications@github.com wrote:

Progress has been made. You may want to take a look at the current version in the working branch. Not well tested but should be close to what you are looking for.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-247888455, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNHeuNB4zOwInV2CfwxjqWqcqrDwgks5qrcWsgaJpZM4J3wog .

flagone commented 7 years ago

As a slight complication. When listening to CDs they have a Artist, Album and Title. When listening to webradio there is no Album so it comes up blank. I tried taking the labels off (eg "Album:") but that isn't a perfect solution as it is better to have the labels.

Not sure if the script can tell if there is no variable information in which case it will skip the display?

On Sun, Sep 25, 2016 at 10:02 PM, Ben Caldwell bencaldwell@gmail.com wrote:

Got it working. Thanks for your efforts.

Only difficulty was figuring out I had to run sudo pip install pylms

On Mon, Sep 19, 2016 at 10:57 PM, Ben Caldwell bencaldwell@gmail.com wrote:

I will give it a go but probably won't be before the weekend due to work.

On 19 Sep 2016, at 9:13 AM, dhrone notifications@github.com wrote:

Progress has been made. You may want to take a look at the current version in the working branch. Not well tested but should be close to what you are looking for.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-247888455, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNHeuNB4zOwInV2CfwxjqWqcqrDwgks5qrcWsgaJpZM4J3wog .

dhrone commented 7 years ago

Actually, I just added that logic. You can now set a page to hide when empty. Pull the latest code that I literally just pushed.

flagone commented 7 years ago

Thanks, I will give it a go and report back. Another issue was that when displaying the bitrate it changes quickly from one number to another. I assume that is because of variable bitrate. However, for display purposes, I think just showing the current rate and sticking to it would be better than changing a couple of times every second.

On Sun, Sep 25, 2016 at 11:28 PM, dhrone notifications@github.com wrote:

Actually, I just added that logic. You can now set a page to hide when empty. Pull the latest code that I literally just pushed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-249421883, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNK-7L8559frIZrCFCy3mO5o_hffxks5qtnbmgaJpZM4J3wog .

dhrone commented 7 years ago

I had to do something similar for the temperature and disk space variables. I'm currently only updating those values once every 20 seconds. Would a similar approach work for the bitrate problem? What read frequency would you recommend?

flagone commented 7 years ago

How about 20 seconds or when the track changes whichever comes first.

On 26 Sep 2016, at 11:34 PM, dhrone notifications@github.com wrote:

I had to do something similar for the temperature and disk space variables. I'm currently only updating those values once every 20 seconds. Would a similar approach work for the bitrate problem? What read frequency would you recommend?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

dhrone commented 7 years ago

Ok. I've made the coding changes. It will now only read the bitrate value every 20 seconds unless a page change occurs in which case it immediately refreshes the value. I am not in a position to test the change right now but will load it later today.

Update: During testing I ran into some issues that I did not have time to resolve. I'll try to get a proper fix down in the next few days.

flagone commented 7 years ago

When I try the latest script it starts then closes down and says goodbye. Is that the issue you are resolving?

On Tue, Sep 27, 2016 at 12:57 AM, dhrone notifications@github.com wrote:

Ok. I've made the coding changes. It will now only read the bitrate value every 20 seconds unless a page change occurs in which case it immediately refreshes the value. I am not in a position to test the change right now but will load it later today when I get off work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-249594866, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNOiVEXff3KH3DjaVwT6o1g_hmma-ks5qt91PgaJpZM4J3wog .

dhrone commented 7 years ago

The current version should work but perhaps I missed something. Can I ask you to try a few things things? First, make sure you are running the version that was committed on Sept 27th. Second, run the software using the command line. From the directory that contains the RaspdacDisplay.py file run...

sudo python RaspdacDisplay.py

When the code exits it should show the error message that is causing it to exit. Send that error message to me. Finally, you can revert to the last version that was published on Sept 25th. This is the one with the commit message "Fixed change in alert change logic related to suppression". FYI, when running the code from the command line, you may want to disable the OLED service. You can do this by running the following commend.

sudo systemctl stop oled

You can re-enable the service with...

sudo systemctl start oled

flagone commented 7 years ago

I tried the test script with no modifications and the latest one says starting then goodbye and shuts down. I think there may be an error in it.

On Saturday, 1 October 2016, dhrone notifications@github.com wrote:

The current version should work but perhaps I missed something. Can I ask you to try a few things things? First, make sure you are running the version that was committed on Sept 27th. Second, run the software using the command line. From the directory that contains the RaspdacDisplay.py file run...

sudo python RaspdacDisplay.py

When the code exits it should show the error message that is causing it to exit. Send that error message to me. Finally, you can revert to the last version that was published on Sept 25th. This is the one with the commit message "Fixed change in alert change logic related to suppression". FYI, when running the code from the command line, you may want to disable the OLED service. You can do this by running the following commend.

sudo systemctl stop oled

You can re-enable the service with...

sudo systemctl start oled

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-250773516, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNOPE0Jou8rv7AcUqPGsTj_snW9zEks5qvSlrgaJpZM4J3wog .

flagone commented 7 years ago

I got this message. Hope it helps:

pi@moode:~ $ sudo python RaspDacDisplay.py Traceback (most recent call last): File "RaspDacDisplay.py", line 841, in prev_state = rd.status() File "RaspDacDisplay.py", line 685, in status self.avail = int(self.avail) ValueError: invalid literal for int() with base 10: '208688 86'

On Sat, Oct 1, 2016 at 10:30 AM, Ben Caldwell bencaldwell@gmail.com wrote:

I tried the test script with no modifications and the latest one says starting then goodbye and shuts down. I think there may be an error in it.

On Saturday, 1 October 2016, dhrone notifications@github.com wrote:

The current version should work but perhaps I missed something. Can I ask you to try a few things things? First, make sure you are running the version that was committed on Sept 27th. Second, run the software using the command line. From the directory that contains the RaspdacDisplay.py file run...

sudo python RaspdacDisplay.py

When the code exits it should show the error message that is causing it to exit. Send that error message to me. Finally, you can revert to the last version that was published on Sept 25th. This is the one with the commit message "Fixed change in alert change logic related to suppression". FYI, when running the code from the command line, you may want to disable the OLED service. You can do this by running the following commend.

sudo systemctl stop oled

You can re-enable the service with...

sudo systemctl start oled

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-250773516, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNOPE0Jou8rv7AcUqPGsTj_snW9zEks5qvSlrgaJpZM4J3wog .

dhrone commented 7 years ago

Yes, very useful. Try the current version and see if it fixes the exception. Can you let me know what distribution including version that you are using? FYI, I'm still working the bitrate problem. I'll likely get a fix posted for that later today or tomorrow. Also chasing some bugs in the playlist position logic.

dhrone commented 7 years ago

Latest version posted hopefully resolves the bitrate and playlist position bugs. Code also writes any unhandled exceptions to the log file now. If you're code suddenly exists, you should check the end of your log file to determine what caused the exit.

flagone commented 7 years ago

Thanks, this one is working.

A couple of things that look like bugs:

On Sun, Oct 2, 2016 at 7:11 AM, dhrone notifications@github.com wrote:

Latest version posted hopefully resolves the bitrate and playlist position bugs. Code also writes any unhandled exceptions to the log file now. If you're code suddenly exists, you should check the end of your log file to determine what caused the exit.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-250937884, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNILQDbrkhJqxFMuBqyJdGe3PtfcBks5qvsx7gaJpZM4J3wog .

dhrone commented 7 years ago

Try the latest commit to fix the first issue. MPD doesn't really provide type data but it does provide the sample rate, bits / sample, and channel count. I've used this to fill the type field. FYI, SPOP (the Spotify daemon) does not provide any type information that I've been able to find.

The second is really a preference. The display is only 16 characters wide. If the current song position is greater than 9 and the tracklist length is greater than 9, at least 6 characters are going to be used to display track position and track length.

'10/12 '

Song time and duration takes a total of 11 characters

'00:03/4:43'

So, we are at least one character over what's needed. Options include:

All of that is configurable by modifying the PAGES_Play variable. I've added a new file called "Pages Examples.py" that provides two different PAGES_Play examples. The first is a version that shows the playlist position at the bottom of each page but truncates when the line is too long. The second doesn't show the playlist data on each page but has a dedicated page that shows the playlist information periodically.

flagone commented 7 years ago

How about another option, instead of showing the current time in a track and then how long the track is, just do a countdown of the time in the track. So if it was 5 minutes long it would start at 5:00 and go down to 0:00. That would save a lot of characters on the bottom part of the screen.

Otherwise, I think it is really good.

Sent from my iPad

On 3 Oct 2016, at 1:10 AM, dhrone notifications@github.com wrote:

Try the latest commit to fix the first issue. MPD doesn't really provide type data but it does provide the sample rate, bits / sample, and channel count. I've used this to fill the type field. FYI, SPOP (the Spotify daemon) does not provide any type information that I've been able to find.

The second is really a preference. The display is only 16 characters wide. If the current song position is greater than 9 and the tracklist length is greater than 9, at least 6 characters are going to be used to display track position and track length.

'10/12 '

Song time and duration takes a total of 11 characters

'00:03/4:43'

So, we are at least one character over what's needed. Options include:

Display everything and live with the line getting cropped (current setting) Display everything and scroll Remove at least one of the variables being displayed All of that is configurable by modifying the PAGES_Play variable. I've added a new file called "Pages Examples.py" that provides two different PAGES_Play examples. The first is a version that shows the playlist position at the bottom of each page but truncates when the line is too long. The second doesn't show the playlist data on each page but has a dedicated page that shows the playlist information periodically.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

flagone commented 7 years ago

If you look to implement a track count down option to save space on the bottom line, it may have to default to count up if playing web radio as it doesn't have a fixed track length.

On Monday, 3 October 2016, dhrone notifications@github.com wrote:

Try the latest commit to fix the first issue. MPD doesn't really provide type data but it does provide the sample rate, bits / sample, and channel count. I've used this to fill the type field. FYI, SPOP (the Spotify daemon) does not provide any type information that I've been able to find.

The second is really a preference. The display is only 16 characters wide. If the current song position is greater than 9 and the tracklist length is greater than 9, at least 6 characters are going to be used to display track position and track length.

'10/12 '

Song time and duration takes a total of 11 characters

'00:03/4:43'

So, we are at least one character over what's needed. Options include:

  • Display everything and live with the line getting cropped (current setting)
  • Display everything and scroll
  • Remove at least one of the variables being displayed

All of that is configurable by modifying the PAGES_Play variable. I've added a new file called "Pages Examples.py" that provides two different PAGES_Play examples. The first is a version that shows the playlist position at the bottom of each page but truncates when the line is too long. The second doesn't show the playlist data on each page but has a dedicated page that shows the playlist information periodically.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-250976086, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNJvKQUy5Eo5miZ2hulWbOXZzWdqyks5qv8l3gaJpZM4J3wog .

dhrone commented 7 years ago

Just made the change but can not test until this evening. You now have a new variable named "remaining" that contains a formatted version of the time remaining in the current song (e.g. ##:##). If playing content with no duration (e.g. streaming content), it switches to a count-up timer. To use it, replace the content of all of the bottom lines to reference it instead of position. Example: ''' { 'name':"bottom", 'variables': [ "playlist_display", "position" ], 'format':"{0} {1}", 'justification':"left", 'scroll':False } ''' Should be changed to ''' { 'name':"bottom", 'variables': [ "playlist_display", "remaining" ], 'format':"{0} {1}", 'justification':"left", 'scroll':False } ''' This needs to be done for every page within PAGES_Playing.

flagone commented 7 years ago

Hi Dhrone, I like the latest changes.

It works great with streaming. However, when playing AAC files I get the following error.

2016-10-08 22:21:10,692:INFO:Raspdac display shutting down 2016-10-08 22:21:13,698:ERROR:Uncaught exception Traceback (most recent call last): File "/home/pi/RaspDacDisplay.py", line 968, in cstatus = rd.status() File "/home/pi/RaspDacDisplay.py", line 710, in status status = self.status_mpd() File "/home/pi/RaspDacDisplay.py", line 541, in status_mpd remaining = time.strftime("%M:%S", time.gmtime(int(duration - current))) TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'

I hope this is helpful and you are able to fix it.

On Mon, Oct 3, 2016 at 8:30 PM, dhrone notifications@github.com wrote:

Just made the change but can not test until this evening. You now have a new variable named "remaining" that contains a formatted version of the time remaining in the current song (e.g. ##:##). If playing content with no duration (e.g. streaming content), it switches to a count-up timer. To use it, replace the content of all of the bottom lines to reference it instead of position. Example: ''' { 'name':"bottom", 'variables': [ "playlist_display", "position" ], 'format':"{0} {1}", 'justification':"left", 'scroll':False } ''' Should be changed to ''' { 'name':"bottom", 'variables': [ "playlist_display", "remaining" ], 'format':"{0} {1}", 'justification':"left", 'scroll':False } ''' This needs to be done for every page within PAGES_Playing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-251074739, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNOs5TIRNdUSXTpGWE10hrYFhT4VYks5qwNk6gaJpZM4J3wog .

dhrone commented 7 years ago

Made a quick fix that I am not in a position to test. If you get a chance pull the current version within the working branch and try again.

flagone commented 7 years ago

That seemed to fix it. It is working fine now.

On Sun, Oct 9, 2016 at 6:27 AM, dhrone notifications@github.com wrote:

Made a quick fix that I am not in a position to test. If you get a chance pull the current version within the working branch and try again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhrone/Raspdac-Display/issues/11#issuecomment-252446540, or mute the thread https://github.com/notifications/unsubscribe-auth/AVDMNCM8Q18gX-9POXLAuAR8tvK4m2hIks5qx_yggaJpZM4J3wog .

dhrone commented 7 years ago

Ok. I think the set of issues that was raised at the top of this thread have been successfully resolved so I am closing this issue. Please open up new issues as needed. Thanks!