Prototype Minster Music Software

This Forum is for discussion about the development of the software to control the playing of the music in the Minster Nave and the bells in the Tower.

There will be two programs; both based on the original software but now running on two Pis.
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

Hmmm. I only applied the whitespace fix because that was the only change that I saw when I clicked on your original link. Rather than test your merge, I simply added the fix to minstermusic.py on Music Pi itself. As it happens the same problem existed in html/statusmonitor.py so I fixed that too. That's all I did and it appeared to work; hence my confusion.

When I clicked on your second link I saw the other commits that you had made, which by and large I can understand. What benefit does pointing the MUSIC-C and WEBSERVER IP Address to local host instead of the proper IP Address have? Presumably they map to the same place?

Finally, when I'm happy about your merge request, I presume that I simply click 'Merge'? I presume that the checkbox 'Delete source branch' refers to the branch that contains the merge request, so it will no longer be a branch?
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

When I clicked on your second link I saw the other commits that you had made, which by and large I can understand. What benefit does pointing the MUSIC-C and WEBSERVER IP Address to local host instead of the proper IP Address have? Presumably they map to the same place?
They should do, but I thought that it works as a failsafe in case the IP changes, and makes it immediately clear to the reader that they're running on the same system. If you don't like that change, reverting it shouldn't be a problem.

Yeah, just click Merge, and tick "Delete source branch" - we won't need that any more once the changes are in master.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

OK. Thanks. The rest of your changes appear to be fairly cosmetic, so I'm happy to merge them.

I'm still unsure why the whitespace error caused the connection problem.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

I think it's probably the 127.0.0.1 change that fixed it, or the addition of "HostingSockets". It works for you too then?
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

hamishmb wrote: 03/02/2021, 11:51 I think it's probably the 127.0.0.1 change that fixed it, or the addition of "HostingSockets". It works for you too then?
It works for me, but I'd not done the other fixes; only the whitespace one.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

Well that's strange. If I think of anything I'll let you know.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

Hamish,

I have another plea for help.

As you may have noticed from the LUG List, I've been having a few problems lately. :?

I've slowly been squashing the bugs as they revealed themselves and have managed to get the 'Stop Music' command from the Webserver Control Page working. However, when I try to 'Start Music' again, everything freezes up. I still have some ideas about how to pursue that problem but while I was doing that I realised that I ought to be logging errors if messages between the Pis were corrupted or whatever. I accordingly added an extra test in the message retrieving functions for this but have hit yet another problem. I've pushed the latest versions of each file to GitLab if you have time to look. (There is a string + literal concatenation error in minstermusic.py and I've been focusing on trying to get the code working in minsterbells.py.)

If you look at the check_minstermusic_commands() function in minsterbells.py (this function is called every second by apscheduler()), you will see that I have a bit of debugging code near the top:

Code: Select all

def check_minstermusic_commands():            # Act upon commands from Minster Music Pi
    global socket, Status

    sched.pause_job(job_id='check_minstermusic_commands') # Suspend intil current job is complete

    data = ""

    if socket.has_data():                     # Check for message
        data = socket.read()
        socket.pop()                          # Clear Message Buffer

        print("")                             # For debugging purposes
        print("Contents of data is ")
        print(data)
        print("")

        if "Status" in data:                      # Status request from Music Pi Received
            print("Bells Pi Status Request Received")
            
 etc...            
Then at the bottom of the if ladder I have:

Code: Select all

        else:
            print("Error: Unexpected Message Received from Music Pi: ")
            print(data)
            logger.critical("Error: Unexpected Message Received from Music Pi: ")
            logger.critical(data)
The problem that I have is that the variable 'data' which should be local gets filled with the contents of the message sent to the Music Pi and therefore gets trapped by my else. Since 'data' is supposed to be local and the only other variable that would contain that information is the List called 'Status', I'm assuming that the sockets message buffer retains that from the last time it was sent to the Music software. I have called socket.pop() to try to prevent that, but I can't see what else could be wrong.

I've also attached a copy of the console output when I ran this so you can see why I think what I do.
Attachments
BellsPi_Console_OP.txt
(2.36 KiB) Downloaded 59 times
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

Just letting you know I've seen this. Is this related to the recent query on the LUG?
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

hamishmb wrote: 16/02/2021, 11:29 Just letting you know I've seen this. Is this related to the recent query on the LUG?
Only peripherally. This problem doesn't seem to stop the code working but I'd like to know why there is an apparently erroneous command being sent.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

All right, I'll have a look when I have some time - hopefully soon.
Hamish
Post Reply