Cleaned up some of the code

This commit is contained in:
Kenzie
2021-05-12 23:49:47 +00:00
parent 6bc48c5d90
commit d8adba0a1a

View File

@ -2,7 +2,6 @@
import curses import curses
import os import os
from mpd import MPDClient from mpd import MPDClient
import mpd
import ffmpeg import ffmpeg
import pixcat import pixcat
import time import time
@ -130,7 +129,6 @@ def albumArtWinWidth(height, width):
return height, width return height, width
class Player: class Player:
def __init__(self): def __init__(self):
# Curses initialisation # Curses initialisation
@ -251,10 +249,7 @@ class Player:
if (window_height, window_width) != (self.screen_height, self.screen_width) or force_update: if (window_height, window_width) != (self.screen_height, self.screen_width) or force_update:
if drawPlaylist(window_height, window_width) and not self.album_art_only: self.draw_playlist = drawPlaylist(window_height, window_width) and not self.album_art_only
self.draw_playlist = True
else:
self.draw_playlist = False
# Album art window # Album art window
self.art_window_height, self.art_window_width = albumArtWinWidth(window_height, window_width) self.art_window_height, self.art_window_width = albumArtWinWidth(window_height, window_width)
@ -345,13 +340,12 @@ class Player:
externalyx = [(x0, y0), (x1, y1)] externalyx = [(x0, y0), (x1, y1)]
d.rectangle(externalyx, outline=foregroundCol, width=40)# fill=foregroundCol) d.rectangle(externalyx, outline=foregroundCol, width=40)
# d.ellipse(internalxy, fill=backgroundCol)
art.resize((512, 512)) art.resize((512, 512))
art.save(self.album_art_loc, "PNG") art.save(self.album_art_loc, "PNG")
def checkSongUpdate(self): def checkSongUpdate(self):
""" """
Checks if there is a new song playing Checks if there is a new song playing
@ -650,7 +644,6 @@ class Player:
self.cleared = True self.cleared = True
# Figure out center, y_start and x_start # Figure out center, y_start and x_start
center_y, center_x = (self.art_window_height // 2, self.art_window_width // 2)
y_start = top_vspace y_start = top_vspace
x_start = int(lr_margin) x_start = int(lr_margin)
@ -771,6 +764,3 @@ except ConnectionRefusedError:
curses.nocbreak() curses.nocbreak()
curses.endwin() curses.endwin()
print(f"Could not connect to mpd on {MPDHOST}:{MPDPORT}") print(f"Could not connect to mpd on {MPDHOST}:{MPDPORT}")