diff --git a/music_folder/.tmp/cover.png b/music_folder/.tmp/cover.png index 1b1c8d6..8af8b5d 100644 Binary files a/music_folder/.tmp/cover.png and b/music_folder/.tmp/cover.png differ diff --git a/music_folder/Beautiful World (2021 Remastered).flac b/music_folder/Beautiful World (2021 Remastered).flac new file mode 100644 index 0000000..e245001 Binary files /dev/null and b/music_folder/Beautiful World (2021 Remastered).flac differ diff --git a/music_folder/RADWIMPS - 愛にできることはまだあるかい.mp3 b/music_folder/One Last Kiss.flac similarity index 55% rename from music_folder/RADWIMPS - 愛にできることはまだあるかい.mp3 rename to music_folder/One Last Kiss.flac index a19aca3..510976f 100644 Binary files a/music_folder/RADWIMPS - 愛にできることはまだあるかい.mp3 and b/music_folder/One Last Kiss.flac differ diff --git a/music_folder/RADWIMPS - Is there still anything that love can do? (English Version).flac b/music_folder/RADWIMPS - Is there still anything that love can do? (English Version).flac new file mode 100644 index 0000000..d603267 Binary files /dev/null and b/music_folder/RADWIMPS - Is there still anything that love can do? (English Version).flac differ diff --git a/music_folder/RADWIMPS - Is there still anything that love can do? (English Version).mp3 b/music_folder/RADWIMPS - Is there still anything that love can do? (English Version).mp3 deleted file mode 100644 index f3d519c..0000000 Binary files a/music_folder/RADWIMPS - Is there still anything that love can do? (English Version).mp3 and /dev/null differ diff --git a/music_folder/RADWIMPS - 愛にできることはまだあるかい.flac b/music_folder/RADWIMPS - 愛にできることはまだあるかい.flac new file mode 100644 index 0000000..e88dc90 Binary files /dev/null and b/music_folder/RADWIMPS - 愛にできることはまだあるかい.flac differ diff --git a/music_folder/ヤキモチ.flac b/music_folder/ヤキモチ.flac new file mode 100644 index 0000000..3d670cd Binary files /dev/null and b/music_folder/ヤキモチ.flac differ diff --git a/music_folder/天門 - 想い出は遠くの日々.mp3 b/music_folder/天門 - 想い出は遠くの日々.mp3 deleted file mode 100644 index 8b604de..0000000 Binary files a/music_folder/天門 - 想い出は遠くの日々.mp3 and /dev/null differ diff --git a/music_folder/Anan Ryoko - Refrain.mp3 b/music_folder/桜流し (2021 Remastered).flac similarity index 62% rename from music_folder/Anan Ryoko - Refrain.mp3 rename to music_folder/桜流し (2021 Remastered).flac index b908b16..5814412 100644 Binary files a/music_folder/Anan Ryoko - Refrain.mp3 and b/music_folder/桜流し (2021 Remastered).flac differ diff --git a/music_folder/磯村由纪子 - 風の住む街.mp3 b/music_folder/磯村由纪子 - 風の住む街.mp3 deleted file mode 100644 index 1c1958f..0000000 Binary files a/music_folder/磯村由纪子 - 風の住む街.mp3 and /dev/null differ diff --git a/musicplayer.py b/musicplayer.py index 19791b9..2f0938c 100644 --- a/musicplayer.py +++ b/musicplayer.py @@ -6,6 +6,7 @@ import time from threading import Thread import math from mutagen import File +from mutagen.flac import FLAC, Picture import sys import win32api #from wx.media import MediaCtrl @@ -73,6 +74,8 @@ class MainFrame(wx.Frame): pygame.mixer.init() self.music = pygame.mixer.music self.SONG_FINISHED = pygame.USEREVENT + 1 + + #self.createTimer() if hasattr(sys, "frozen") and getattr(sys, "frozen") == "windows_exe": exeName = win32api.GetModuleFileName(win32api.GetModuleHandle(None)) @@ -182,7 +185,7 @@ class MainFrame(wx.Frame): # 调节音量的按钮 self.volume_slider = wx.Slider(self.play_music_panel, -1, int(self.default_volume*100), 0, 100, pos=(490, 30), size=(-1, 80), style=wx.SL_VERTICAL|wx.SL_INVERSE) - self.volume_slider.SetToolTip(u'音量:%d%%' % self.default_volume) + self.volume_slider.SetToolTip(u'音量:%d%%' % (self.default_volume*100)) self.play_slider = wx.Slider(self.play_music_panel, -1, pos=(550, 55), size=(600, -1)) self.play_slider.SetToolTip(u'播放进度') @@ -266,7 +269,10 @@ class MainFrame(wx.Frame): self.redraw_music_lyric_panel() self.current_music_name = current_music_path.split('\\')[-1] if self.current_music_name.split('.')[-1] == 'mp3': - self.get_music_cover(current_music_path) + self.get_mp3_cover(current_music_path) + self.redraw_music_cover_panel(current_music_path) + elif self.current_music_name.split('.')[-1] == 'flac': + self.get_flac_cover(current_music_path) self.redraw_music_cover_panel(current_music_path) else: self.draw_music_cover_panel() @@ -284,6 +290,7 @@ class MainFrame(wx.Frame): self.play_slider.SetRange(0, int(self.current_music_length)) self.play_slider.Bind(wx.EVT_SLIDER, self.timer) + #self.createTimer() def play_index_music(self, music_index): ''' @@ -425,7 +432,7 @@ class MainFrame(wx.Frame): break time.sleep(1) - def get_music_cover(self, filepath): + def get_mp3_cover(self, filepath): audio = File(filepath) cover = audio.tags['APIC:'].data write_path = filepath.split('\\')[0] + '\.tmp\cover.png' @@ -433,21 +440,42 @@ class MainFrame(wx.Frame): with open(write_path, 'wb') as img: img.write(cover) + def get_flac_cover(self,filepath): + audio = FLAC(filepath) + pics = audio.pictures + write_path = filepath.split('\\')[0] + '\.tmp\cover.png' + for p in pics: + if p.type == 3: # front cover + #print("\nfound front cover") + with open(write_path, "wb") as img: + img.write(p.data) + def update_total_music_time(self): showlength = time.strftime("%M:%S", time.gmtime(int(self.current_music_length))) play_slider_song_len = wx.StaticText(self, -1, showlength, pos=(1200, 628), size=(35, 30)) play_slider_song_len.SetOwnForegroundColour((41, 36, 33)) play_slider_song_len.Refresh() + def updatemusicslider(self): + time = self.music.get_pos() + self.play_slider.SetValue(time) + + def createTimer(self,evt): + self.slider_timer = wx.Timer(self) + self.Bind(wx.EVT_TIMER, self.updatemusicslider,self.slider_timer) + self.slider_timer.Start(100) + #self.text_timer = wx.Timer(self) + #self.Bind(wx.EVT_TIMER, self.onUpdateText,self.text_timer) + def timer(self,evt): obj = evt.GetEventObject() val = obj.GetValue() offset = self.play_slider.GetValue() - print(offset) - # self.music.load(self.current_music_path) - b = self.music.get_pos() + #print(offset) self.music.stop() - self.music.play(loops=1,start=val) + self.music.play(loops=1, start=val) + + ''' def timer(self): global flag if ischanging: