diff --git a/MANIFEST.in b/MANIFEST.in index 793f3d2..ee87bcd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include README.md include wiki_music/ui/* -include wiki_music/data/* include wiki_music/files/* global-exclude wiki_music/files/google_api_key.txt global-exclude wiki_music/files/MP3_TAG_PATH.txt +global-exclude wiki_music/data/* diff --git a/code_changelog.md b/code_changelog.md index 8d22fdc..68b85c7 100644 --- a/code_changelog.md +++ b/code_changelog.md @@ -4,7 +4,7 @@ - 0.6a0 - delete do not bother setting when api key or nltk data are manually downloaded - - fix manual google api search key running even if NO selcted + - fix manual google api search key running even if NO selected - fix extraction for endless forms most beautiful - fix as many bugs as possible - make parallel freezing, and package for release @@ -64,7 +64,12 @@ # Change Log -### 21.10.2019 - 0.5a0 +### 24.10.2019 - 0.5a0 +- some changes to lyricsfinder to speed things up +- made test music files a lot smaller, for git push and pull to be faster +- last opened file is now not included in dist wheel + +### 21.10.2019 - finnished and tested new implementation of parser - GUI comunication, it is a lot cleaner and less error prone - SharedVars class ha been simplified a lot diff --git a/docs/instalation.rst b/docs/instalation.rst index 913fa65..e1ffa8b 100644 --- a/docs/instalation.rst +++ b/docs/instalation.rst @@ -123,13 +123,14 @@ for your python version, install it by: pip install .whl Other than that you can use `UPX `_ to compress the app -to a smaller size. It prooves to be quite effective reducing app size.. +to a smaller size. It proves to be quite effective reducing app size. If you want to use it go to the provided link and download apropriate version for your system. Then unpack it in upx folder under wiki_music/freeze. .. warning:: This is not recomended in debugging stage as it adds another layer of - complexity. + complexity. UPX compression is still under development, for instance it + messes some GUI elements! Now you are ready to go: @@ -143,9 +144,9 @@ To build the CLI app: python freeze.py cli -When building in virtual env the frozen app should have ~75MB. -With UPX compression and vanilla Numpy ~56MB -With OPENBLAS numpy and UPX compression ~105MB. +When building in virtual env the frozen app should have ~65MB. +With UPX compression and vanilla Numpy ~??MB +With OPENBLAS numpy and UPX compression ~95MB. To build the GUI app: @@ -153,9 +154,9 @@ To build the GUI app: python freeze.py gui -When building in virtual env the frozen app should have ~120MB. -With UPX compression and vanilla Numpy ~75MB -With OPENBLAS numpy and UPX compression ~150MB. +When building in virtual env the frozen app should have ~110MB. +With UPX compression and vanilla Numpy ~??MB +With OPENBLAS numpy and UPX compression ~140MB. This will generate list three directories under setup/ folder: gdist/ cdist/ and build/. Build contains just pyinstaller help files and **(g/c)dist/wiki_music** diff --git a/freeze/freeze.py b/freeze/freeze.py index 1dc95e1..ddc1dae 100644 --- a/freeze/freeze.py +++ b/freeze/freeze.py @@ -66,6 +66,29 @@ def set_loggers(): log.addHandler(fh) +def clear_path(): + if input_parser() == "GUI": + + try: + shutil.rmtree("gdist") + except FileNotFoundError: + pass + except OSError as e: + print(e) + sys.exit() + else: + try: + shutil.rmtree("cdist") + except FileNotFoundError: + pass + except OSError as e: + print(e) + sys.exit() + + +# clear build paths +clear_path() + # setup loggers set_loggers() @@ -101,25 +124,25 @@ def set_loggers(): # common installer options installer_opt = [ - # constnts build options + # ? constnts build options "--clean", "--noconfirm", # "--version-file=", - # debbugging options - "--debug=bootloader", - "--debug=all", - "--debug=noarchive", + # ? debbugging options + # "--debug=bootloader", + # "--debug=all", + #"--debug=noarchive", - # upx options - #"--noupx", + # ? upx options + "--noupx", "--upx-exclude=vcruntime140.dll", "--upx-exclude=msvcp140.dll", "--upx-exclude=qwindows.dll", "--upx-exclude=qwindowsvistastyle.dll", f"--upx-dir={path.join(WORK_DIR, 'upx')}", - # pyinstaller data paths and hooks + # ? pyinstaller data paths and hooks f"--paths={PACKAGE_PATH}", f"--add-data={path.join(PACKAGE_PATH, 'wiki_music', 'files')};files", f"--icon={path.join(PACKAGE_PATH, 'wiki_music', 'files', 'icon.ico')}", @@ -127,7 +150,7 @@ def set_loggers(): "--additional-hooks-dir=hooks", f"--runtime-hook={path.join(WORK_DIR, 'rhooks', 'pyi_rth_nltk.py')}", - # what to build + # ? what to build "--onedir", # "--onefile", "--name=wiki_music", @@ -136,31 +159,15 @@ def set_loggers(): # installer options specific to gui or cli if input_parser() == "GUI": - try: - shutil.rmtree("gdist") - except FileNotFoundError: - pass - except OSError as e: - print(e) - sys.exit() - installer_opt.extend([ "--distpath=gdist", - #"--windowed", + "--windowed", f"--add-data={path.join(PACKAGE_PATH, 'wiki_music', 'data')};data", f"--add-data={path.join(PACKAGE_PATH, 'wiki_music', 'ui')};ui", f"{path.join(PACKAGE_PATH, 'wiki_music', 'app_gui.py')}" ]) else: - try: - shutil.rmtree("cdist") - except FileNotFoundError: - pass - except OSError as e: - print(e) - sys.exit() - installer_opt.extend([ "--distpath=cdist", "--console", diff --git a/freeze/freeze_build.log b/freeze/freeze_build.log index 8063274..87afa21 100644 --- a/freeze/freeze_build.log +++ b/freeze/freeze_build.log @@ -20,23 +20,17 @@ INFO - build_main - running Analysis Analysis-00.toc INFO - bindepend - Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by C:\miniconda\envs\wikimusic37\python.exe INFO - build_main - Caching module hooks... -INFO - build_main - Analyzing C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\wiki_music\app_gui.py +INFO - build_main - Analyzing C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\wiki_music\app_cli.py INFO - analysis - Processing pre-safe import module hook six.moves INFO - analysis - Processing pre-safe import module hook win32com -INFO - analysis - Processing pre-find module path hook distutils -INFO - analysis - Processing pre-find module path hook PyQt5.uic.port_v3 -INFO - analysis - Processing pre-find module path hook PyQt5.uic.port_v2 INFO - analysis - Processing pre-safe import module hook urllib3.packages.six.moves -INFO - analysis - Processing pre-find module path hook site -INFO - hook-site - site: retargeting to fake-dir 'C:\\miniconda\\envs\\wikimusic37\\lib\\site-packages\\PyInstaller\\fake-modules' INFO - build_main - Loading module hooks... INFO - imphook - Loading module hook "hook-appdirs.py"... INFO - imphook - Excluding import 'win32com' INFO - imphook - Removing import of win32com.shell.shell from module appdirs -INFO - imphook - Removing import of win32com.shell from module appdirs INFO - imphook - Removing import of win32com.shell.shellcon from module appdirs +INFO - imphook - Removing import of win32com.shell from module appdirs INFO - imphook - Loading module hook "hook-certifi.py"... -INFO - imphook - Loading module hook "hook-distutils.py"... INFO - imphook - Loading module hook "hook-encodings.py"... INFO - imphook - Loading module hook "hook-lxml.etree.py"... INFO - imphook - Loading module hook "hook-nltk.py"... @@ -44,23 +38,18 @@ INFO - imphook - Loading module hook "hook-numpy.core.py"... INFO - imphook - Loading module hook "hook-numpy.py"... INFO - imphook - Loading module hook "hook-PIL.Image.py"... INFO - imphook - Loading module hook "hook-PIL.py"... -INFO - imphook - Excluding import 'PyQt5' -INFO - imphook - Removing import of PyQt5.QtGui from module PIL.ImageQt -INFO - imphook - Removing import of PyQt5.QtCore from module PIL.ImageQt -INFO - imphook - Import to be excluded not found: 'FixTk' +INFO - imphook - Excluding import 'PySide' +INFO - imphook - Removing import of PySide from module PIL.ImageQt INFO - imphook - Excluding import 'tkinter' INFO - imphook - Removing import of tkinter from module PIL.ImageTk +INFO - imphook - Import to be excluded not found: 'FixTk' INFO - imphook - Excluding import 'PyQt4' -INFO - imphook - Excluding import 'PySide' +INFO - imphook - Removing import of PyQt4 from module PIL.ImageQt +INFO - imphook - Excluding import 'PyQt5' INFO - imphook - Loading module hook "hook-PIL.SpiderImagePlugin.py"... -INFO - imphook - Excluding import 'tkinter' INFO - imphook - Import to be excluded not found: 'FixTk' +INFO - imphook - Excluding import 'tkinter' INFO - imphook - Loading module hook "hook-pydoc.py"... -INFO - imphook - Loading module hook "hook-PyQt5.py"... -INFO - imphook - Loading module hook "hook-PyQt5.QtCore.py"... -INFO - imphook - Loading module hook "hook-PyQt5.QtGui.py"... -INFO - imphook - Loading module hook "hook-PyQt5.QtWidgets.py"... -INFO - imphook - Loading module hook "hook-PyQt5.uic.py"... INFO - imphook - Loading module hook "hook-pythoncom.py"... INFO - imphook - Loading module hook "hook-pywintypes.py"... INFO - imphook - Loading module hook "hook-regex.py"... @@ -75,7 +64,6 @@ INFO - analysis - Analyzing run-time hooks ... INFO - analysis - Including custom run-time hook 'C:\\Users\\Marián Rynik\\OneDrive\\Dokumenty\\Visual Studio 2019\\Projects\\Python\\wiki_music\\freeze\\rhooks\\pyi_rth_nltk.py' INFO - analysis - Including run-time hook 'pyi_rth_certifi.py' INFO - analysis - Including run-time hook 'pyi_rth_nltk.py' -INFO - analysis - Including run-time hook 'pyi_rth_pyqt5.py' INFO - build_main - Looking for dynamic libraries INFO - build_main - Looking for eggs INFO - build_main - Using Python library C:\miniconda\envs\wikimusic37\python37.dll @@ -92,7 +80,7 @@ INFO - datastruct - checking PKG INFO - datastruct - Building PKG because PKG-00.toc is non existent INFO - api - Building PKG (CArchive) PKG-00.pkg INFO - api - Building PKG (CArchive) PKG-00.pkg completed successfully. -INFO - api - Bootloader C:\miniconda\envs\wikimusic37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run_d.exe +INFO - api - Bootloader C:\miniconda\envs\wikimusic37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe INFO - datastruct - checking EXE INFO - datastruct - Building EXE because EXE-00.toc is non existent INFO - api - Building EXE from EXE-00.toc @@ -106,105 +94,4 @@ INFO - api - Building EXE from EXE-00.toc completed successfully. INFO - datastruct - checking COLLECT INFO - datastruct - Building COLLECT because COLLECT-00.toc is non existent INFO - api - Building COLLECT COLLECT-00.toc -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\python37.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-heap-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-stdio-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-math-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-runtime-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-locale-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-convert-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-string-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-environment-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-time-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-process-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-filesystem-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-conio-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\ucrtbase.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-debug-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-profile-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-namedpipe-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-datetime-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-timezone-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-errorhandling-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-sysinfo-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-synch-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-interlocked-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-processthreads-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-memory-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-file-l2-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-processenvironment-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-libraryloader-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-processthreads-l1-1-1.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-rtlsupport-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-util-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-localization-l1-2-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-heap-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-synch-l1-2-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-console-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-handle-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-file-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-file-l1-2-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-core-string-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qwbmp.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qtiff.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qwebp.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qico.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\platformthemes\qxdgdesktopportal.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qtga.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\iconengines\qsvgicon.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\platforms\qwebgl.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qgif.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qjpeg.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\platforms\qoffscreen.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qicns.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\imageformats\qsvg.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qt\plugins\platforms\qminimal.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_elementtree.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_yaml.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_sqlite3.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\win32api.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_ctypes.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\numpy\core\_multiarray_tests.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\numpy\core\_multiarray_umath.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\win32pdh.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\numpy\random\mtrand.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\numpy\fft\fftpack_lite.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\numpy\linalg\_umath_linalg.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\numpy\linalg\lapack_lite.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_decimal.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_queue.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\regex\_regex.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_ssl.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyexpat.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\unicodedata.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_hashlib.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_bz2.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_lzma.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\_socket.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\select.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\lxml\etree.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\lxml\_elementpath.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\levenshtein\_levenshtein.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pil\_webp.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pil\_imagingtk.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pil\_imaging.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qtgui.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qtwidgets.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\sip.cp37-win_amd64.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pyqt5\qtcore.pyd -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5gui.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5core.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5widgets.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\api-ms-win-crt-utility-l1-1-0.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5dbus.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5svg.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5network.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5quick.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5websockets.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\sqlite3.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\pywintypes37.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\libssl-1_1-x64.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\libcrypto-1_1-x64.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\python3.dll -INFO - utils - Executing - C:\Users\Marián Rynik\OneDrive\Dokumenty\Visual Studio 2019\Projects\Python\wiki_music\freeze\upx\upx --lzma -q C:\Users\Marián Rynik\AppData\Roaming\pyinstaller\bincache01_py37_64bit\qt5qml.dll INFO - api - Building COLLECT COLLECT-00.toc completed successfully. diff --git a/setup.py b/setup.py index cab4b00..ab8d8c7 100644 --- a/setup.py +++ b/setup.py @@ -11,8 +11,8 @@ # Read package constants README = (PKG_ROOT / "README.md").read_text() -VERSION = (PKG_ROOT / "wiki_music" / "version.py").read_text() - .split(" = ")[1].replace("\"", "") +VERSION = ((PKG_ROOT / "wiki_music" / "version.py") + .read_text().split(" = ")[1].replace("\"", "")) REQUIREMENTS = (PKG_ROOT / "requirements.txt").read_text().split("\n") diff --git a/tests/test_music/Aventine.flac b/tests/test_music/Aventine.flac index 60bf535..95b0c0c 100644 Binary files a/tests/test_music/Aventine.flac and b/tests/test_music/Aventine.flac differ diff --git a/tests/test_music/Aventine.m4a b/tests/test_music/Aventine.m4a index 287af75..5acf875 100644 Binary files a/tests/test_music/Aventine.m4a and b/tests/test_music/Aventine.m4a differ diff --git a/tests/test_music/Aventine.mp3 b/tests/test_music/Aventine.mp3 index 461dbeb..8f46455 100644 Binary files a/tests/test_music/Aventine.mp3 and b/tests/test_music/Aventine.mp3 differ diff --git a/wiki_music/external_libraries/lyricsfinder/extractor.py b/wiki_music/external_libraries/lyricsfinder/extractor.py index b26abfa..f92f8f3 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractor.py +++ b/wiki_music/external_libraries/lyricsfinder/extractor.py @@ -17,7 +17,6 @@ class LyricsExtractorMount(type): def __init__(cls, name, bases, attrs): """Add base class to list of extractors.""" - if not hasattr(cls, "extractors"): cls.extractors = [] log.debug("Created Extractor Meta Class") @@ -43,7 +42,8 @@ def can_handle(cls, url_data: UrlData) -> bool: return cls.display_url in url_data.url @abc.abstractmethod - def extract_lyrics(self, url_data: UrlData) -> "Lyrics": + def extract_lyrics(self, url_data: UrlData, song: str, artist: str + ) -> "Lyrics": """Return a Lyrics object for the given url, html or bs.""" raise NotImplementedError diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/animelyrics.py b/wiki_music/external_libraries/lyricsfinder/extractors/animelyrics.py index 3240d27..320a283 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/animelyrics.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/animelyrics.py @@ -21,15 +21,16 @@ class Animelyrics(LyricsExtractor): url = "http://www.animelyrics.com/" display_url = "animelyrics.com" - @staticmethod - def extract_lyrics(url_data, song, artist): + @classmethod + def extract_lyrics(cls, url_data, song, artist): """Extract lyrics.""" bs = url_data.bs title = bs.select_one("div ~ h1").string artist = bs.find(text=ARTIST_MATCHER) artist = ARTIST_MATCHER.match(artist).group(1) - lyrics_window = bs.find("table", attrs={"cellspacing": "0", "border": "0"}) + lyrics_window = bs.find("table", attrs={"cellspacing": "0", + "border": "0"}) if lyrics_window: # shit's been translated log.info("these lyrics have been translated... sighs...") @@ -46,7 +47,8 @@ def extract_lyrics(url_data, song, artist): lyrics += p.span.text lyrics = lyrics.strip() else: - raw = requests.get(re.sub(r"\.html?", ".txt", url_data.url), allow_redirects=False) + raw = requests.get(re.sub(r"\.html?", ".txt", url_data.url), + allow_redirects=False) content = raw.text.strip() match = re.search(r"-{10,}(.+?)-{10,}", content, flags=re.DOTALL) if match: diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/azlyrics.py b/wiki_music/external_libraries/lyricsfinder/extractors/azlyrics.py index fdee41a..a1a6270 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/azlyrics.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/azlyrics.py @@ -17,14 +17,17 @@ class AZLyrics(LyricsExtractor): url = "https://www.azlyrics.com/" display_url = "azlyrics.com" - @staticmethod - def extract_lyrics(url_data, song, artist): + @classmethod + def extract_lyrics(cls, url_data, song, artist): """Extract lyrics.""" - url_data.headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0"} + url_data.headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; " + "Win64; x64; rv:59.0) " + "Gecko/20100101 Firefox/59.0"} bs = url_data.bs - center = bs.body.find("div", {"class": "col-xs-12 col-lg-8 text-center"}) - + center = bs.body.find("div", + {"class": "col-xs-12 col-lg-8 text-center"}) + if not center: # 503 Service Temporarily Unavailable if re.search(r"50[0-9]", bs.find("title").text): @@ -40,7 +43,7 @@ def extract_lyrics(url_data, song, artist): url_data.url = tracklist.find("a", text=song.title())["href"] # call method again return AZLyrics.extract_lyrics(url_data, song, artist) - + lyrics = center.find("div", {"class": None}).text lyrics = re.sub(r"
", " ", lyrics) diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/darklyrics.py b/wiki_music/external_libraries/lyricsfinder/extractors/darklyrics.py index 22b17c5..f67c405 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/darklyrics.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/darklyrics.py @@ -18,9 +18,9 @@ class Darklyrics(LyricsExtractor): url = "http://www.darklyrics.com/" display_url = "darklyrics.com" - def extract_lyrics(self, url_data, song, artist): + @classmethod + def extract_lyrics(cls, url_data, song, artist): """Extract lyrics.""" - bs = url_data.bs # get list of album tracks @@ -65,15 +65,16 @@ def extract_lyrics(self, url_data, song, artist): lyrics_div = bs.find('div', class_='lyrics') # split into separate lyrics lyrics = lyrics_div.prettify().split('') - lyric = self.process_lyric(lyrics[song_number]) + lyric = cls.process_lyric(lyrics[song_number]) except Exception as e: log.exception(e) return Lyrics(title, lyric, artist=artist.title(), release_date=release_date) - @staticmethod - def process_lyric(lyric): + @classmethod + def process_lyric(cls, lyric): + """Process and format lyrics.""" lyric = lyric[:lyric.find('

')] # remove tail # Set linebreaks lyric = lyric.replace('
', '') @@ -93,4 +94,3 @@ def process_lyric(lyric): last_line is not ''): result = result + '\n' + line return result.strip() - diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/genius.py b/wiki_music/external_libraries/lyricsfinder/extractors/genius.py index fb588b8..25a8a26 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/genius.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/genius.py @@ -17,8 +17,8 @@ class Genius(LyricsExtractor): url = "https://genius.com/" display_url = "genius.com" - @staticmethod - def extract_lyrics(url_data, song, artist): + @classmethod + def extract_lyrics(cls, url_data, song, artist): """Extract lyrics.""" bs = url_data.bs @@ -40,10 +40,14 @@ def extract_lyrics(url_data, song, artist): lyrics = lyrics_window.text.strip() - title = bs.find("h1", attrs={"class": "header_with_cover_art-primary_info-title"}).text - artist = bs.select_one("a.header_with_cover_art-primary_info-primary_artist").string + title = bs.find("h1", attrs={"class": + "header_with_cover_art-" + "primary_info-title"}).text + artist = bs.select_one( + "a.header_with_cover_art-primary_info-primary_artist").string try: - date_str = bs.find(text="Release Date").parent.find_next_sibling("span").string + date_str = bs.find(text="Release Date") + date_str = date_str.parent.find_next_sibling("span").string except AttributeError: date_str = "January 1, 2000" release_date = datetime.strptime(date_str, "%B %d, %Y") diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/lyrical_nonsense.py b/wiki_music/external_libraries/lyricsfinder/extractors/lyrical_nonsense.py index 6fe50b4..0a850b8 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/lyrical_nonsense.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/lyrical_nonsense.py @@ -17,14 +17,15 @@ class LyricalNonsense(LyricsExtractor): url = "http://www.lyrical-nonsense.com/" display_url = "lyrical-nonsense.com" - @staticmethod - def extract_lyrics(url_data: UrlData, song, artist) -> Lyrics: + @classmethod + def extract_lyrics(cls, url_data: UrlData, song, artist) -> Lyrics: """Extract lyrics.""" bs = url_data.bs title = bs.select_one("div.titletext2new h3").text artist = bs.select_one("div.artisttext1new h2 a").text - lyrics_window = bs.select_one("div#Romaji div.olyrictext") or bs.select_one("div#Lyrics div.olyrictext") + lyrics_window = (bs.select_one("div#Romaji div.olyrictext") or + bs.select_one("div#Lyrics div.olyrictext")) lyrics = utils.clean_lyrics(lyrics_window.text) return Lyrics(title, lyrics, artist=artist) diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/lyricsmode.py b/wiki_music/external_libraries/lyricsfinder/extractors/lyricsmode.py index f8e8641..2fb70fe 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/lyricsmode.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/lyricsmode.py @@ -16,8 +16,8 @@ class Lyricsmode(LyricsExtractor): url = "http://www.lyricsmode.com/" display_url = "lyricsmode.com" - @staticmethod - def extract_lyrics(url_data, song, artist): + @classmethod + def extract_lyrics(cls, url_data, song, artist): """Extract lyrics.""" bs = url_data.bs diff --git a/wiki_music/external_libraries/lyricsfinder/extractors/musixmatch.py b/wiki_music/external_libraries/lyricsfinder/extractors/musixmatch.py index c10fa86..b0091f0 100644 --- a/wiki_music/external_libraries/lyricsfinder/extractors/musixmatch.py +++ b/wiki_music/external_libraries/lyricsfinder/extractors/musixmatch.py @@ -22,17 +22,20 @@ class MusixMatch(LyricsExtractor): url = "https://www.musixmatch.com/" display_url = "musixmatch.com" - @staticmethod - def extract_lyrics(url_data, song, artist): + @classmethod + def extract_lyrics(cls, url_data, song, artist): """Extract lyrics.""" - url_data.headers = {"user-agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"} + url_data.headers = {"user-agent": "Mozilla/5.0 (Windows NT 6.1; " + "WOW64; rv:40.0) Gecko/20100101 " + "Firefox/40.1"} try: url_data.resp.raise_for_status() except HTTPError: raise exceptions.NotAllowedError bs = url_data.bs - if bs.find_all("div", attrs={"class": "mxm-empty-state", "data-reactid": "87"}): + if bs.find_all("div", attrs={"class": "mxm-empty-state", + "data-reactid": "87"}): raise exceptions.NoLyrics lyrics_frame = bs.find_all("div", {"class": "mxm-lyrics"}) @@ -40,7 +43,8 @@ def extract_lyrics(url_data, song, artist): if not lyrics_frame: raise exceptions.NoLyrics - lyrics_window = lyrics_frame[0].find_all("div", {"class": "mxm-lyrics"}) + lyrics_window = lyrics_frame[0].find_all("div", {"class": + "mxm-lyrics"}) if not lyrics_window: raise exceptions.NoLyrics @@ -54,9 +58,11 @@ def extract_lyrics(url_data, song, artist): title = bs.find("h1", attrs={"class": "mxm-track-title__track"}).contents[-1].strip() artist = bs.select_one("a.mxm-track-title__artist").string release_date = None - date_str = bs.select_one("div.mxm-track-footer__album h3.mui-cell__subtitle") + date_str = bs.select_one("div.mxm-track-footer__album " + "h3.mui-cell__subtitle") if date_str: - date_str = ORDINAL_MATCHER.sub(lambda m: m.group(1).zfill(2), date_str.string) + date_str = ORDINAL_MATCHER.sub(lambda m: m.group(1).zfill(2), + date_str.string) release_date = datetime.strptime(date_str, "%b %d %Y") return Lyrics(title, lyrics, artist=artist, release_date=release_date) diff --git a/wiki_music/external_libraries/lyricsfinder/lyrics.py b/wiki_music/external_libraries/lyricsfinder/lyrics.py index dae9211..de77c86 100644 --- a/wiki_music/external_libraries/lyricsfinder/lyrics.py +++ b/wiki_music/external_libraries/lyricsfinder/lyrics.py @@ -27,6 +27,7 @@ class LyricsManager: @classmethod def setup(cls): + """Initialize class.""" log.debug("setting up") # ! dissabled because of pyinstaller # extractors.load_extractors() @@ -34,18 +35,17 @@ def setup(cls): cls.extractors = LyricsExtractor.extractors log.info("loaded {} extractors".format(len(cls.extractors))) - def extract_lyrics(self, url: str, song: str, artist: str) -> Lyrics: + @classmethod + def extract_lyrics(cls, url: str, song: str, artist: str) -> Lyrics: """Extract lyrics from url.""" log.info("extracting lyrics from url \"{}\"".format(url)) url_data = UrlData(url) - for ext in self.extractors: + for extractor in cls.extractors: - if not ext.can_handle(url_data): + if not extractor.can_handle(url_data): continue - extractor = ext() - - log.debug("using {} for {}".format(ext, url_data)) + log.debug("using {} for {}".format(extractor, url_data)) try: lyrics = extractor.extract_lyrics(url_data, song, artist) @@ -56,8 +56,6 @@ def extract_lyrics(self, url: str, song: str, artist: str) -> Lyrics: log.warning(f"{extractor} couldn't access lyrics at {url}") continue except Exception: - # switch of so it doesn´t clutter console - # when not debugging log.exception(f"Something went wrong when {extractor} " f"handled {url}") continue @@ -68,7 +66,8 @@ def extract_lyrics(self, url: str, song: str, artist: str) -> Lyrics: return lyrics raise exceptions.NoExtractorError(url) - def search_lyrics(self, song: str, album: str, artist: str, *, + @classmethod + def search_lyrics(cls, song: str, album: str, artist: str, *, google_api_key: str) -> Iterator[Lyrics]: """Search the net for lyrics.""" query = artist + " " + song @@ -76,7 +75,8 @@ def search_lyrics(self, song: str, album: str, artist: str, *, log.debug("got {} results fom google search".format(len(results))) - #google search does not return any results sometimes + # google search does not return any results after daily limit + # of 100 searches is exceeded if not results: log.warning("Google custom search returned no results! " "---> Switching to url generation") @@ -86,7 +86,7 @@ def search_lyrics(self, song: str, album: str, artist: str, *, url = result["link"] try: - lyrics = self.extract_lyrics(url, song, artist) + lyrics = cls.extract_lyrics(url, song, artist) except exceptions.NoExtractorError: log.warning("No extractor for url {}".format(url)) continue diff --git a/wiki_music/library/parser/__init__.py b/wiki_music/library/parser/__init__.py index 20edc4c..ae51b13 100644 --- a/wiki_music/library/parser/__init__.py +++ b/wiki_music/library/parser/__init__.py @@ -209,17 +209,12 @@ def _run_wiki_nogui(self): self.get_tracks() # extract personel names - self._log_print(msg_GREEN="Extracting additional personnel") - self.get_personnel() - - # print out additional personnel self._log_print(msg_GREEN="Found aditional personel") + self.get_personnel() if not we_are_frozen(): print(self.personnel_2_str()) # extract writers, composers - self._log_print(msg_GREEN="Extracting composers") - self._log_print(msg_GREEN="Found composers", msg_WHITE="\n".join(flatten_set(self.get_composers())))