PeteManchester / MediaPlayer

61 stars 20 forks source link

Corruption of app.properties file when using web interface #102

Closed mightyoakbob closed 4 months ago

mightyoakbob commented 1 year ago

Yep, me again. All is well with my builds at the moment except for the web interface. If for example, you adjust the start up volume of the system using the web interface and then save the new settings, it corrupts tha file: app.properties. In particular it removes the setting to the web_server_port and sets web_server_enabled=false sometimes it makes other changes too. I've tried this on various builds, same in each case.

Bob.

mightyoakbob commented 1 year ago

Hi Pete, Sorry you're so busy. Is there anything, anything at all I can do to help move us forward. You have all the knowledge and I have all the time. Bob.

PeteManchester commented 1 year ago

Hi Bob,

Sorry I'm still busy at work, normally it goes quiet at this time of year as companies have freezes on any IT projects, but for some reason that hasn't happened this year.

The Repeat button in Lumin is just not right, for some reason it makes a request to both repeat and shuffle and it only toggles that values, it doesn't bother to pass in a boolean value to say if Repeat or Shuffle is enabled or disabled, it just expects you to get the current value and then change to the opposite.

Cheers,

Pete.

mightyoakbob commented 1 year ago

Hi Pete, Season's greetings to you. Sorry you're very busy at this time but I'm happy now I know you still want to sort these issues out when you can. Thanks for all you've done and your return is something to look forward to..

Bob.

PeteManchester commented 1 year ago

Hi Bob,

Happy New Year!!

I've done a bit more work and have attempted to fix the 'Seek' functionality.

As it is now MediaPlayer will send the request to MPD, but from the testing I have done there is a problem on MPD with certain file formats, the Seek seems to work on MPD with MP3 files, but does not work with FLAC. The version of MPD I have is v0.21.5.

This can be recreated by installing mpc on your raspi (apt-get update, apt-get install mpc), then from the command window 'mpc seek ' where is a value in seconds. For FLAC files it aways seems to go back to the beginning.

Maybe because MPD uses FFMPEG and FFMPEG returns that the file is not seekable..

Jan 09 12:31 : ffmpeg: codec 'flac' Jan 09 12:31 : decoder: audio_format=44100:16:2, seekable=false

The new vesion of MediaPlayer is here:

https://github.com/PeteManchester/MediaPlayer/tree/master/com.upnp.mediaplayer/download/beta

For the Repeat/Shuffle problem, Lumin is just seems wrong for a number of reasons: It uses the wrong request, it seems to use the request to get the value of the repeat/shuffle rather then setting the value. it always sends a 'Shuffle' request when sending a 'Repeat' request,

I'm not sure I can fix that without having to bodge the code. In DeviceSpy can you subscribe to the PlayList Provider and Transport Provider for your Linn and then use Lumin to toggle repeat on and off and see what events you get.

The Previous button now seems to work, not sure if Lumin have fixed it on their side.

mightyoakbob commented 1 year ago

Hi Pete, Happy New Year to you and thanks for all the work you do.

Right I've gone for giving you information first. I've tried to get the repeat button events you asked for. please see attached and don't be afraid to tell me I've got it wrong again. :-) Lumin-repeat-key.zip I'll be building the beta version next..

Cheers,

Bob.

mightyoakbob commented 1 year ago

Hi Pete,

I'm running the new beta V0.0.1.5_beta2 Incidentally, is there anywhere easy to get at where that version number can be found without building a system. The only place I've seen it is on the web interface.

Some very good news and some not so good news.

Very good is that Lumin and the new Mediaplayer, 'seek' works fine on flac. Ive tried it at both CD quality and at 192K/24 and both work very well. You can move backwards and forwards within a track it didn't fail once in testing. I don't understand why I have different results to you on this. I'm also confused by your comment that mpd uses ffmpeg, I didn't know that. My mpd version has been the same for many, many months it is 0.22.6. It is the version I've been getting when I issue the command - sudo apt-get install mpd

