Skip to content

Commit 27aa41d

Browse files
authored
v24.12.1 update
1 parent fbdaf8e commit 27aa41d

File tree

4 files changed

+68
-33
lines changed

4 files changed

+68
-33
lines changed

code/README.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
Minimal MPD Client - v24.11.1
1+
Minimal MPD Client - v24.12.1
22

33
Check out the offline help under the Help menu. (updated for v24.11.1)
44

5-
v24.11.1
6-
- Changed versioning scheme. I like the year (24.) month (11.) iteration (1) numbering.
7-
- Incorporated a code change based on a recommendation from donburch888. Thanks Don!
8-
- Added an option under the Queue menu to save the current queue to a .m3u file
9-
in the folder of your choice. This helped me get my favorites on my phone.
10-
- I also added the 'requirements.txt' file from my Windows 'venv' to the repo.
5+
v24.12.1
6+
- I finally have a more kind and gentle way of handling things when the selected server is not online.
7+
118

code/cover.png

28.6 KB
Loading

code/mmc4w.py

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from collections import OrderedDict
2626
from pathlib import Path
2727

28+
2829
if sys.platform != "win32":
2930
import subprocess
3031
else:
@@ -33,12 +34,12 @@
3334
ctypes.windll.shcore.SetProcessDpiAwareness(0)
3435
ctypes.windll.user32.SetProcessDPIAware()
3536

36-
version = "v24.11.1"
37+
version = "v24.12.1"
38+
# v24.12.1 - Much improved handling of unresponsive servers.
3739
# v24.11.1 - Save playlist to file. Also shift to different version number scheme.
3840
# v2.1.0 - Gently handle attempting to run with no server. Add 'delete debug log'.
3941
# v2.0.9 - Finally get scale factors working. Renamed menus. Browse help.html.
4042

41-
4243
client = musicpd.MPDClient() # create client object
4344

4445
# confparse is for general use for normal text strings.
@@ -400,14 +401,20 @@ def connext(): ## Checks connection, then connects if necessary.
400401
if err2var == 'Already connected':
401402
cxstat = 1
402403
pass
403-
if 'WinError' in str(err2var) or 'Not connected' in str(err2var):
404-
messagebox.showinfo("Server Down","The server you selected is not responding. Edit mmc4w.ini to ensure the 'lastsrvr' IP address is for a running server.")
405-
cxstat = 0
406-
configurator("Double-check all the IP addresses. OK sends you to edit mmc4w.ini.")
407404
else:
408-
logger.debug("D1| Second level errvar: {}".format(err2var))
409-
cxstat = 0
410-
endWithError("The server you selected is not responding.\nEdit mmc4w.ini to ensure the 'lastsrvr' IP address is for a running server.")
405+
cstat = 0
406+
# if 'WinError' in str(err2var) or 'Not connected' in str(err2var):
407+
# messagebox.showinfo("Server Down","The server you selected is not responding. Edit mmc4w.ini to ensure the 'lastsrvr' IP address is for a running server.")
408+
# cxstat = 0
409+
#configurator("Double-check all the IP addresses. OK sends you to edit mmc4w.ini.")
410+
# else:
411+
# logger.debug("D1| Final terminal error: {}".format(err2var))
412+
# cxstat = 0
413+
# configurator("Double-check all the IP addresses. OK sends you to edit mmc4w.ini.")
414+
415+
#endWithError("The server you selected is not responding.\nEdit mmc4w.ini to ensure the 'lastsrvr' IP address is for a running server.")
416+
#configurator("The server you selected is not responding.\nEdit mmc4w.ini to ensure the 'lastsrvr' IP address is for a running server.")
417+
# messagebox.showinfo("Server Not Responding","Server\n" + serverip + "\nis not responding.\nSelect a different one.")
411418
return cxstat
412419

413420

@@ -950,9 +957,11 @@ def plupdate():
950957
def displaytext1(msg):
951958
text1.delete("1.0", 'end')
952959
text1.insert("1.0", msg)
960+
text1.update()
953961

