diff --git a/src/.dockerignore b/src/.dockerignore deleted file mode 100644 index 8b13507..0000000 --- a/src/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -docker-compose.yml -.dockerignore -Dockerfile -Dockerfile.dev \ No newline at end of file diff --git a/src/Dockerfile b/src/Dockerfile deleted file mode 100644 index 5cfde58..0000000 --- a/src/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM python:latest -ADD . /home/sounder -WORKDIR /home/sounder -RUN pip install -r requirements.txt -CMD ["python", "Sounder5.py"] diff --git a/src/Dockerfile.dev b/src/Dockerfile.dev deleted file mode 100644 index 444965c..0000000 --- a/src/Dockerfile.dev +++ /dev/null @@ -1,5 +0,0 @@ -FROM python:latest -ADD . /home/sounder -WORKDIR /home/sounder -RUN pip install -r requirements.txt -CMD ["sh"] diff --git a/src/Resources/Dumps/sounder_dump.txt b/src/Resources/Dumps/sounder_dump.txt index f3c9bb7..411dd84 100644 --- a/src/Resources/Dumps/sounder_dump.txt +++ b/src/Resources/Dumps/sounder_dump.txt @@ -21,3 +21,53 @@ Traceback (most recent call last): File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1720, in mixer_play mixer.music.play(start=start) pygame.error: Position not implemented for music type +ERROR:root:can't multiply sequence by non-int of type 'float' +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1456, in sort_panels + print(song, score, score * "-") +TypeError: can't multiply sequence by non-int of type 'float' +ERROR:root:can't multiply sequence by non-int of type 'float' +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1456, in sort_panels + print(song, score, score * "-") +TypeError: can't multiply sequence by non-int of type 'float' +ERROR:root:can't multiply sequence by non-int of type 'float' +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1456, in sort_panels + print(song, score, score * "-") +TypeError: can't multiply sequence by non-int of type 'float' +ERROR:root:can't multiply sequence by non-int of type 'float' +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1456, in sort_panels + print(song, score, score * "-") +TypeError: can't multiply sequence by non-int of type 'float' +ERROR:root:local variable 'sensitivity' referenced before assignment +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1449, in sort_panels + if score > sensitivity: +UnboundLocalError: local variable 'sensitivity' referenced before assignment +ERROR:root:local variable 'sensitivity' referenced before assignment +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1449, in sort_panels + if score > sensitivity: +UnboundLocalError: local variable 'sensitivity' referenced before assignment +ERROR:root:local variable 'sensitivity' referenced before assignment +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1449, in sort_panels + if score > sensitivity: +UnboundLocalError: local variable 'sensitivity' referenced before assignment +ERROR:root:local variable 'sensitivity' referenced before assignment +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1449, in sort_panels + if score > sensitivity: +UnboundLocalError: local variable 'sensitivity' referenced before assignment +ERROR:root:local variable 'sensitivity' referenced before assignment +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1449, in sort_panels + if score > sensitivity: +UnboundLocalError: local variable 'sensitivity' referenced before assignment +ERROR:root:local variable 'tokens' referenced before assignment +Traceback (most recent call last): + File "e:/Python/New Projects/Sounder5/Sounder5.py", line 1434, in sort_panels + self.settings['search_compensation'] * (tokens - 1)) +UnboundLocalError: local variable 'tokens' referenced before assignment diff --git a/src/Sounder5.py b/src/Sounder5.py index d53b960..4061a59 100644 --- a/src/Sounder5.py +++ b/src/Sounder5.py @@ -28,7 +28,6 @@ from typing import Union import ctypes from time import sleep - from autocorrect import Speller except ImportError as err: exit(err) @@ -124,10 +123,10 @@ def init_notifications(self: Tk) -> None: def init_settings(self: Tk) -> None: try: # variables - default_settings: dict = {'search_correction': True, 'played_percent': 2, 'menu_position': 'left', 'search_compensation': 0.7, 'delete_missing': False, 'follow': 1, 'crossfade': 100, 'shuffle': False, 'start_playback': False, 'playlist': 'Library', 'repeat': 'None', 'buffer': 'Normal', 'last_song': '', + default_settings: dict = {'played_percent': 2, 'menu_position': 'left', 'search_compensation': 0.7, 'delete_missing': False, 'follow': 1, 'crossfade': 100, 'shuffle': False, 'start_playback': False, 'playlist': 'Library', 'repeat': 'None', 'buffer': 'Normal', 'last_song': '', 'volume': 0.5, 'sort_by': 'A-Z', 'scan_subfolders': False, 'geometry': '800x500', 'wheel_acceleration': 1.0, 'updates': True, 'folders': [], 'use_system_theme': True, 'theme': 'Light', 'page': 'Library', 'playlists': {'Favorites': {'Name': 'Favorites', 'Songs': []}}} self.settings: dict = {} - self.version: tuple = ('0.8.7', '270522') + self.version: tuple = ('0.8.8', '300522') # load settings if isfile(r'Resources\\Settings\\Settings.json'): with open(r'Resources\\Settings\\Settings.json', 'r') as data: @@ -334,7 +333,6 @@ def load_icons(self: Tk) -> None: 'navigation': PhotoImage(file=fr'Resources\\Icons\\{self.settings["theme"]}\\navigation.png'), 'passed': PhotoImage(file=fr'Resources\\Icons\\{self.settings["theme"]}\\passed_time.png'), 'bug': PhotoImage(file=fr'Resources\\Icons\\{self.settings["theme"]}\\bug.png'), - 'spell': PhotoImage(file=fr'Resources\\Icons\\{self.settings["theme"]}\\spell.png'), } self.iconbitmap( fr'Resources\\Icons\\{self.settings["theme"]}\\icon.ico') @@ -363,9 +361,6 @@ def init_ui(self: Tk) -> None: # search compensation self.search_compensation: DoubleVar = DoubleVar( value=self.settings['search_compensation']) - # search correction - self.search_correction: BooleanVar = BooleanVar( - value=self.settings['search_correction']) # scan subfolders self.scan_subfolders: BooleanVar = BooleanVar( value=self.settings['scan_subfolders']) @@ -682,28 +677,15 @@ def init_ui(self: Tk) -> None: # search tolerance settings_tolerance: ttk.Frame = ttk.Frame( self.player_content, style='second.TFrame') - tolerance_panel: ttk.Frame = ttk.Frame( - settings_tolerance, style='second.TFrame') - ttk.Label(tolerance_panel, image=self.icons['search'], text='Search spelling compensation', compound='left').pack( - side='left', anchor='center', fill='y') - ttk.Label(tolerance_panel, text='Perfection').pack( - side='right', anchor='center', fill='y', padx=10) - ttk.Scale(tolerance_panel, from_=0.1, to=1, variable=self.search_compensation, - command=self.change_compensation).pack(side='right', anchor='center', fill='x', ipadx=40) - ttk.Label(tolerance_panel, text='Ignore all').pack( - side='right', anchor='center', fill='y', padx=10) - tolerance_panel.pack(side='top', fill='x', pady=10, padx=10) - spell_panel: ttk.Frame = ttk.Frame( - settings_tolerance, style='second.TFrame') - ttk.Label(spell_panel, image=self.icons['spell'], text='Search spelling correction', compound='left').pack( - side='left', anchor='center', fill='y') - ttk.Radiobutton(spell_panel, text='Off', style='second.TRadiobutton', value=False, - variable=self.search_correction, command=self.change_correction).pack(side='right', anchor='center', padx=(0, 10)) - ttk.Radiobutton(spell_panel, text='On', style='second.TRadiobutton', value=True, - variable=self.search_correction, command=self.change_correction).pack(side='right', anchor='center', padx=(0, 10)) - spell_panel.pack(side='top', fill='x', padx=10, pady=(0, 10)) - ttk.Label(settings_tolerance, image=self.icons['info'], text='Note: Sounder will ignore all spelling mistakes if set to lowest (not recomended)!', compound='left').pack( - side='top', fill='x', padx=10, pady=(0, 10)) + + ttk.Label(settings_tolerance, image=self.icons['search'], text='Search spelling compensation', compound='left').pack( + side='left', anchor='center', fill='y', pady=10, padx=(10, 0)) + ttk.Label(settings_tolerance, text='Perfection').pack( + side='right', anchor='center', fill='y', padx=10, pady=10) + ttk.Scale(settings_tolerance, from_=0.4, to=0.8, variable=self.search_compensation, + command=self.change_compensation).pack(side='right', anchor='center', fill='x', ipadx=40, pady=10) + ttk.Label(settings_tolerance, text='Normal').pack( + side='right', anchor='center', fill='y', padx=10, pady=10) # menu positions settings_menu: ttk.Frame = ttk.Frame( self.player_content, style='second.TFrame') @@ -838,7 +820,6 @@ def init_player(self: Tk) -> None: self.after_job: Union[str, None] = None self.songs_queue: list = [] self.offset: float = 0 - self.speller: Speller = Speller() # set last song self.song: str = self.settings['last_song'] # init mixer @@ -1392,9 +1373,6 @@ def change_compensation(self: Tk, _: Event) -> None: self.settings['search_compensation'] = round( self.search_compensation.get(), 1) - def change_correction(self: Tk) -> None: - self.settings['search_correction'] = self.search_correction.get() - def update_thread(self: Tk) -> None: Thread(target=self.check_update, daemon=True).start() @@ -1429,19 +1407,24 @@ def search(self: Tk, _: Event = None) -> None: def sort_panels(self: Tk, search_word: str, songs: list, refresh_panels: bool = False) -> None: try: temp_songs: list = [] + score: float = 0.0 + ratio: float = 2.0 # apply search if search_word: - search_word_length: int = len(search_word) - if self.settings['search_correction']: - search_word = self.speller(search_word) for song in songs: + score = 0.0 + tokens: int = len(self.songs_cache[song]['search_tokens']) + ratio = ( + self.settings['search_compensation'] * (tokens - 1)) for token in self.songs_cache[song]['search_tokens']: if song in temp_songs: continue - if SequenceMatcher(a=token, b=search_word).quick_ratio() >= self.settings['search_compensation']: - temp_songs.append(song) - elif search_word == token[:search_word_length]: - temp_songs.append(song) + if search_word in token or search_word == token: + score += 1.0 + score += SequenceMatcher(a=token, + b=search_word).quick_ratio() + if score >= ratio: + temp_songs.append(song) else: temp_songs = songs.copy() # apply sort diff --git a/src/docker-compose.yml b/src/docker-compose.yml deleted file mode 100644 index 911dc83..0000000 --- a/src/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: "3.9" -services: - sounder: - container_name: sounder - build: . - networks: - - fullstack - volumes: - - .:/home/sounder -networks: - fullstack: - driver: bridge diff --git a/updates/changelog.txt b/updates/changelog.txt index 018afd2..5c6c797 100644 --- a/updates/changelog.txt +++ b/updates/changelog.txt @@ -1,2 +1,3 @@ Changelog: -+Added support for wav files \ No newline at end of file ++Removed old stuff +~Improved search function \ No newline at end of file diff --git a/updates/hash.txt b/updates/hash.txt index f7e464f..ede6306 100644 --- a/updates/hash.txt +++ b/updates/hash.txt @@ -1 +1 @@ -c99eba6f342213c7df2beb79bb8ff1b49141537a9592503e87ce0afd5d0af00d \ No newline at end of file +23d4693e4634f7ea7c0714c6f8d408200cdaa5d19dfd803098967c38ba758d06 \ No newline at end of file diff --git a/updates/package.zip b/updates/package.zip index e47124d..40976dd 100644 Binary files a/updates/package.zip and b/updates/package.zip differ diff --git a/updates/version.txt b/updates/version.txt index 1e9b46b..5c5cbb3 100644 --- a/updates/version.txt +++ b/updates/version.txt @@ -1 +1 @@ -0.8.7 +0.8.8 \ No newline at end of file