As you suggested, the repeat and shuffle buttons are still broken but somehow they work fine with the Linnplayer.

The worrying bit is the play/pause button. This now fails on Kazoo and only works sometimes on Lumin, something not good there.

I think you're edging ever closer to cracking this intactable problem.

Thank you.

Cheers,

Bob.

PeteManchester commented 1 year ago

That's wierd, I tested the Pause/Resume for Kazoo and Lumin before I sent it and it worked, just tested again and it's still working for me.

Can you try a reboot and if it's still a problem can you send the mediaplayer.log ( with the log file level set to debug) that covers the period when you are attempting to pause/resume.

mightyoakbob commented 1 year ago

Just rebooted the pi. The play/pause worked fine on both Lumin and Kazoo for about 3 minutes. Then it stopped again, both apps unable to stop the music and both displaying the play triangle. I set the log level to debug and rebooted. Of course, now it just will not fail and then it did.. Had a period again where neither app worked for play/pause. Hope you can spot it, it's just after I changed to The alan P project.

Cheers,

Bob.

logfile.zip

mightyoakbob commented 1 year ago

Hi Pete, I've been doing more Lumin testing. I'm starting to think that the pause/play problems I saw were in fact due to using both Kazoo and Lumin at the same time. I've been using Lumin alone for a while and it seems much more stable on that play/pause button.

I am able to move backwards and forwards within a track which I think is called "seek". Next track and last track buttons seem fine.

Did you manage to get anything useful from the data I sent to you showing what signals the Linn gets for the repeat and shuffle buttons? Can I provide anything else to help with that?

So close now to having this fixed. Thanks for all you've done.

I'm trying to better document my copies of mediaplayer I've downloaded. I've been trying to find a way to get the version number without having to build a system. After a long search I have managed to find a file that contains the version number. I found it in the mediaplayer.jar file that when decompressed I opened to: /org/rpi/config/Config.class. In that file at offset 0x14B8. Is there anywhere easier to navigate to?

Cheers,

Bob.

mightyoakbob commented 1 year ago

Hi Pete,

Sorry Pete, there is a problem with Play/Pause certainly on Lumin.

Using it this morming it was great for a good time and then it happened. The track "I drove all night" was playing and all I had was a play triangle and no way to pause the music. This was not anything to do with Kazoo I'd been entirely on Lumin.

I then fired up a PC and tried Kazoo from that but it too was in the same situation. I presume that the player tells the control point software if it should display the double bar pause or the triangle play icon. If so, then it's getting mixed up and sending the play icon when it's already playing.

I've attached a log file but its only near the end where the problem happaned.

mediaplayer-log2.zip

Cheers,

Bob.

mightyoakbob commented 1 year ago

Hi Pete, Did you manage to look at the logs you asked for, it's over a month now?

Bob.

PeteManchester commented 1 year ago

Hi Bob,

Sorry, it's still mad at work, I've been working this weekend..

I had a look at the log files but didn't see anything strange.

The MediaPlayer doesn't tell Kazoo/Lumin which buttons to display, instead the Control Points register for events, and MediaPlayer sends events when there are changes to the status, the control point then uses its own logic to decide which buttons to display/enable/disable.

Is it just on this latest release that it does it, I haven't yet managed to recreate it on mine which are running the latest version.

Cheers,

Pete.

On Sun, 12 Feb 2023 at 14:50, mightyoakbob @.***> wrote:

Hi Pete, Did you manage to look at the logs you asked for, it's over a month now?

Bob.

— Reply to this email directly, view it on GitHub https://github.com/PeteManchester/MediaPlayer/issues/102#issuecomment-1427052374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5RVJ5B5XJ5AIRXHHKVPK3WXD2D7ANCNFSM6AAAAAARP63XUI . You are receiving this because you commented.Message ID: @.***>

