Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
DevER-M committed Oct 9, 2024
1 parent d52cc50 commit 101c537
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
pip install pylint
- name: Analysing the code with pylint
run: |
pylint *.py */*.py
pylint $(git ls-files '*.py')
11 changes: 3 additions & 8 deletions mus/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ def __init__(
text_color="#e0e0e0",
)
self.playback_label = ctk.CTkLabel(
self,
text="0:00 / 0:00",
font=("roboto", 12),
fg_color="#121212"
self, text="0:00 / 0:00", font=("roboto", 12), fg_color="#121212"
)

# PLACEMENT
Expand Down Expand Up @@ -130,13 +127,11 @@ def play_previous(self, event=None):
# TRUNCATOR
def set_music_title(self, title, artist):
"""Truncates And Sets Music Title"""

if len(title) > self.title_max_chars:
truncated_title = title[: self.title_max_chars - 3] + "..."
else:
truncated_title = title
self.music_title_label.configure(
text=truncated_title
+ " - "
+ artist.replace("/", ",")
text=truncated_title + " - " + artist.replace("/", ",")
)
40 changes: 20 additions & 20 deletions mus/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ def __init__(self: ctk.CTk, loop=None):
self.attributes("-alpha", 0.4)

# STATE
self.playlist = []
self.STATE = PlayerState.STOPPED
self.playlist = []
self.STATE = PlayerState.STOPPED
self.current_folder = ""
self.playlist_index = 0
self.loop = loop if loop is not None else asyncio.new_event_loop()
self.downloader = spotdl.Downloader(
self.loop = loop if loop is not None else asyncio.new_event_loop()
self.downloader = spotdl.Downloader(
spotdl.DownloaderOptions(threads=4)
)
spotdl.SpotifyClient.init(
Expand All @@ -57,20 +57,20 @@ def __init__(self: ctk.CTk, loop=None):
self.setup_icons()

# FRAMES
self.topbar = TopBar(self)
self.control_bar = ControlBar(self)
self.playlist_frame = PlaylistFrame(self)
self.bottom_frame = BottomFrame(self)
self.topbar = TopBar(self)
self.control_bar = ControlBar(self)
self.playlist_frame = PlaylistFrame(self)
self.bottom_frame = BottomFrame(self)
self.cover_art_frame = CoverArtFrame(self)

# BINDINGS AND EVENTS
self.setup_bindings()

# WIDGET PLACEMENT
self.topbar.pack (side=tk.TOP, fill=tk.X)
self.bottom_frame.pack (side=tk.BOTTOM, fill=tk.X)
self.control_bar.pack (side=tk.BOTTOM, fill=tk.X)
self.playlist_frame.pack (side=tk.RIGHT)
self.topbar.pack(side=tk.TOP, fill=tk.X)
self.bottom_frame.pack(side=tk.BOTTOM, fill=tk.X)
self.control_bar.pack(side=tk.BOTTOM, fill=tk.X)
self.playlist_frame.pack(side=tk.RIGHT)
self.cover_art_frame.pack(side=tk.LEFT, padx=10)

# UPDATE LOOP
Expand Down Expand Up @@ -240,18 +240,18 @@ def check_for_events(self):
self.play_next_song()

def setup_icons(self):
self.play_icon = ctk.CTkImage(Image.open("pic/play_arrow.png"))
self.pause_icon = ctk.CTkImage(Image.open("pic/pause.png"))
self.prev_icon = ctk.CTkImage(Image.open("pic/skip_prev.png"))
self.next_icon = ctk.CTkImage(Image.open("pic/skip_next.png"))
self.play_icon = ctk.CTkImage(Image.open("pic/play_arrow.png"))
self.pause_icon = ctk.CTkImage(Image.open("pic/pause.png"))
self.prev_icon = ctk.CTkImage(Image.open("pic/skip_prev.png"))
self.next_icon = ctk.CTkImage(Image.open("pic/skip_next.png"))
self.folder_icon = ctk.CTkImage(Image.open("pic/folder.png"))
self.music_icon = ctk.CTkImage(Image.open("pic/music.png"))
self.music_icon = ctk.CTkImage(Image.open("pic/music.png"))
logging.info("icons setup")

def setup_bindings(self):
self.bind("<F10>", self.play_next_song)
self.bind("<F8>", self.control_bar.play_previous)
self.bind("<F9>", self.control_bar.play_pause)
self.bind("<F10>", self.play_next_song)
self.bind("<F8>", self.control_bar.play_previous)
self.bind("<F9>", self.control_bar.play_pause)
self.bind("<space>", self.control_bar.play_pause)

def update_loop(self):
Expand Down
24 changes: 12 additions & 12 deletions mus/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ def __init__(self, parent):

self.song_list = tk.Listbox(
self,
borderwidth = 10,
activestyle = "none",
width = 34,
height = 18,
relief = "flat",
bg = "#141414",
fg = "#e0e0e0",
selectbackground = "#3aafa9",
font = ("roboto", 12),
border = 100,
bd = 10,
highlightthickness = 0,
borderwidth=10,
activestyle="none",
width=34,
height=18,
relief="flat",
bg="#141414",
fg="#e0e0e0",
selectbackground="#3aafa9",
font=("roboto", 12),
border=100,
bd=10,
highlightthickness=0,
)
self.song_list.grid(column=0, row=0, sticky="nesw")

Expand Down
1 change: 1 addition & 0 deletions mus/topbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TopBar(ctk.CTkFrame):

def __init__(self, parent):
super().__init__(parent, fg_color="#121212")
self.parent = parent

# WIDGETS
self.open_folder = ctk.CTkButton(
Expand Down

0 comments on commit 101c537

Please sign in to comment.