954962
def displaytext2(msg2):
955963
text1.insert(tk.END, msg2)
964+
text1.update()
956965

957966
def albarttoggle():
958967
global aatgl,artw,aartvar
@@ -1522,26 +1531,40 @@ def SrvrWindow(swaction):
15221531
if swaction == 'output':
15231532
srvrwtitle = "MPD Server Outputs"
15241533
srvrw = TlSbBWin(window, srvrwtitle, tsbinilist)
1534+
15251535
def rtnplsel(ipvar):
1526-
global serverip,firstrun,lastpl
1527-
client.close()
1536+
global serverip,firstrun,lastpl,cxstat
1537+
cxstat = connext()
1538+
if cxstat == 1:
1539+
client.close()
15281540
selection = srvrw.listbx.curselection()[0]
1529-
msg = ipvar
1541+
msg = "Attempting " + iplist[selection]
15301542
displaytext1(msg)
15311543
serverip = iplist[selection]
15321544
confparse.read(mmc4wIni)
1533-
connext()
1534-
confparse.set("serverstats","lastsrvr",serverip)
1535-
with open(mmc4wIni, 'w') as SLcnf:
1536-
confparse.write(SLcnf)
1537-
# srvrw.destroy()
1538-
logger.debug("serverip: {}".format(serverip))
1539-
lastpl = 'Joined Server Queue'
1540-
confparse.set('serverstats','lastsetpl',lastpl)
1541-
with open(mmc4wIni, 'w') as SLcnf:
1542-
confparse.write(SLcnf)
1543-
logger.info('0) Connected to server {}.'.format(serverip))
1544-
getcurrsong()
1545+
currsrvr = confparse.get("serverstats","lastsrvr")
1546+
cxstat = connext()
1547+
# print('cxstat is: {}'.format(cxstat))
1548+
if cxstat == 1:
1549+
srvrw.destroy()
1550+
msg = iplist[selection]
1551+
displaytext1(msg)
1552+
confparse.set("serverstats","lastsrvr",serverip)
1553+
with open(mmc4wIni, 'w') as SLcnf:
1554+
confparse.write(SLcnf)
1555+
logger.debug("serverip: {}".format(serverip))
1556+
lastpl = 'Joined Server Queue'
1557+
confparse.set('serverstats','lastsetpl',lastpl)
1558+
with open(mmc4wIni, 'w') as SLcnf:
1559+
confparse.write(SLcnf)
1560+
logger.info('0) Connected to server {}.'.format(serverip))
1561+
getcurrsong()
1562+
else:
1563+
tried = serverip
1564+
serverip = currsrvr
1565+
srvrw.destroy()
1566+
messagebox.showinfo("Server Not Responding","Server\n" + tried + "\nis not responding.\nSelect a different one.")
1567+
15451568

15461569
def outputtggl(outputvar):
15471570
selection = srvrw.listbx.curselection()[0]
@@ -1899,8 +1922,13 @@ def eo2():
18991922
artw.overrideredirect(True)
19001923
elif firstrun == '0' and tbarini == '1':
19011924
artw.overrideredirect(False)
1902-
getcurrsong()
1903-
getoutputs()
1925+
#cxstat = connext()
1926+
if cxstat == 1:
1927+
getcurrsong()
1928+
getoutputs()
1929+
else:
1930+
messagebox.showinfo("Select a Server", serverip + " is not responding.\nSelect a different one.")
1931+
SrvrWindow('server')
19041932
if abp == '1':
19051933
if buttonvar == 'play':
19061934
browserplayer()

code/requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
altgraph==0.17.4
2+
Markdown==3.7
3+
packaging==24.2
4+
pefile==2023.2.7
5+
pillow==11.0.0
6+
pyinstaller==6.11.1
7+
pyinstaller-hooks-contrib==2024.10
8+
python-musicpd==0.9.1
9+
pywin32-ctypes==0.2.3
10+
setuptools==75.5.0

0 commit comments

Comments
 (0)