mightyoakbob commented 1 year ago

Hi Pete, I'm sorry you're so pushed at work.

I had an idea this morning, always dangerous. In addition to a Linn Player and Pi players I also have a couple of Sonos speakers. I wouldn't recommend them for a number of reasons but they're here to play with. Sonos will not play hi-res music directly but there is some software "BubbleUPnP" which runs on the NAS and in conjunction with ffmpeg can make a Sonos speaker appear as an open home player and it will even play hi-res. I think BubbleUPnP creates a virtual player which interacts with the control points and then passes the translated commands to the sonos. Surprisingly, it works and this morning I tried it again with both Kazoo and Lumin and both work fine, even including the repeat and shuffle function buttons. So this must be fixable!

I also tried Lumin again with v1.4 of mediaplayer. I knew not much would work, I didn't expect it to but again I had the wrong button available, I got play and I wanted pause.

Is there anything I can do to help any further?

Hope your work load calms down soon, just glad you haven't walked away, I feared you might have..

Cheers,

Bob.

PeteManchester commented 1 year ago

Thanks Bob,

If Lumin works with BubbleUPnP then that gives me an idea, when I get time I can install BubbleUPnP and look at how that works, to see if that gives me any ideas of what needs to be done.

mightyoakbob commented 1 year ago

Hi Pete, Yes Lumin does seem happy with BubbleUPnP. Linn have just announced that they are going to retire Kazoo and remove it from the app store, so Lumin is really needed now.

PeteManchester commented 1 year ago

Hi Bob,

Have Linn said if they are going to replace Kazoo with anything else?

I've done a bit of work trying to fix the repeat, shuffle and also the player status (playing, paused etc..).

The new version is in the beta folder, please can you test and let me know how it is.

Thanks,

Pete.

mightyoakbob commented 1 year ago

Hi Pete, I built this last night when we got home and have been doing some testing this morning. I'm almost at the point of saying you've cracked this. The repeat and shuffle buttons work perfectly now as does the "in track seek". The next and previous button also work fine. The pause/play button is my one area of question. Last night I did get the wrong icon just once but it was when I first switched to Lumin from Kazoo. It could be a case that things get confused when using two different control points. More testing needed and I intend to test more over the weekend.

Linn are dropping Kazoo, they say you can carry on using it but it will be withdrawn from the App Store. The app we're supposed to use is simply called "Linn" now.

As you've cracked the shuffle/repeat issue I guess a penny must have dropped somewhere, may I ask what was it?

Thanks Pete for all the work.

Bob.

mightyoakbob commented 1 year ago

Hi Pete, After a considerble amount of testing it seems that using Lumin 8.5.1 ...

The shuffle and repeat buttons are fixed, they work great.

Intermttently, the Play/Pause button still has an issue with the button offered being wrong for the situation. You can spend some time tapping the button and all is well and then suddenly the issue pops up. Once that's happened it's very difficult to clear the issue and if you do clear it, it will trigger again almost immediately. Probably not correct but it seems to fail more often playing the second track of the queue. I'll continue to test to see if I can find a magic sequence to trigger this.

I'll mention another issue but I think this is a Lumin issue not anything for you. The time counter will stop but the music continues. Oddly, you can still move backwards and forwards within the track using the slider but the time does not start working again. At the same time, the bits per second read out also stops. Recovery for this is closing the iPad smart cover and reopening it. Bit rate and time count start to work again. As I say, I think that's Lumin.

Could I ask you to have another look at Play/Pause please? I would appreciate that if you would.

Thanks again for great work.

Bob.

PeteManchester commented 1 year ago

Hi Bob,

Thanks for testing...

For the Play/Pause button, when you get this problem in Lumin, if you open Kazoo does that have the same problem?

One thing to try is when you have the problem in Lumin if you use Device Spy and then if you subscribe for the PlayList and Transport provider, do you see TransportState events when the track changes etc, you should see an event on both providers.

I'm wondering if somehow Lumin is losing it's subscription to one/both of the providers and so no longer receives the TransportState events it needs to maintain the correct status for the Play/Pause buttons.

That could also explain why the time counter stops, if Lumin loses it's subscription for the Time provider..

image

mightyoakbob commented 1 year ago

Hi Pete,

For the Play/Pause button, when you get this problem in Lumin, if you open Kazoo does that have the same problem?

Yes definitely.

One thing to try is when you have the problem in Lumin if you use Device Spy and then if you subscribe for the PlayList and Transport provider, do you see TransportState events when the track changes etc, you should see an event on both providers.

I'll do just that when/if I can reproduce the problem. For some reason it has gone into hiding, I've not seen it for a day or two.

I'm wondering if somehow Lumin is losing it's subscription to one/both of the providers and so no longer receives the TransportState events it needs to maintain the correct status for the Play/Pause buttons.

That could also explain why the time counter stops, if Lumin loses it's subscription for the Time provider..

I understand and it sounds good though I should remind you that the time counter issue can be cleared simply by closing and opening the smart cover but the play/pause cannot.

Thanks for all your work.

Bob.

mightyoakbob commented 1 year ago

Hi Pete, Happy Easter. I'm afraid I don't have much in the way of good news but unfortunately the issues are growing.

All testing here with 1. 5 beta 3.

  1. Using Lumin is still fine except for the play/pause issue which is just on-going and it seems to be the same on Kazoo. I'm going to have another go at getting you more info on this but it's not easy.

  2. Unfortunately, I've noticed that moving the play point within a track (seek?) doesn't work at all with any of the Linn control apps but oddly works fine with Lumin. (With MediaPlayer version 1.4 Linn players were fine but Lumin didn't work). The shuffle play and continuous loop buttons work fine with Lumin and Linn players in 1.5b3 so that bit is cracked I think.

  3. I noticed there is a new OS release Raspberry PI OS Lite, 32 bit, February 21st 2023. Found here.. https://www.raspberrypi.com/software/operating-systems/

To make sure we were still okay I built a system based on this and 1.5beta3 from you. There is a problem in that when you boot up the player for the second time it plays music played before it was last shutdown without being told to and none of the controls work and so you cannot stop it. It matters not if the music got to the end of the playlist or you stopped it before the power down, as soon as it boots up again it will start playing again without controls. Control does return when it has finished. I've rebuilt from scratch twice to make sure I've not made a mistake. It looks to me like some buffer or variable is no longer getting flushed at boot up as it did in previous verions. The version of mpd that gets installed is the same as we've had for a long time 0.22.6. So it's something in the OS.

I'm struggling here, we seem to be going backwards.

Cheers,

Bob.

mightyoakbob commented 1 year ago

Hi Pete, I think I've found a solution for problem 3. This is music playing the moment the pie starts up. This seems to be an MPD thing. There is a setting in /etc/mpd.conf which defaults to #restore_paused "no". Left like this, the music should start again on boot up or at least start up where it left off. This never worked until recent OS versions but for some reason both the February and the May 2023 releases started it working. The fix for me I think is to change the setting to: restore_paused "yes". Music no longer plays at start up.

Pete, it's been many weeks since you last commented, sorry to ask the question but have you had enough of this project?

Cheers,

Bob.

mightyoakbob commented 1 year ago

Pete, Spent ages today trying to get the captures you asked for during a period with the wrong play/pause button displayed. I did manage it I think. The problem was "on" at the start of the capture and at the end.

One thing I hadn't noticed before is that when it happens playing music from a queue, when the next track starts it clears the problem and the correct button is displayed again.

It is also very hard to find a reliable method to trigger the fault but I ound that randomly tapping tracks in the queue and then the pause/play it will trigger before long.

The other remaining problem is the drag within track (seek?) not working with Kazoo and v1.5beta but does work with 1.4. With Lumin the other way around drags work in 1.5b and not in 1.4. That must be fixable surely.

Please respond if only to tell me to naff off.

Thanks.

Bob. DataRequested.zip

PeteManchester commented 1 year ago

Hi Bob,

Sorry, didn't see your Easter post.

As you have found out the music playing at startup is most likely due to MPD rather the MediaPlayer.

I had a look through the log you sent, but I don't see anything obvious, each time the track status changes there are two events being sent, one on the Transport Provider and one on the Playlist provider, I've not many new ideas on how to fix this one.

The Track seek not working on Kazoo should be an easy fix, sounds like Lumin and Kazoo work differently for track seek, just need to handle both of them.

I don't have much time available at the momet, but will have a look when I can..

mightyoakbob commented 1 year ago

Hi Pete, Very good indeed to hear from you, I thought for a while it was game over.

You can forget the music playing at startup it's dealt with and as you say it is fixed in mpd.conf.

The track seek with kazoo and your 1.5b, is the more worrying issue IF you can fix that to work with both apps then we're very nearly there.

The play/pause issue can be lived with annoying though it is.

Thanks for trying to fix it.

BTW, did you ever work for BT back in the day? I did, I worked for them from 1971 to 1993 for some reason I thought you might have.

Thanks again.

Bob.

PeteManchester commented 1 year ago

Hi Bob,

Here is a version that should fix the track seek on Kazoo https://github.com/PeteManchester/MediaPlayer/tree/master/com.upnp.mediaplayer/download/beta

I did work for BT, from 1980 - 1989, small world..

mightyoakbob commented 1 year ago

Hi Pete,

I can confirm that V0.0.1.5beta4 track seek works fine with Lumin, Kazoo and the new Linn app.

Thank you so much. I shall do more extensive testing as I get time but the Play/Pause issue does still persist, I fell over it in seconds when trying your latest beta.

I know that Lumin didn't work at all with V0.0.1.4 but may I remind you, there was no Play/Pause issue at that point. Don't know if that helps, probably not.

I'm building a player for my cousin, she's going to collect it when she gets back from her holidays. She's coming up on 30 June and she lives in darkest monmouthshire and it's a good journey so I only see her once or twice a year. I now have a choice, build with 1.4 and it works fine with just kazoo or 1.5b4 and all control apps work all be it with the Play/Pause niggle.

I spent the last 8 years of my time in BT writing software in assembler to remote control TXE2 an TXK exchanges. Happy days.

Thanks again

Bob.

PeteManchester commented 1 year ago

Hi Bob,

Looking at the difference between v0.0.1.4 and v0.0.1.5 the main differnce is that in v0.0.1.5 I added the Transport Provider, which the thing the latest version of Lumin needed.

I've probably asked you before, but if you just use the Linn Apps (Kazoo or the newer Linn App for Apple) does the problem happen. I haven't yet seen it happen in my environment, but then again I don't normally use Lumin..

Nothing so exciting for me at BT, I was just on Customer Apps, so anything from the top of the pole into the customers house, mostly just renewing old drop wires..

mightyoakbob commented 1 year ago

Hi Pete,

My gut reaction to your question is yes Kazoo also has the same Play/Pause issue. But before rushing to answer your question I did some testing. I found that I was able to trigger the problem with Kazoo but it was reversed. By that I mean I often got the pause icon whilst the music was paused but closing the ipad cover and opening it again cleared the problem. It was as if the ipad was not updating and closing the cover woke it up.

It's not like that with Lumin. Lumin gives you the play button when it's playing and closing the cover does not recover the situation.

Interestingly, I also tried the new Linn App and honestly I was unable to trigger the problem with that app at all.

At least that's what I'm seeing today but I'm sure I've seen Kazoo in the same pickle as Lumin in the past.

I'll test some more over the bank holiday along with decorating the hall and stairs - yuk.

Bob