[
  {
    "path": ".gitignore",
    "content": "venv/*\nvenv-minimal/*\nMISST/__pycache__/*\nMISST/MISST.log\nMISST/config.json\nMISST/separated/*\nMISST/Pretrained/*.th\noutput/*\nBuild/7za.exe"
  },
  {
    "path": "Build/build-CPU.json",
    "content": "{\n \"version\": \"auto-py-to-exe-configuration_v1\",\n \"pyinstallerOptions\": [\n  {\n   \"optionDest\": \"noconfirm\",\n   \"value\": true\n  },\n  {\n   \"optionDest\": \"filenames\",\n   \"value\": \"F:/Repos/MISST/MISST/MISSTapp.py\"\n  },\n  {\n   \"optionDest\": \"onefile\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"console\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"icon_file\",\n   \"value\": \"F:/Repos/MISST/MISST/Assets/icon.ico\"\n  },\n  {\n   \"optionDest\": \"ascii\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"clean_build\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"strip\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"noupx\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"disable_windowed_traceback\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"embed_manifest\",\n   \"value\": true\n  },\n  {\n   \"optionDest\": \"uac_admin\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"uac_uiaccess\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"win_private_assemblies\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"win_no_prefer_redirects\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"bootloader_ignore_signals\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"argv_emulation\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/MISST/Assets;Assets/\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/venv-minimal/Lib/site-packages/customtkinter;customtkinter/\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/MISST/ffmpeg.exe;.\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/MISST/Pretrained;Pretrained/\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/venv-minimal/Lib/site-packages/demucs;demucs/\"\n  }\n ],\n \"nonPyinstallerOptions\": {\n  \"increaseRecursionLimit\": true,\n  \"manualArguments\": \"\"\n }\n}"
  },
  {
    "path": "Build/build-CUDA.json",
    "content": "{\n \"version\": \"auto-py-to-exe-configuration_v1\",\n \"pyinstallerOptions\": [\n  {\n   \"optionDest\": \"noconfirm\",\n   \"value\": true\n  },\n  {\n   \"optionDest\": \"filenames\",\n   \"value\": \"F:/Repos/MISST/MISST/MISSTapp.py\"\n  },\n  {\n   \"optionDest\": \"onefile\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"console\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"icon_file\",\n   \"value\": \"F:/Repos/MISST/MISST/Assets/icon.ico\"\n  },\n  {\n   \"optionDest\": \"ascii\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"clean_build\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"strip\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"noupx\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"disable_windowed_traceback\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"embed_manifest\",\n   \"value\": true\n  },\n  {\n   \"optionDest\": \"uac_admin\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"uac_uiaccess\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"win_private_assemblies\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"win_no_prefer_redirects\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"bootloader_ignore_signals\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"argv_emulation\",\n   \"value\": false\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/MISST/Assets;Assets/\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/venv/Lib/site-packages/customtkinter;customtkinter/\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/MISST/ffmpeg.exe;.\"\n  },\n  {\n   \"optionDest\": \"datas\",\n   \"value\": \"F:/Repos/MISST/MISST/Pretrained;Pretrained/\"\n  },\n  {\n    \"optionDest\": \"datas\",\n    \"value\": \"F:/Repos/MISST/venv/Lib/site-packages/demucs;demucs/\"\n  }\n ],\n \"nonPyinstallerOptions\": {\n  \"increaseRecursionLimit\": true,\n  \"manualArguments\": \"\"\n }\n}"
  },
  {
    "path": "Build/build-INNO.iss",
    "content": "[Setup]\nAppName=MISST\nAppVersion=3.1.0\nAppPublisher=@Frikallo\nAppPublisherURL=https://github.com/Frikallo/MISST\nAppSupportURL=https://github.com/Frikallo/MISST\nAppUpdatesURL=https://github.com/Frikallo/MISST\nDefaultDirName={autopf}\\MISST\nDisableProgramGroupPage=yes\nUninstallDisplayIcon={app}\\MISST.exe\nOutputDir=F:\\Repos\\MISST\\output\nOutputBaseFilename=MISST\nSetupIconFile=F:\\Repos\\MISST\\MISST\\Assets\\icon.ico\nCompression=lzma2\nSolidCompression=yes\nPrivilegesRequired=lowest\nLicenseFile=F:\\Repos\\MISST\\LICENSE\nDisableWelcomePage=no\nWizardStyle=modern\n\n[Languages]\nName: \"english\"; MessagesFile: \"compiler:Default.isl\"\n\n[Tasks]\nName: \"desktopicon\"; Description: \"{cm:CreateDesktopIcon}\"; GroupDescription: \"{cm:AdditionalIcons}\"; Flags: unchecked\n\n[Icons]\nName: \"{autoprograms}\\MISST\"; Filename: \"{app}\\MISST\\MISST.exe\"\nName: \"{autodesktop}\\MISST\"; Filename: \"{app}\\MISST\\MISST.exe\"; Tasks: desktopicon\n\n[Files]\nSource: \"7za.exe\"; DestDir: \"{tmp}\"; DestName: \"7za.exe\"; Flags: deleteafterinstall;\nSource: \"{tmp}\\MISST.7z\"; DestDir: \"{app}\"; Flags: external deleteafterinstall\n\n[Code]\n#IFDEF UNICODE\n  #DEFINE AW \"W\"\n#ELSE\n  #DEFINE AW \"A\"\n#ENDIF\n\nconst\n  WAIT_TIMEOUT = $00000102;\n  SEE_MASK_NOCLOSEPROCESS = $00000040;\n  INFINITE = $FFFFFFFF;     { Infinite timeout }\n\ntype\n  TShellExecuteInfo = record\n    cbSize: DWORD;\n    fMask: Cardinal;\n    Wnd: HWND;\n    lpVerb: string;\n    lpFile: string;\n    lpParameters: string;\n    lpDirectory: string;\n    nShow: Integer;\n    hInstApp: THandle;\n    lpIDList: DWORD;\n    lpClass: string;\n    hkeyClass: THandle;\n    dwHotKey: DWORD;\n    hMonitor: THandle;\n    hProcess: THandle;\n  end;\n\nfunction ShellExecuteEx(var lpExecInfo: TShellExecuteInfo): BOOL;\n  external 'ShellExecuteEx{#AW}@shell32.dll stdcall';\nfunction WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD;\n  external 'WaitForSingleObject@kernel32.dll stdcall';\nfunction CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall';\n\ntype\n  TMsg = record\n    hwnd: HWND;\n    message: UINT;\n    wParam: Longint;\n    lParam: Longint;\n    time: DWORD;\n    pt: TPoint;\n  end;\n\nconst\n  PM_REMOVE = 1;\n\nfunction PeekMessage(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';\nfunction TranslateMessage(const lpMsg: TMsg): BOOL; external 'TranslateMessage@user32.dll stdcall';\nfunction DispatchMessage(const lpMsg: TMsg): Longint; external 'DispatchMessageA@user32.dll stdcall';\n\nprocedure AppProcessMessage;\nvar\n  Msg: TMsg;\nbegin\n  while PeekMessage(Msg, WizardForm.Handle, 0, 0, PM_REMOVE) do begin\n    TranslateMessage(Msg);\n    DispatchMessage(Msg);\n  end;\nend;\n\nprocedure Unzip(source: String; targetdir: String);\nvar\n  unzipTool, unzipParams : String; // path and param for the unzip tool\n  ExecInfo: TShellExecuteInfo;     // info object for ShellExecuteEx()\nbegin\n  // source and targetdir might contain {tmp} or {app} constant, so expand/resolve it to path names\n  source := ExpandConstant(source);\n  targetdir := ExpandConstant(targetdir);\n\n  // prepare 7zip execution\n  unzipTool := ExpandConstant('{tmp}\\7za.exe');\n  ExtractTemporaryFile('7za.exe');\n  unzipParams := ' x \"' + source + '\" -o\"' + targetdir + '\" -y';\n\n  // prepare information about the application being executed by ShellExecuteEx()\n  ExecInfo.cbSize := SizeOf(ExecInfo);\n  ExecInfo.fMask := SEE_MASK_NOCLOSEPROCESS;\n  ExecInfo.Wnd := 0;\n  ExecInfo.lpFile := unzipTool;\n  ExecInfo.lpParameters := unzipParams;\n  ExecInfo.nShow := SW_HIDE;\n\n  if not FileExists(unzipTool) then\n  begin\n    MsgBox('UnzipTool not found: ' + unzipTool, mbError, MB_OK);\n  end\n  else if not FileExists(source) then\n  begin\n    MsgBox('File was not found while trying to unzip: ' + source, mbError, MB_OK);\n  end\n  else\n  begin\n    {\n      The unzip tool is executed via ShellExecuteEx().\n      Then the installer uses a while loop with the condition\n      WaitForSingleObject and a very minimal timeout\n      to execute AppProcessMessage.\n\n      AppProcessMessage is itself a helper function, because\n      Inno Setup does not provide Application.ProcessMessages().\n      Its job is to be the message pump to the Inno Setup GUI.\n\n      This trick makes the window responsive/draggable again,\n      while the extraction is done in the background.\n    }\n    if ShellExecuteEx(ExecInfo) then\n    begin\n      while WaitForSingleObject(ExecInfo.hProcess, 100) = WAIT_TIMEOUT do\n      begin\n        AppProcessMessage;\n        if WizardForm.ProgressGauge.Position = 100 then\n          WizardForm.ProgressGauge.Position := 0\n        else\n          WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Position + 1;\n      end;\n      CloseHandle(ExecInfo.hProcess);\n    end;\n  end;\nend;\n\nvar\n  DownloadPage: TDownloadWizardPage;\n\nfunction OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;\nbegin\n  if Progress = ProgressMax then\n    Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));\n  Result := True;\nend;\n\nprocedure InitializeWizard;\nbegin\n  DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);\nend;\n\nfunction NextButtonClick(CurPageID: Integer): Boolean;\nvar\n  ProgramVersion: string;\n  DownloadURL: string;\n  DownloadFileName: string;\nbegin\n  if CurPageID = wpReady then\n  begin\n    // Prompt the user to select the version of the program\n    ProgramVersion := '';\n    if MsgBox('Do you want to download the CUDA version of MISST 3.1.0?', mbConfirmation, MB_YESNO) = IDYES then\n    begin\n      ProgramVersion := 'cuda';\n    end\n    else\n    begin\n      ProgramVersion := 'cpu';\n    end;\n\n    // Set the download URL and filename based on the selected version\n    if ProgramVersion = 'cuda' then\n    begin\n      DownloadURL := 'https://github.com/Frikallo/MISST/releases/download/V3.1.0/MISST_CUDA_3.1.0_Release_Win.7z';\n      DownloadFileName := 'MISST.7z';\n    end\n    else\n    begin\n      DownloadURL := 'https://github.com/Frikallo/MISST/releases/download/V3.1.0/MISST_CPU_3.1.0_Release_Win.7z';\n      DownloadFileName := 'MISST.7z';\n    end;\n\n    DownloadPage.Clear;\n    DownloadPage.Add(DownloadURL, DownloadFileName, '');\n    DownloadPage.Show;\n\n    try\n      try\n        DownloadPage.Download;\n        Result := True;\n      except\n        SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);\n        Result := False;\n      end;\n    finally\n      DownloadPage.Hide;\n    end;\n  end\n  else\n    Result := True;\nend;\n\nfunction GetFirstSubfolder(Param: String): String;\nvar\n  FindRec: TFindRec;\nbegin\n  Result := '';\n\n  if FindFirst(ExpandConstant('{app}\\*'), FindRec) then\n  begin\n    try\n      while FindNext(FindRec) do\n      begin\n        if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and (FindRec.Name <> '.') and (FindRec.Name <> '..') then\n        begin\n          Result := FindRec.Name;\n          Break;\n        end;\n      end;\n    finally\n      FindClose(FindRec);\n    end;\n  end;\nend;\n\nprocedure CurStepChanged(CurStep: TSetupStep);\nvar\n  ExtractResultCode: Integer;\n  ArchivePath: string;\nbegin\n  if CurStep = ssInstall then\n  begin\n    ArchivePath := ExpandConstant('{tmp}\\MISST.7z');\n    ExtractResultCode := 0;\n\n    if not FileExists(ArchivePath) then\n    begin\n      MsgBox('The MISST.7z archive file is missing.', mbError, MB_OK);\n      WizardForm.Close;\n    end\n    else\n    begin\n      WizardForm.StatusLabel.Caption := 'Extracting...';\n      WizardForm.ProgressGauge.Max := 100; // Set the maximum value for the progress bar\n      WizardForm.ProgressGauge.Position := 0; // Initialize the progress bar position\n\n      Unzip(ArchivePath, ExpandConstant('{app}'));\n      RenameFile(ExpandConstant('{app}\\'+GetFirstSubfolder('')),ExpandConstant('{app}\\MISST'));\n    end;\n  end;\nend;\n\n[Run]\nFilename: \"{app}\\MISST\\MISST.exe\"; Description: \"{cm:LaunchProgram,MISST}\"; Flags: nowait postinstall skipifsilent"
  },
  {
    "path": "Installation Guide - MacOS.md",
    "content": "# How to get started with MISST - MacOS\n\n## **Manual installation on Mac0S using miniconda3**\n\nThis worked for @[CAprogs](https://github.com/CAprogs) on a **MacbookPro 2021 M1 pro**. \n#\n## _**Follow these steps**_\nif you don't have **MINICONDA** , you should install it using this [**link**](https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.pkg).\n\n#\nFor **Pyaudio** package you should install [**Homebrew**](https://github.com/Homebrew/brew/releases/latest) first.\n\nThen run `brew install portaudio` in your **terminal** ( this is required to install **pyaudio** later )\n#\nNow follow these steps 🤓\n- Download the **MISST Zip file** [**here**](https://github.com/Frikallo/MISST/archive/refs/tags/V3.1.0.zip)\n- Create your virtual env using **conda** _(Copy and paste in your Terminal)_\n\nEnter `miniconda3` folder ⬇️\n```\ncd miniconda3\n```\n#\nCreate a `venv` named _**MISSTvenv**_ ⬇️\n```\nconda create --name MISSTvenv\n```\n#\nActivate the  `MISSTvenv` ⬇️\n```\nconda activate MISSTvenv\n```\n#\nInstall `pip` ( inside the MISSTvenv ) ⬇️\n```\nconda install pip\n```\n#\nInstall _**the requirements packages**_ ( inside the MISSTvenv ). \n\nReplace < `path/to/requirements.txt` > with your **path** to the **requirements.txt** file ⬇️\n```\nconda install --file path/to/requirements.txt\n```\n#\nAt this point I encountered some `issues` when installing **packages** with `pip` / `conda`. ( All packages weren't installed )\n#\nBefore proceeding, please ensure that you have `Git` **installed** on your macOS system.\n- In your terminal, enter the following command ⬇️\n```\ngit --version\n```\n1. If you see the **Git version** displayed, it means `Git` is **already installed** on your system, and you can proceed to the next step.\n\n2. If `Git` is **not installed**, you can install it using `Homebrew` ⬇️ ( See the Doumentation [**here**](https://git-scm.com/download/mac) )\n```\nbrew install git\n```\n#\nNow just run the following command ( inside the MISSTvenv ) ⬇️\n```\npip install -r requirements.txt                                 ( GPU )\npip install -r requirements-minimal.txt                         ( CPU )\n```\nIf that doesn't work, try installing the packages one by one ⬇️\n```\npip install customtkinter git+https://github.com/Frikallo/gputil.git@master music_tag psutil PILLOW pypresence lyrics_extractor demucs pyaudio soundfile scipy vcolorpicker\n```\nThen install torch with or without `CUDA` ⬇️\n```\npip install torch==2.0.1+cu117 torchaudio==2.0.2+cu117 torchvision==0.15.2+cu117 -f https://download.pytorch.org/whl/torch_stable.html\n```\n```\npip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2\n```\n\nThen **run** ( inside the MISSTvenv ) ⬇️\n```\nconda install pyqt\n```\n#\n- Enter the `MISSTapp.py` Folder ( replace with the real path )\n```\n cd path/to/MISSTapp.py\n```\n- `Run` the App 🧞‍♂️  ( inside the MISSTvenv )\n\n```\n python MISSTapp.py\n```\n\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "MISST/Assets/Themes/MISST.json",
    "content": "{\n    \"CTk\": {\n      \"fg_color\": [\"gray92\", \"gray14\"]\n    },\n    \"CTkToplevel\": {\n      \"fg_color\": [\"gray92\", \"gray14\"]\n    },\n    \"CTkFrame\": {\n      \"corner_radius\": 6,\n      \"border_width\": 0,\n      \"fg_color\": [\"gray86\", \"gray17\"],\n      \"top_fg_color\": [\"gray81\", \"gray20\"],\n      \"border_color\": [\"gray65\", \"gray28\"]\n    },\n    \"CTkButton\": {\n      \"corner_radius\": 6,\n      \"border_width\": 0,\n      \"fg_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"hover_color\": [\"#36719F\", \"#144870\"],\n      \"border_color\": [\"#3E454A\", \"#949A9F\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray74\", \"gray60\"]\n    },\n    \"CTkLabel\": {\n      \"corner_radius\": 0,\n      \"fg_color\": \"transparent\",\n      \"text_color\": [\"gray10\", \"#DCE4EE\"]\n    },\n    \"CTkEntry\": {\n      \"corner_radius\": 6,\n      \"border_width\": 2,\n      \"fg_color\": [\"#F9F9FA\", \"#343638\"],\n      \"border_color\": [\"#979DA2\", \"#565B5E\"],\n      \"text_color\":[\"gray10\", \"#DCE4EE\"],\n      \"placeholder_text_color\": [\"gray52\", \"gray62\"]\n    },\n    \"CTkCheckbox\": {\n      \"corner_radius\": 6,\n      \"border_width\": 3,\n      \"fg_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"border_color\": [\"#3E454A\", \"#949A9F\"],\n      \"hover_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"checkmark_color\": [\"#DCE4EE\", \"gray90\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray60\", \"gray45\"]\n    },\n    \"CTkSwitch\": {\n      \"corner_radius\": 1000,\n      \"border_width\": 3,\n      \"button_length\": 0,\n      \"fg_Color\": [\"#939BA2\", \"#4A4D50\"],\n      \"progress_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"button_color\": [\"gray36\", \"#D5D9DE\"],\n      \"button_hover_color\": [\"gray20\", \"gray100\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray60\", \"gray45\"]\n    },\n    \"CTkRadiobutton\": {\n      \"corner_radius\": 1000,\n      \"border_width_checked\": 6,\n      \"border_width_unchecked\": 3,\n      \"fg_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"border_color\": [\"#3E454A\", \"#949A9F\"],\n      \"hover_color\": [\"#36719F\", \"#144870\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray60\", \"gray45\"]\n    },\n    \"CTkProgressBar\": {\n      \"corner_radius\": 1000,\n      \"border_width\": 0,\n      \"fg_color\": [\"#939BA2\", \"#4A4D50\"],\n      \"progress_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"border_color\": [\"gray\", \"gray\"]\n    },\n    \"CTkSlider\": {\n      \"corner_radius\": 1000,\n      \"button_corner_radius\": 1000,\n      \"border_width\": 6,\n      \"button_length\": 0,\n      \"fg_color\": [\"#939BA2\", \"#4A4D50\"],\n      \"progress_color\": [\"gray40\", \"#AAB0B5\"],\n      \"button_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"button_hover_color\": [\"#36719F\", \"#144870\"]\n    },\n    \"CTkOptionMenu\": {\n      \"corner_radius\": 6,\n      \"fg_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"button_color\": [\"#36719F\", \"#144870\"],\n      \"button_hover_color\": [\"#27577D\", \"#203A4F\"],\n      \"text_color\": [\"#DCE4EE\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray74\", \"gray60\"]\n    },\n    \"CTkComboBox\": {\n      \"corner_radius\": 6,\n      \"border_width\": 2,\n      \"fg_color\": [\"#F9F9FA\", \"#343638\"],\n      \"border_color\": [\"#979DA2\", \"#565B5E\"],\n      \"button_color\": [\"#979DA2\", \"#565B5E\"],\n      \"button_hover_color\": [\"#6E7174\", \"#7A848D\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray50\", \"gray45\"]\n    },\n    \"CTkScrollbar\": {\n      \"corner_radius\": 1000,\n      \"border_spacing\": 4,\n      \"fg_color\": \"transparent\",\n      \"button_color\": [\"gray55\", \"gray41\"],\n      \"button_hover_color\": [\"gray40\", \"gray53\"]\n    },\n    \"CTkSegmentedButton\": {\n      \"corner_radius\": 6,\n      \"border_width\": 2,\n      \"fg_color\": [\"#979DA2\", \"gray29\"],\n      \"selected_color\": [\"#3B8ED0\", \"#1F6AA5\"],\n      \"selected_hover_color\": [\"#36719F\", \"#144870\"],\n      \"unselected_color\": [\"#979DA2\", \"gray29\"],\n      \"unselected_hover_color\": [\"gray70\", \"gray41\"],\n      \"text_color\": [\"#DCE4EE\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray74\", \"gray60\"]\n    },\n    \"CTkTextbox\": {\n      \"corner_radius\": 6,\n      \"border_width\": 0,\n      \"fg_color\": [\"#F9F9FA\", \"#1D1E1E\"],\n      \"border_color\": [\"#979DA2\", \"#565B5E\"],\n      \"text_color\":[\"gray10\", \"#DCE4EE\"],\n      \"scrollbar_button_color\": [\"gray55\", \"gray41\"],\n      \"scrollbar_button_hover_color\": [\"gray40\", \"gray53\"]\n    },\n    \"CTkScrollableFrame\": {\n      \"label_fg_color\": [\"gray78\", \"gray23\"]\n    },\n    \"DropdownMenu\": {\n      \"fg_color\": [\"gray90\", \"gray20\"],\n      \"hover_color\": [\"gray75\", \"gray28\"],\n      \"text_color\": [\"gray10\", \"gray90\"]\n    },\n    \"CTkFont\": {\n      \"macOS\": {\n        \"family\": \"SF Display\",\n        \"size\": 13,\n        \"weight\": \"normal\"\n      },\n      \"Windows\": {\n        \"family\": \"Roboto\",\n        \"size\": 13,\n        \"weight\": \"normal\"\n      },\n      \"Linux\": {\n        \"family\": \"Roboto\",\n        \"size\": 13,\n        \"weight\": \"normal\"\n      }\n    }\n  }"
  },
  {
    "path": "MISST/Assets/Themes/maluableJSON",
    "content": "{\n    \"CTk\": {\n      \"fg_color\": [\"gray92\", \"gray14\"]\n    },\n    \"CTkToplevel\": {\n      \"fg_color\": [\"gray92\", \"gray14\"]\n    },\n    \"CTkFrame\": {\n      \"corner_radius\": 6,\n      \"border_width\": 0,\n      \"fg_color\": [\"gray86\", \"gray17\"],\n      \"top_fg_color\": [\"gray81\", \"gray20\"],\n      \"border_color\": [\"gray65\", \"gray28\"]\n    },\n    \"CTkButton\": {\n      \"corner_radius\": 6,\n      \"border_width\": 0,\n      \"fg_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"hover_color\": [\"defaultLightHoverColor\", \"defaultDarkHoverColor\"],\n      \"border_color\": [\"#3E454A\", \"#949A9F\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray74\", \"gray60\"]\n    },\n    \"CTkLabel\": {\n      \"corner_radius\": 0,\n      \"fg_color\": \"transparent\",\n      \"text_color\": [\"gray10\", \"#DCE4EE\"]\n    },\n    \"CTkEntry\": {\n      \"corner_radius\": 6,\n      \"border_width\": 2,\n      \"fg_color\": [\"#F9F9FA\", \"#343638\"],\n      \"border_color\": [\"#979DA2\", \"#565B5E\"],\n      \"text_color\":[\"gray10\", \"#DCE4EE\"],\n      \"placeholder_text_color\": [\"gray52\", \"gray62\"]\n    },\n    \"CTkCheckbox\": {\n      \"corner_radius\": 6,\n      \"border_width\": 3,\n      \"fg_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"border_color\": [\"#3E454A\", \"#949A9F\"],\n      \"hover_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"checkmark_color\": [\"#DCE4EE\", \"gray90\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray60\", \"gray45\"]\n    },\n    \"CTkSwitch\": {\n      \"corner_radius\": 1000,\n      \"border_width\": 3,\n      \"button_length\": 0,\n      \"fg_Color\": [\"#939BA2\", \"#4A4D50\"],\n      \"progress_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"button_color\": [\"gray36\", \"#D5D9DE\"],\n      \"button_hover_color\": [\"gray20\", \"gray100\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray60\", \"gray45\"]\n    },\n    \"CTkRadiobutton\": {\n      \"corner_radius\": 1000,\n      \"border_width_checked\": 6,\n      \"border_width_unchecked\": 3,\n      \"fg_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"border_color\": [\"#3E454A\", \"#949A9F\"],\n      \"hover_color\": [\"defaultLightHoverColor\", \"defaultDarkHoverColor\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray60\", \"gray45\"]\n    },\n    \"CTkProgressBar\": {\n      \"corner_radius\": 1000,\n      \"border_width\": 0,\n      \"fg_color\": [\"#939BA2\", \"#4A4D50\"],\n      \"progress_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"border_color\": [\"gray\", \"gray\"]\n    },\n    \"CTkSlider\": {\n      \"corner_radius\": 1000,\n      \"button_corner_radius\": 1000,\n      \"border_width\": 6,\n      \"button_length\": 0,\n      \"fg_color\": [\"#939BA2\", \"#4A4D50\"],\n      \"progress_color\": [\"gray40\", \"#AAB0B5\"],\n      \"button_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"button_hover_color\": [\"defaultLightHoverColor\", \"defaultDarkHoverColor\"]\n    },\n    \"CTkOptionMenu\": {\n      \"corner_radius\": 6,\n      \"fg_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"button_color\": [\"defaultLightHoverColor\", \"defaultDarkHoverColor\"],\n      \"button_hover_color\": [\"defaultLightDarker\", \"defaultDarkDarker\"],\n      \"text_color\": [\"#DCE4EE\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray74\", \"gray60\"]\n    },\n    \"CTkComboBox\": {\n      \"corner_radius\": 6,\n      \"border_width\": 2,\n      \"fg_color\": [\"#F9F9FA\", \"#343638\"],\n      \"border_color\": [\"#979DA2\", \"#565B5E\"],\n      \"button_color\": [\"#979DA2\", \"#565B5E\"],\n      \"button_hover_color\": [\"#6E7174\", \"#7A848D\"],\n      \"text_color\": [\"gray10\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray50\", \"gray45\"]\n    },\n    \"CTkScrollbar\": {\n      \"corner_radius\": 1000,\n      \"border_spacing\": 4,\n      \"fg_color\": \"transparent\",\n      \"button_color\": [\"gray55\", \"gray41\"],\n      \"button_hover_color\": [\"gray40\", \"gray53\"]\n    },\n    \"CTkSegmentedButton\": {\n      \"corner_radius\": 6,\n      \"border_width\": 2,\n      \"fg_color\": [\"#979DA2\", \"gray29\"],\n      \"selected_color\": [\"defaultLightColor\", \"defaultDarkColor\"],\n      \"selected_hover_color\": [\"defaultLightHoverColor\", \"defaultDarkHoverColor\"],\n      \"unselected_color\": [\"#979DA2\", \"gray29\"],\n      \"unselected_hover_color\": [\"gray70\", \"gray41\"],\n      \"text_color\": [\"#DCE4EE\", \"#DCE4EE\"],\n      \"text_color_disabled\": [\"gray74\", \"gray60\"]\n    },\n    \"CTkTextbox\": {\n      \"corner_radius\": 6,\n      \"border_width\": 0,\n      \"fg_color\": [\"#F9F9FA\", \"#1D1E1E\"],\n      \"border_color\": [\"#979DA2\", \"#565B5E\"],\n      \"text_color\":[\"gray10\", \"#DCE4EE\"],\n      \"scrollbar_button_color\": [\"gray55\", \"gray41\"],\n      \"scrollbar_button_hover_color\": [\"gray40\", \"gray53\"]\n    },\n    \"CTkScrollableFrame\": {\n      \"label_fg_color\": [\"gray78\", \"gray23\"]\n    },\n    \"DropdownMenu\": {\n      \"fg_color\": [\"gray90\", \"gray20\"],\n      \"hover_color\": [\"gray75\", \"gray28\"],\n      \"text_color\": [\"gray10\", \"gray90\"]\n    },\n    \"CTkFont\": {\n      \"macOS\": {\n        \"family\": \"SF Display\",\n        \"size\": 13,\n        \"weight\": \"normal\"\n      },\n      \"Windows\": {\n        \"family\": \"Roboto\",\n        \"size\": 13,\n        \"weight\": \"normal\"\n      },\n      \"Linux\": {\n        \"family\": \"Roboto\",\n        \"size\": 13,\n        \"weight\": \"normal\"\n      }\n    }\n  }"
  },
  {
    "path": "MISST/Assets/config_base.json",
    "content": "{\n    \"defaultLightColor\": \"#3B8ED0\", \n    \"defaultDarkColor\": \"#1F6AA5\", \n    \"defaultLightHoverColor\": \"#36719F\", \n    \"defaultDarkHoverColor\": \"#144870\", \n    \"defaultLightDarker\": \"#27577D\", \n    \"defaultDarkDarker\": \"#203A4F\", \n    \"chosenLightColor\": \"#3B8ED0\", \n    \"chosenDarkColor\": \"#1F6AA5\", \n    \"chosenLightHoverColor\": \"#36719F\", \n    \"chosenDarkHoverColor\": \"#144870\", \n    \"chosenLightDarker\": \"#27577D\", \n    \"chosenDarkDarker\": \"#203A4F\", \n    \"rpc\": \"true\", \n    \"autoplay\": \"true\", \n    \"accelerate_on_gpu\": \"false\", \n    \"chosen_model\": \"htdemucs\",\n    \"importsDest\": \"./separated\", \n    \"eq\": \"false\", \n    \"eq_move_sliders_together\": \"true\", \n    \"eq_1\": \"0.0\", \n    \"eq_2\": \"0.0\", \n    \"eq_3\": \"0.0\", \n    \"eq_4\": \"0.0\", \n    \"eq_5\": \"0.0\", \n    \"eq_6\": \"0.0\", \n    \"eq_7\": \"0.0\", \n    \"eq_8\": \"0.0\", \n    \"eq_9\": \"0.0\", \n    \"speed\": \"1.0\",\n    \"pitch\": \"1.0\",\n    \"reverb\": \"0.0\",\n    \"discord_client_id\": \"1007423253373001810\",\n    \"cse_id\": \"8102f2649f8824245\",\n    \"cse_api_key\": \"AIzaSyBxUlDVX64RZL5Dvw6CtQ4JsyOjASiascY\"\n}"
  },
  {
    "path": "MISST/MISSTSetup.py",
    "content": "import os\nimport threading\nimport typing\nfrom pathlib import Path\n\nimport customtkinter\nimport requests\n\n\nclass MISSTSetup(customtkinter.CTkFrame):\n    \"\"\"\n    Class for handling the setup of MISST\n    \"\"\"\n    def __init__(self, parent:typing.Any, model:str) -> None:\n        \"\"\"\n        Initialize the setup\n\n        Args:\n            parent (tkinter.Tk): The parent of the frame\n            model (str): The chosen model\n        \"\"\"\n        super().__init__(parent)\n        self.parent = parent\n\n        self.model_urls = self.get_model_urls(model)\n        for url in self.model_urls:\n            if not os.path.isfile(\"Pretrained/\"+url.split(\"/\")[-1]):\n                break\n        else:\n            self.parent.logger.info(\"All models are already downloaded\")\n            self.destroy()\n            return\n        \n        # delete old model files\n        for file in os.listdir(\"Pretrained/\"):\n            if file.endswith(\".th\"):\n                os.remove(\"Pretrained/\" + file)\n                \n        self.progress_var = customtkinter.DoubleVar()\n        self.width = 755\n        self.height = 430\n        self.FONT = \"Roboto Medium\"\n        self.configure(width=self.width, height=self.height)\n        self.create_widgets()\n\n    def get_model_urls(self, model:str) -> typing.List[str]:\n        models = []\n        with open(\"Pretrained/\" + model + \".yaml\", \"r\") as f:\n            for line in f.readlines():\n                if \"models: \" in line:\n                    models = line.split(\"'\")[1::2]\n                    break\n        remote_file = Path(\"Pretrained/files.txt\")\n        root: str = ''\n        remote_models = {}\n        for line in remote_file.read_text().split('\\n'):\n            line = line.strip()\n            if line.startswith('#'):\n                continue\n            elif line.startswith('root:'):\n                root = line.split(':', 1)[1].strip()\n            else:\n                sig = line.split('-', 1)[0]\n                assert sig not in remote_models\n                remote_models[sig] = \"https://dl.fbaipublicfiles.com/demucs/\" + root + line\n        urls = []\n        for model in models:\n            urls.append(remote_models[model])\n        return urls\n\n    def create_widgets(self) -> None:\n        \"\"\"\n        Create the widgets\n        \"\"\"\n        self.label = customtkinter.CTkLabel(self, text=\"Setting up models...\", font=(self.FONT, 20))\n        self.label.place(relx=0.5, rely=0.45, anchor=\"center\")\n\n        self.progressbar = customtkinter.CTkProgressBar(self, orientation=\"horizontal\", width=300, height=15, variable=self.progress_var)\n        self.progressbar.place(relx=0.5, rely=0.55, anchor=\"center\")\n\n        try:\n            self.start_setup()\n        except:\n            self.label.configure(text=\"Download failed. Please try again.\")\n            threading.Timer(2, self.destroy).start()\n\n    def start_setup(self) -> None:\n        \"\"\"\n        Start the setup\n        \"\"\"\n        self.thread = threading.Thread(target=self.setup_models)\n        self.thread.start()\n\n    def setup_models(self) -> None:\n        \"\"\"\n        Setup the models\n        \"\"\"\n        total_files = len(self.model_urls)\n        for i, url in enumerate(self.model_urls):\n            self.label.configure(text=\"Setting up models {}/{}\".format(i + 1, total_files))\n            if not os.path.isfile(url.split(\"/\")[-1]):\n                self.download_file(url)\n            self.progress_var.set((i + 1) / total_files * 100)\n        self.label.configure(text=\"Setup is complete. Welcome to MISST!\")\n        threading.Timer(2, self.destroy).start()\n\n    def download_file(self, url:str) -> None:\n        \"\"\"\n        Download a file\n\n        Args:\n            file (str): The file to download\n        \"\"\"\n        response = requests.get(url, stream=True)\n        total_length = response.headers.get('content-length')\n\n        try:\n            with open(\"Pretrained/\" + url.split(\"/\")[-1], 'wb') as f:\n                if total_length is None:  # no content length header\n                    f.write(response.content)\n                else:\n                    dl = 0\n                    total_length = int(total_length)\n                    chunk = total_length // 50\n                    for data in response.iter_content(chunk_size=chunk):\n                        dl += len(data)\n                        f.write(data)\n                        self.progress_var.set((dl / total_length))\n                        self.update_idletasks()  # Update the GUI to refresh the progress bar\n        except:\n            os.remove(\"Pretrained/\" + url.split(\"/\")[-1])\n            self.label.configure(text=\"Downloaded file is corrupted or an Error occured. Please try again.\")\n            raise Exception(\"Downloaded file is corrupted or an Error occured. Please try again.\")"
  },
  {
    "path": "MISST/MISSTapp.py",
    "content": "import os\n\nos.chdir(os.path.dirname(os.path.abspath(__file__)))\n\nimport base64\nimport datetime\nimport io\nimport random\nimport shutil\nimport signal\nimport subprocess\nimport sys\nimport tempfile\nimport threading\nimport time\nimport tkinter\nimport traceback\nimport webbrowser\n\nimport customtkinter\nimport GPUtil\nimport music_tag\nimport psutil\nfrom __version__ import __version__ as version\nfrom lyrics_extractor import SongLyrics\nfrom MISSThelpers import MISSTconsole, MISSThelpers\nfrom MISSTlogger import MISSTlogger\nfrom MISSTplayer import MISSTplayer\nfrom MISSTpreprocess import MISSTpreprocess\nfrom MISSTsettings import MISSTconfig, MISSTsettings\nfrom MISSTSetup import MISSTSetup\nfrom PIL import Image\nfrom pypresence import Presence\n\ncustomtkinter.set_appearance_mode(\"System\")  # Modes: \"System\" (standard), \"Dark\", \"Light\"\ncustomtkinter.set_default_color_theme(\"./Assets/Themes/MISST.json\")  # Themes: \"blue\" (standard), \"green\", \"dark-blue\"\n\nclass MISSTapp(customtkinter.CTk):\n    \"\"\"\n    The main MISST application.\n    \"\"\"\n    def __init__(self) -> None:\n        \"\"\"\n        Initialize the MISST application.\n        \"\"\"\n        super().__init__()\n\n        self.player = MISSTplayer([\n             \"Assets/silent/silence.flac\",\n             \"Assets/silent/silence.flac\",\n             \"Assets/silent/silence.flac\",\n             \"Assets/silent/silence.flac\"\n             ], \n             [0]*4\n        )\n        self.logger = MISSTlogger().logger \n        self.settings = MISSTsettings()\n        self.preprocess = MISSTpreprocess()\n\n        self.rpc = self.settings.getSetting(\"rpc\")\n        self.discord_client_id = self.settings.getSetting(\"discord_client_id\")\n\n        if self.rpc == \"true\":\n            try:\n                self.RPC = Presence(self.discord_client_id)\n                self.RPC.connect()\n                self.RPC_CONNECTED = True\n            except:\n                self.logger.error(traceback.format_exc())\n                self.logger.error(\"RPC connection failed or aborted.\")\n                self.RPC_CONNECTED = False\n        else:\n            self.RPC_CONNECTED = False\n\n        tokens = [self.settings.getSetting(\"cse_api_key\"), self.settings.getSetting(\"cse_id\")]\n        self.lyric_engine = SongLyrics(tokens[0],tokens[1])\n\n        self.importsDest = os.path.abspath(self.settings.getSetting(\"importsDest\"))\n        if not os.path.isdir(self.importsDest):\n            os.mkdir(self.importsDest)\n\n        self.FFMpegAvailable = True if shutil.which(\"ffmpeg\") != None else False\n        self.version = version\n\n        for line in MISSThelpers.GenerateSystemInfo(self).split(\"\\n\"):\n            if line != \"\":\n                self.logger.info(line)\n\n        self.playing = False\n        self.current_song = \"\"\n\n        # configure window\n        self.title(\"MISST\")\n        self.iconbitmap(r\"./Assets/icon.ico\")\n        self.WIDTH = 755\n        self.HEIGHT = 430\n        #self.WIDTH = int(self.winfo_screenwidth() * 0.3932291666666667)\n        #self.HEIGHT = int(self.winfo_screenheight() * 0.3981481481481481)\n        self.geometry(f\"{self.WIDTH}x{self.HEIGHT}\")\n        self.minsize(self.WIDTH, self.HEIGHT)\n        self.maxsize(755, 430)\n\n        #customtkinter.set_widget_scaling(((self.WIDTH / 755) + (self.HEIGHT / 430)) / 2)  # widget dimensions and text size\n        #customtkinter.set_window_scaling(((self.WIDTH / 755) + (self.HEIGHT / 430)) / 2)  # window geometry dimensions\n\n        self.check_var1 = tkinter.StringVar(value=\"on\")\n        self.check_var2 = tkinter.StringVar(value=\"on\")\n        self.check_var3 = tkinter.StringVar(value=\"on\")\n        self.check_var4 = tkinter.StringVar(value=\"on\")\n        self.nc_var = tkinter.StringVar(value=\"off\")\n\n        self.ImageCache = {\n            \"empty\"        : customtkinter.CTkImage(Image.open(f\"./Assets/UIAssets/empty.png\"),                                                                                                size=(1,  1)),\n            \"playing\"      : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/player-pause-light.png\"),        light_image=Image.open(\"./Assets/Player/player-pause.png\"),        size=(32,32)),\n            \"paused\"       : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/player-play-light.png\"),         light_image=Image.open(\"./Assets/Player/player-play.png\"),         size=(32,32)),\n            \"shuffle\"      : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/player-shuffle-light.png\"),      light_image=Image.open(\"./Assets/Player/player-shuffle.png\"),      size=(25,25)),\n            \"loop\"         : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/loop-light.png\"),                light_image=Image.open(\"./Assets/Player/loop.png\"),                size=(25,25)),\n            \"loop-off\"     : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/loop-off-light.png\"),            light_image=Image.open(\"./Assets/Player/loop-off.png\"),            size=(25,25)),\n            \"skip-forward\" : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/player-skip-forward-light.png\"), light_image=Image.open(\"./Assets/Player/player-skip-forward.png\"), size=(30,30)),\n            \"skip-back\"    : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/Player/player-skip-back-light.png\"),    light_image=Image.open(\"./Assets/Player/player-skip-back.png\"),    size=(30,30)),\n            \"settings\"     : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/UIAssets/settings-light.png\"),          light_image=Image.open(\"./Assets/UIAssets/settings.png\"),          size=(25,25)),\n            \"equalizer\"    : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/UIAssets/equalizer-light.png\"),         light_image=Image.open(\"./Assets/UIAssets/equalizer.png\"),         size=(25,25)),\n            \"github\"       : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/UIAssets/code-light.png\"),              light_image=Image.open(\"./Assets/UIAssets/code.png\"),              size=(25,25)),\n            \"import\"       : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/UIAssets/import-dark.png\"),             light_image=Image.open(\"./Assets/UIAssets/import-light.png\"),      size=(30,30)),\n            \"spotify\"      : customtkinter.CTkImage(Image.open(\"./Assets/Sources/Spotify.png\"),                                                                                                size=(40,40)),\n            \"youtube\"      : customtkinter.CTkImage(Image.open(\"./Assets/Sources/YoutubeMusic.png\"),                                                                                           size=(40,40)),\n            \"applemusic\"   : customtkinter.CTkImage(Image.open(\"./Assets/Sources/AppleMusic.png\"),                                                                                             size=(40,40)),\n            \"soundcloud\"   : customtkinter.CTkImage(Image.open(\"./Assets/Sources/Soundcloud.png\"),                                                                                             size=(40,40)),\n            \"return\"       : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/UIAssets/goback_dark.png\"),             light_image=Image.open(\"./Assets/UIAssets/goback.png\"),            size=(25,25)),\n            \"no-cover-art\" : customtkinter.CTkImage(dark_image=Image.open(\"./Assets/UIAssets/default-light.png\"),           light_image=Image.open(\"./Assets/UIAssets/default.png\"),           size=(40,40))\n        }\n\n        self.loop = False\n        self.autoplay = True\n\n        self.FONT = \"Roboto Medium\"\n        self.createWidgets()\n\n        # Check if setup is needed (next version will have a better way of doing this)\n        # updater = MISSTupdater(self)\n        # try:\n        #     updater.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n        # except:\n        #     pass\n\n        required_files = MISSTSetup.get_model_urls(self, self.settings.getSetting(\"chosen_model\"))\n        required_files = [file.split(\"/\")[-1] for file in required_files]\n        if not all([os.path.isfile(f\"Pretrained/{file}\") for file in required_files]):\n            self.logger.info(\"Setup required.\")\n            self.model_setup_widget = MISSTSetup(self, self.settings.getSetting(\"chosen_model\"))\n            self.model_setup_widget.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n        else:\n            self.logger.info(\"Setup not required.\")\n\n        def on_closing():\n            self.destroy()\n            self.quit()\n            self.player.stop()\n            current_pid = psutil.Process().pid\n            \n            # Terminate child processes\n            process = psutil.Process(current_pid)\n            children = process.children(recursive=True)\n            self.logger.info(f\"Terminating {len(children)} child processes.\")\n            for child in children:\n                child.terminate()\n            \n            # Terminate the current process\n            self.logger.info(\"MISST closed.\")\n            os.kill(current_pid, signal.SIGTERM)\n            sys.exit()\n\n        self.protocol(\"WM_DELETE_WINDOW\", on_closing)\n\n    def createWidgets(self) -> None:\n        \"\"\"\n        Creates the widgets for the main window.\n        \"\"\"\n        self.west_frame = customtkinter.CTkFrame(master=self, width=self.WIDTH * (175 / self.WIDTH), height=self.HEIGHT * (430 / self.HEIGHT), corner_radius=0)\n        self.west_frame.grid(row=0, column=0, sticky=\"nsew\", padx=(0, 5), rowspan=4)\n\n        self.north_frame = customtkinter.CTkFrame(master=self, width=self.WIDTH * (350 / self.WIDTH), height=self.HEIGHT * (100 / self.HEIGHT), corner_radius=8)\n        self.north_frame.grid(row=0, column=1, sticky=\"nsew\", padx=10, pady=(5, 0))\n\n        self.center_frame = customtkinter.CTkFrame(master=self, width=self.WIDTH * (350 / self.WIDTH), height=self.HEIGHT * (200 / self.HEIGHT), corner_radius=8)\n        self.center_frame.grid(row=1, column=1, sticky=\"nsew\", padx=10, pady=10)\n\n        self.south_frame = customtkinter.CTkFrame(master=self, width=self.WIDTH * (350 / self.WIDTH), height=self.HEIGHT * (100 / self.HEIGHT), corner_radius=8)\n        self.south_frame.grid(row=2, column=1, sticky=\"nsew\", padx=10, pady=(0, 5))       \n\n        self.interface_frame = customtkinter.CTkFrame(master=self, width=self.WIDTH * (195 / self.WIDTH), height=self.HEIGHT * (100 / self.HEIGHT), corner_radius=8)\n        self.interface_frame.grid(row=0, column=2, sticky=\"nsew\", padx=(5, 0), pady=(5, 0))\n        \n        self.east_frame = customtkinter.CTkTabview(master=self, width=self.WIDTH * (195 / self.WIDTH), height=self.HEIGHT * (100 / self.HEIGHT), corner_radius=8)\n        self.east_frame.grid(row=1, column=2, sticky=\"nsew\", padx=(5, 0), pady=(0, 5), rowspan=3)\n        self.east_frame.add(\"Imported\")\n        self.east_frame.add(\"Export\")\n        self.east_frame.tab(\"Imported\").grid_columnconfigure(0, weight=1)\n        self.east_frame.tab(\"Export\").grid_columnconfigure(0, weight=1)\n\n        # Interface Frame\n        self.shuffle_button = customtkinter.CTkButton(\n            master=self.interface_frame,\n            image=self.ImageCache[\"shuffle\"],\n            command=lambda: self.shuffle(),\n            text=\"\",\n            width=5,\n            height=5,\n            fg_color='transparent',\n            hover_color=self.interface_frame.cget(\"bg_color\"),\n            corner_radius=8\n        )\n\n        self.loop_button = customtkinter.CTkButton(\n            master=self.interface_frame,\n            image=self.ImageCache[\"loop-off\"],\n            command=lambda: self.loopEvent(),\n            text=\"\",\n            width=5,\n            height=5,\n            fg_color='transparent',\n            hover_color=self.interface_frame.cget(\"bg_color\"),\n            corner_radius=8\n        )\n\n        self.next_button = customtkinter.CTkButton(\n            master=self.interface_frame,\n            image=self.ImageCache[\"skip-forward\"],\n            command=lambda: print(\"test\"),\n            text=\"\",\n            width=5,\n            height=5,\n            fg_color='transparent',\n            hover_color=self.interface_frame.cget(\"bg_color\"),\n            corner_radius=8,\n            state=tkinter.DISABLED\n        )\n\n        self.previous_button = customtkinter.CTkButton(\n            master=self.interface_frame,\n            image=self.ImageCache[\"skip-back\"],\n            command=lambda: print(\"test\"),\n            text=\"\",\n            width=5,\n            height=5,\n            fg_color='transparent',\n            hover_color=self.interface_frame.cget(\"bg_color\"),\n            corner_radius=8,\n            state=tkinter.DISABLED\n        )\n\n        self.playpause_button = customtkinter.CTkButton(\n            master=self.interface_frame,\n            image=self.ImageCache[\"paused\"],\n            command=lambda: self.playpause(),\n            text=\"\",\n            width=5,\n            height=5,\n            fg_color='transparent',\n            hover_color=self.interface_frame.cget(\"bg_color\"),\n            corner_radius=8,\n            state=tkinter.DISABLED\n        )\n\n        self.next_button.place(relx=0.67, rely=0.5, anchor=tkinter.CENTER)\n        self.previous_button.place(relx=0.33, rely=0.5, anchor=tkinter.CENTER)\n        self.shuffle_button.place(relx=0.16, rely=0.5, anchor=tkinter.CENTER)\n        self.loop_button.place(relx=0.84, rely=0.5, anchor=tkinter.CENTER)\n        self.playpause_button.place(relx=0.50, rely=0.5, anchor=tkinter.CENTER)\n\n        ## EAST FRAME -------------  ---------------------------------------------------------------------------------------\n        # Imported Tab\n        self.search_entry = customtkinter.CTkEntry(\n            master=self.east_frame.tab(\"Imported\"),\n            width=150,\n            height=25,\n            placeholder_text=\"Search for audio\",\n        )\n        self.search_entry.place(relx=0.5, rely=0.05, anchor=tkinter.CENTER)\n\n        self.listframe = customtkinter.CTkFrame(\n            master=self.east_frame.tab(\"Imported\"), width=150, height=175, corner_radius=8\n        )\n        self.listframe.place(relx=0.5, rely=0.45, anchor=tkinter.CENTER)\n\n        self.songs_box = customtkinter.CTkTextbox(\n            master=self.listframe,\n            width=140,\n            height=175,\n            bg_color='transparent',\n            fg_color='transparent',\n            corner_radius=8,\n        )\n        self.songs_box.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n\n        self.index_entry = customtkinter.CTkEntry(\n            master=self.east_frame.tab(\"Imported\"),\n            width=150,\n            height=25,\n            placeholder_text=\"Enter index of audio\",\n        )\n        self.index_entry.place(relx=0.5, rely=0.85, anchor=tkinter.CENTER)\n\n        self.playbutton = customtkinter.CTkButton(\n            master=self.east_frame.tab(\"Imported\"),\n            text=\"Play\",\n            width=150,\n            height=25,\n            command=lambda: self.play_search(self.index_entry.get(), MISSThelpers.MISSTlistdir(self, self.importsDest)),\n        )\n        self.playbutton.place(relx=0.5, rely=0.95, anchor=tkinter.CENTER)\n\n        importsBoxUpdates = threading.Thread(target=self.imports_check, args=(self.search_entry, self.songs_box))\n        importsBoxUpdates.daemon = True\n        importsBoxUpdates.start()\n        # Export Tab\n        self.export_components = {\n            \"Bass\": (None, None),\n            \"Other\": (None, None),\n            \"Drums\": (None, None),\n            \"Vocals\": (None, None)\n        }\n        def activate(button, slider):\n            button_text = button.cget(\"text\")\n            if button_text == \"Bass\":\n                sound = 0\n                self.slider1.set(0.5) if button.cget(\"border_color\") == \"#3E454A\" else self.slider1.set(0)\n                self.checkbox1.select() if button.cget(\"border_color\") == \"#3E454A\" else self.checkbox1.deselect()\n            \n            elif button_text == \"Drums\":\n                sound = 1\n                self.slider2.set(0.5) if button.cget(\"border_color\") == \"#3E454A\" else self.slider2.set(0)\n                self.checkbox2.select() if button.cget(\"border_color\") == \"#3E454A\" else self.checkbox2.deselect()\n\n            elif button_text == \"Other\":\n                sound = 2\n                self.slider3.set(0.5) if button.cget(\"border_color\") == \"#3E454A\" else self.slider3.set(0)\n                self.checkbox3.select() if button.cget(\"border_color\") == \"#3E454A\" else self.checkbox3.deselect()\n\n            elif button_text == \"Vocals\":\n                sound = 3\n                self.slider4.set(0.5) if button.cget(\"border_color\") == \"#3E454A\" else self.slider4.set(0)\n                self.checkbox4.select() if button.cget(\"border_color\") == \"#3E454A\" else self.checkbox4.deselect()\n\n            if button.cget(\"border_color\") == \"#3E454A\":\n                button.configure(border_color=self.settings.getSetting(\"chosenLightColor\") if customtkinter.get_appearance_mode() == \"Light\" else self.settings.getSetting(\"chosenDarkColor\"))\n                slider.set(0.5)\n            else:\n                button.configure(border_color=\"#3E454A\")\n                slider.set(0)\n\n            self.player.set_volume(sound, slider.get())\n\n        def slider_event(slider, button):\n            button_text = button.cget(\"text\")\n            if button_text == \"Bass\":\n                sound = 0\n                self.slider1.set(self.export_components[\"Bass\"][0].get())\n                self.checkbox1.select() if self.export_components[\"Bass\"][0].get() != 0 else self.checkbox1.deselect()\n            \n            elif button_text == \"Drums\":\n                sound = 1\n                self.slider2.set(self.export_components[\"Drums\"][0].get())\n                self.checkbox2.select() if self.export_components[\"Drums\"][0].get() != 0 else self.checkbox2.deselect()\n\n            elif button_text == \"Other\":\n                sound = 2\n                self.slider3.set(self.export_components[\"Other\"][0].get())\n                self.checkbox3.select() if self.export_components[\"Other\"][0].get() != 0 else self.checkbox3.deselect()\n\n            elif button_text == \"Vocals\":\n                sound = 3\n                self.slider4.set(self.export_components[\"Vocals\"][0].get())\n                self.checkbox4.select() if self.export_components[\"Vocals\"][0].get() != 0 else self.checkbox4.deselect()\n\n            self.player.set_volume(sound, slider)\n            if slider == 0:\n                button.configure(border_color=\"#3E454A\")\n            else:\n                button.configure(border_color=self.settings.getSetting(\"chosenLightColor\") if customtkinter.get_appearance_mode() == \"Light\" else self.settings.getSetting(\"chosenDarkColor\"))\n\n        widgets = [\"Bass\", \"Other\", \"Drums\", \"Vocals\"]\n        sliders = []\n        i = 0\n        for widget in widgets:\n            activate_button = customtkinter.CTkButton(\n                master=self.east_frame.tab(\"Export\"),\n                text=widget,\n                width=70,\n                height=70,\n                border_width=2,\n                border_color=self.settings.getSetting(\"chosenLightColor\") if customtkinter.get_appearance_mode() == \"Light\" else self.settings.getSetting(\"chosenDarkColor\"),\n                bg_color='transparent',\n                fg_color='transparent',\n                hover_color=self.east_frame.cget(\"bg_color\"),\n            )\n            factor = 0.25 if i < 2 else 0.75\n            activate_button.place(\n                relx=factor, rely=0.25 if i % 2 == 0 else 0.6, anchor=tkinter.CENTER\n            )\n            volume_slider = customtkinter.CTkSlider(\n                master=self.east_frame.tab(\"Export\"),\n                width=70,\n                height=10,\n                number_of_steps=10\n            )\n            sliders.append(volume_slider)\n            volume_slider.place(\n                relx=factor, rely=0.42 if i % 2 == 0 else 0.77, anchor=tkinter.CENTER\n            )\n            activate_button.configure(\n                command=lambda button=activate_button, slider=volume_slider: activate(button, slider)\n            )\n            volume_slider.configure(\n                command=lambda slider=volume_slider, button=activate_button: slider_event(slider, button)\n            )\n            i += 1\n            self.export_components[activate_button.cget(\"text\")] = volume_slider, activate_button\n        self.export_button = customtkinter.CTkButton(\n            master=self.east_frame.tab(\"Export\"),\n            text=\"Export\",\n            width=150,\n            height=25,\n            command=lambda: threading.Thread(target=self.export, args=(self.current_song, sliders), daemon=True).start()\n        )\n        self.export_button.place(relx=0.5, rely=0.95, anchor=tkinter.CENTER)\n        ## WEST FRAME ----------------------------------------------------------------------------------------------------\n\n        self.logolabel = customtkinter.CTkLabel(\n            master=self.west_frame, text=f\"MISST {version}\", font=(self.FONT, -16)\n        )\n        self.logolabel.place(relx=0.5, rely=0.12, anchor=tkinter.CENTER)\n\n        self.themelabel = customtkinter.CTkLabel(master=self.west_frame, text=\"Appearance Mode:\")\n        self.themelabel.place(relx=0.5, rely=0.7, anchor=tkinter.CENTER)\n\n        self.thememenu = customtkinter.CTkOptionMenu(\n            master=self.west_frame,\n            values=[\"System\", \"Dark\", \"Light\"],\n            command=lambda x: MISSThelpers.change_theme(x)\n        )\n        self.thememenu.place(relx=0.5, rely=0.8, anchor=tkinter.CENTER)\n\n        self.settings_button = customtkinter.CTkButton(\n            master=self.west_frame,\n            font=(self.FONT, -12),\n            text=\"\",\n            image=self.ImageCache[\"settings\"],\n            bg_color='transparent',\n            fg_color='transparent',\n            hover_color=self.west_frame.cget(\"bg_color\"),\n            width=5,\n            height=5,\n            command=lambda: self.draw_settings_frame(),\n        )\n        self.settings_button.place(relx=0.3, rely=0.9, anchor=tkinter.CENTER)\n\n        self.equalizer = customtkinter.CTkButton(\n            master=self.west_frame,\n            font=(self.FONT, -12),\n            text=\"\",\n            image=self.ImageCache[\"equalizer\"],\n            bg_color='transparent',\n            fg_color='transparent',\n            hover_color=self.west_frame.cget(\"bg_color\"),\n            width=5,\n            height=5,\n            corner_radius=16,\n            command=lambda: self.draw_effects_frame(),\n        )\n        self.equalizer.place(relx=0.7, rely=0.9, anchor=tkinter.CENTER)\n\n        self.github_button = customtkinter.CTkButton(\n            master=self.west_frame,\n            font=(self.FONT, -12),\n            text=\"\",\n            image=self.ImageCache[\"github\"],\n            bg_color='transparent',\n            fg_color='transparent',\n            hover_color=self.west_frame.cget(\"bg_color\"),\n            width=5,\n            height=5,\n            command=lambda: webbrowser.open(\"https://github.com/Frikallo/MISST\", new=2),\n        )\n        self.github_button.place(relx=0.5, rely=0.9, anchor=tkinter.CENTER)\n\n        ## NORTH FRAME ----------------------------------------------------------------------------------------------------\n\n        self.songlabel = customtkinter.CTkButton(\n            master=self.north_frame,\n            text=f\"Play Something!\",\n            width=240,\n            height=50,\n            font=(self.FONT, -14),\n            command=lambda: self.draw_lyrics_box(),\n            fg_color='transparent',\n            hover_color=self.north_frame.cget(\"bg_color\"),\n            text_color=self.logolabel.cget(\"text_color\"),\n            image = self.ImageCache[\"empty\"],\n        )\n        self.songlabel.place(relx=0.5, rely=0.3, anchor=tkinter.CENTER)\n\n        self.progressbar = customtkinter.CTkSlider(master=self.north_frame, width=225, height=15, from_=0, to=100, number_of_steps=100, command=lambda x: self.slider_event(x), state=tkinter.DISABLED)\n        self.progressbar.place(relx=0.5, rely=0.7, anchor=tkinter.CENTER)\n        self.progressbar.set(0)\n\n        self.progress_label_left = customtkinter.CTkLabel(\n            master=self.north_frame, text=\"0:00\", font=(self.FONT, -12), width=5\n        )\n        self.progress_label_left.place(relx=0.1, rely=0.7, anchor=tkinter.CENTER)\n\n        self.progress_label_right = customtkinter.CTkLabel(\n            master=self.north_frame, text=\"0:00\", font=(self.FONT, -12), width=5\n        )\n        self.progress_label_right.place(relx=0.9, rely=0.7, anchor=tkinter.CENTER)\n\n        ## CENTER FRAME ----------------------------------------------------------------------------------------------------\n\n        self.checkbox1 = customtkinter.CTkCheckBox(\n            master=self.center_frame,\n            text=\"Bass\",\n            command=lambda: MISSThelpers.checkbox_event(self.check_var1, self.export_components[\"Bass\"], 0, self.player, self.slider1),\n            variable=self.check_var1,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.checkbox1.place(relx=0.1, rely=0.2, anchor=tkinter.W)\n\n        self.checkbox2 = customtkinter.CTkCheckBox(\n            master=self.center_frame,\n            text=\"Drums\",\n            command=lambda: MISSThelpers.checkbox_event(self.check_var2, self.export_components[\"Drums\"], 1, self.player, self.slider2),\n            variable=self.check_var2,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.checkbox2.place(relx=0.1, rely=0.35, anchor=tkinter.W)\n\n        self.checkbox3 = customtkinter.CTkCheckBox(\n            master=self.center_frame,\n            text=\"Other\",\n            command=lambda: MISSThelpers.checkbox_event(self.check_var3, self.export_components[\"Other\"], 2, self.player, self.slider3),\n            variable=self.check_var3,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.checkbox3.place(relx=0.1, rely=0.5, anchor=tkinter.W)\n\n        self.checkbox4 = customtkinter.CTkCheckBox(\n            master=self.center_frame,\n            text=\"Vocals\",\n            command=lambda: MISSThelpers.checkbox_event(self.check_var4, self.export_components[\"Vocals\"], 3, self.player, self.slider4),\n            variable=self.check_var4,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.checkbox4.place(relx=0.1, rely=0.65, anchor=tkinter.W)\n\n        self.slider1 = customtkinter.CTkSlider(\n            master=self.center_frame,\n            from_=0,\n            to=1,\n            command=lambda x: MISSThelpers.slider_event(x, self.export_components[\"Bass\"], 0, self.player, self.check_var1),\n            number_of_steps=10,\n        )\n        self.slider1.place(relx=0.6, rely=0.2, anchor=tkinter.CENTER)\n\n        self.slider2 = customtkinter.CTkSlider(\n            master=self.center_frame,\n            from_=0,\n            to=1,\n            command=lambda x: MISSThelpers.slider_event(x, self.export_components[\"Drums\"], 1, self.player, self.check_var2),\n            number_of_steps=10,\n        )\n        self.slider2.place(relx=0.6, rely=0.35, anchor=tkinter.CENTER)\n\n        self.slider3 = customtkinter.CTkSlider(\n            master=self.center_frame,\n            from_=0,\n            to=1,\n            command=lambda x: MISSThelpers.slider_event(x, self.export_components[\"Other\"], 2, self.player, self.check_var3),\n            number_of_steps=10,\n        )\n        self.slider3.place(relx=0.6, rely=0.5, anchor=tkinter.CENTER)\n\n        self.slider4 = customtkinter.CTkSlider(\n            master=self.center_frame,\n            from_=0,\n            to=1,\n            command=lambda x: MISSThelpers.slider_event(x, self.export_components[\"Vocals\"], 3, self.player, self.check_var4),\n            number_of_steps=10,\n        )\n        self.slider4.place(relx=0.6, rely=0.65, anchor=tkinter.CENTER)\n\n        self.effects_checkbox = customtkinter.CTkSwitch(\n            master=self.center_frame,\n            text=\"Effects\",\n            command=self.effects,\n            variable=self.nc_var,\n            onvalue=\"on\",\n            offvalue=\"off\",\n            fg_color=None\n        )\n        self.effects_checkbox.place(relx=0.5, rely=0.9, anchor=tkinter.CENTER)\n        self.effects_checkbox.configure(state=tkinter.DISABLED)\n\n        self.effects_button = customtkinter.CTkButton(\n            master=self.center_frame,\n            text=\"Effects\",\n            font=(self.FONT, -12, \"underline\"),\n            command=self.draw_effects_frame,\n            fg_color=self.center_frame.cget(\"fg_color\"),\n            hover_color=self.center_frame.cget(\"bg_color\"),\n            width=25,\n            height=25,\n        )\n        self.effects_button.place(relx=0.53, rely=0.9, anchor=tkinter.CENTER)\n        self.effects_button.configure(state=tkinter.DISABLED)\n\n        ## SOUTH FRAME ----------------------------------------------------------------------------------------------------\n\n        self.import_button = customtkinter.CTkButton(\n            master=self.south_frame,\n            command=lambda: self.imports_toggle(),\n            image=self.ImageCache[\"import\"],\n            fg_color='transparent',\n            hover_color=self.south_frame.cget(\"bg_color\"),\n            text=\"Import Song(s)\",\n            font=(self.FONT, -14),\n            width=240,\n            height=50,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)        \n\n    def raise_above_all(self, window:customtkinter.CTkToplevel) -> None:\n        \"\"\"\n        Raises a window above all other windows\n\n        Args:\n            window (tkinter.Tk): The window to raise\n        \"\"\"\n        window.attributes(\"-topmost\", 1)\n        window.attributes(\"-topmost\", 0)\n\n    def draw_lyrics_box(self) -> None:\n        \"\"\"\n        Draws the lyrics box\n        \"\"\"\n        try:\n            self.lyrics_window.destroy() # Destroy the window if it already exists\n        except:\n            pass\n\n        self.lyrics_window = customtkinter.CTkToplevel(app)\n        self.lyrics_window.geometry(\"580x435\")\n        self.lyrics_window.title(\"Lyrics\")\n        self.lyrics_window.after(201, lambda: self.lyrics_window.wm_iconbitmap(r\"Assets/icon.ico\")) # Weird bug where icon doesn't load unless it's done after 200ms\n        self.lyrics_window.minsize(580, 435)\n        self.lyrics_window.maxsize(580, 435)\n        self.raise_above_all(self.lyrics_window)\n\n        search_term = self.songlabel.cget(\"text\")\n        if search_term == \"Play Something!\":\n            self.lyrics_window.destroy()\n            return\n        search_term = self.current_song\n\n        self.lyrics_box = customtkinter.CTkTextbox(\n            master=self.lyrics_window,\n            font=(self.FONT, -14),\n            width=500,\n            height=375,\n            bg_color=self.lyrics_window.cget(\"fg_color\"),\n            fg_color=self.lyrics_window.cget(\"fg_color\"),\n            state=tkinter.DISABLED,\n        )\n        self.lyrics_box.place(relx=0.5, rely=0.45, anchor=tkinter.CENTER)\n\n        def search(term):\n            self.lyrics_box.configure(state=tkinter.NORMAL)\n            try:\n                lyrics = self.lyric_engine.get_lyrics(term)\n                self.lyrics_box.delete(\"0.0\", \"end\")\n                self.lyrics_box.insert(tkinter.END, lyrics['lyrics'])\n                config.setConfig(path, \"lyrics\", lyrics['lyrics'])\n            except:\n                self.logger.error(traceback.format_exc())\n                self.lyrics_box.delete(\"0.0\", \"end\")\n                self.lyrics_box.insert(tkinter.END, \"Lyrics not found\")\n            self.lyrics_box.configure(state=tkinter.DISABLED)\n\n        path = f\"{self.importsDest}/{search_term}\"\n        config = MISSTconfig(path)\n\n        if config.getConfig(path)[\"lyrics\"] == \"null\":\n            search(search_term)\n        else:\n            self.lyrics_box.configure(state=tkinter.NORMAL)\n            self.lyrics_box.delete(\"0.0\", \"end\")\n            self.lyrics_box.insert(tkinter.END, config.getConfig(path)[\"lyrics\"])\n            self.lyrics_box.configure(state=tkinter.DISABLED)\n\n        self.lyric_entry = customtkinter.CTkEntry(\n            master=self.lyrics_window,\n            font=(self.FONT, -14),\n            width=375,\n            height=15,\n            placeholder_text=\"Not the right lyrics? Click here to search for them!\",\n        )\n        self.lyric_entry.place(relx=0.4, rely=0.92, anchor=tkinter.CENTER)\n\n        self.search_button = customtkinter.CTkButton(\n            master=self.lyrics_window,\n            command=lambda: search(self.lyric_entry.get()),\n            text=\"Search\",\n            font=(self.FONT, -14),\n            width=100,\n            height=15,\n        )\n        self.search_button.place(relx=0.84, rely=0.92, anchor=tkinter.CENTER)\n\n    def imports_checkbox_event(self, current_var:tkinter.StringVar) -> None:\n        \"\"\"\n        Called when an import checkbox is clicked\n\n        Args:\n            current_var (tkinter.StringVar): The variable of the checkbox that was clicked\n        \"\"\"\n        vars = [self.import_Spotify_var, self.import_Youtube_var, self.import_AppleMusic_var, self.import_Soundcloud_var]\n        checkboxes = [self.import_Spotify_checkbox, self.import_Youtube_checkbox, self.import_AppleMusic_checkbox, self.import_Soundcloud_checkbox]\n        for var in vars:\n            if var.get() == \"on\":\n                var.set(\"off\")\n                checkboxes[vars.index(var)].deselect()\n        current_var.set(\"on\")\n        checkboxes[vars.index(current_var)].select()\n\n    def imports_toggle(self) -> None:\n        \"\"\"\n        Toggles the imports frame\n        \"\"\"\n        try:\n            self.imports_frame.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n        except:\n            self.draw_imports_frame()\n\n    def draw_imports_frame(self) -> None:\n        \"\"\"\n        Draws the imports frame\n        \"\"\"\n        self.imports_frame = customtkinter.CTkFrame(\n            master=self, width=self.WIDTH * (755 / self.WIDTH), height=self.HEIGHT * (430 / self.HEIGHT)\n        )\n        self.imports_frame.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n\n        self.left_frame = customtkinter.CTkFrame(\n            master=self.imports_frame, width=350, height=380\n        )\n        self.left_frame.place(relx=0.25, rely=0.47, anchor=tkinter.CENTER)\n\n        self.right_frame = customtkinter.CTkFrame(\n            master=self.imports_frame, width=350, height=380\n        )\n        self.right_frame.place(relx=0.75, rely=0.47, anchor=tkinter.CENTER)\n\n        self.import_title = customtkinter.CTkLabel(\n            master=self.left_frame,\n            text=\"Choose a source\",\n            font=(self.FONT, -20),\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_title.place(relx=0.5, rely=0.1, anchor=tkinter.CENTER)\n\n        self.import_Spotify_var = tkinter.StringVar()   \n        self.import_Youtube_var = tkinter.StringVar()\n        self.import_AppleMusic_var = tkinter.StringVar()\n        self.import_Soundcloud_var = tkinter.StringVar()\n\n        self.import_Spotify_button = customtkinter.CTkLabel(\n            master=self.left_frame,\n            image=self.ImageCache[\"spotify\"],\n            fg_color='transparent',\n            text=\"\",\n            font=(self.FONT, -14),\n            width=50,\n            height=50,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_Spotify_button.place(relx=0.3, rely=0.2375, anchor=tkinter.CENTER)\n\n        self.import_Spotify_checkbox = customtkinter.CTkCheckBox(\n            master=self.left_frame,\n            text=\"\",\n            command=lambda: self.imports_checkbox_event(self.import_Spotify_var),\n            variable=self.import_Spotify_var,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.import_Spotify_checkbox.place(relx=0.61, rely=0.2375, anchor=tkinter.CENTER)\n\n\n        self.import_Youtube_button = customtkinter.CTkLabel(\n            master=self.left_frame,\n            image=self.ImageCache[\"youtube\"],\n            fg_color='transparent',\n            text=\"\",\n            font=(self.FONT, -14),\n            width=50,\n            height=50,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_Youtube_button.place(relx=0.3, rely=0.3750, anchor=tkinter.CENTER)\n\n        self.import_Youtube_checkbox = customtkinter.CTkCheckBox(\n            master=self.left_frame,\n            text=\"\",\n            command=lambda: self.imports_checkbox_event(self.import_Youtube_var),\n            variable=self.import_Youtube_var,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.import_Youtube_checkbox.place(relx=0.61, rely=0.3750, anchor=tkinter.CENTER)\n\n        self.import_Deezer_button = customtkinter.CTkLabel(\n            master=self.left_frame,\n            image=self.ImageCache[\"applemusic\"],\n            fg_color='transparent',\n            text=\"\",\n            font=(self.FONT, -14),\n            width=50,\n            height=50,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_Deezer_button.place(relx=0.3, rely=0.5125, anchor=tkinter.CENTER)\n\n        self.import_AppleMusic_checkbox = customtkinter.CTkCheckBox(\n            master=self.left_frame,\n            text=\"\",\n            command=lambda: self.imports_checkbox_event(self.import_AppleMusic_var),\n            variable=self.import_AppleMusic_var,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.import_AppleMusic_checkbox.place(relx=0.61, rely=0.5125, anchor=tkinter.CENTER)\n\n        self.import_Soundcloud_button = customtkinter.CTkLabel(\n            master=self.left_frame,\n            image=self.ImageCache[\"soundcloud\"],\n            fg_color='transparent',\n            text=\"\",\n            font=(self.FONT, -14),\n            width=50,\n            height=50,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_Soundcloud_button.place(relx=0.3, rely=0.6500, anchor=tkinter.CENTER)\n\n        self.import_Soundcloud_checkbox = customtkinter.CTkCheckBox(\n            master=self.left_frame,\n            text=\"\",\n            command=lambda: self.imports_checkbox_event(self.import_Soundcloud_var),\n            variable=self.import_Soundcloud_var,\n            onvalue=\"on\",\n            offvalue=\"off\",\n        )\n        self.import_Soundcloud_checkbox.place(relx=0.61, rely=0.6500, anchor=tkinter.CENTER)\n\n        self.source_entry = customtkinter.CTkEntry(\n            master=self.left_frame,\n            width=200,\n            text_color=self.logolabel.cget(\"text_color\"),\n            placeholder_text=\"Enter your share URL here\",\n        )\n        self.source_entry.place(relx=0.5, rely=0.8, anchor=tkinter.CENTER)\n\n        self.import_button = customtkinter.CTkButton(\n            master=self.left_frame,\n            command=lambda: threading.Thread(target=self.sourcePreprocess, args=(self.source_entry.get(),), daemon=True).start(),\n            text=\"Import\",\n            font=(self.FONT, -14),\n            width=75,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_button.place(relx=0.32, rely=0.9, anchor=tkinter.CENTER)\n\n        self.or_label = customtkinter.CTkLabel(\n            master=self.left_frame,\n            text=\"OR\",\n            font=(self.FONT, -14),\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.or_label.place(relx=0.5, rely=0.9, anchor=tkinter.CENTER)\n\n        self.import_file_button = customtkinter.CTkButton(\n            master=self.left_frame,\n            command=lambda: threading.Thread(target=self.filePreprocess, daemon=True).start(),\n            text=\"From File\",\n            font=(self.FONT, -14),\n            width=75,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.import_file_button.place(relx=0.68, rely=0.9, anchor=tkinter.CENTER)\n\n        self.preprocess_status_label = customtkinter.CTkLabel(\n            master=self.right_frame,\n            text=\"Preprocess Status\",\n            font=(self.FONT, -20),\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.preprocess_status_label.place(relx=0.5, rely=0.1, anchor=tkinter.CENTER)\n\n        self.preprocess_terminal = customtkinter.CTkFrame(\n            master=self.right_frame,\n            width=275,\n            height=290,\n            fg_color=\"#0C0C0C\",\n            border_width=1,\n        )\n        self.preprocess_terminal.place(relx=0.5, rely=0.55, anchor=tkinter.CENTER)\n\n        self.preprocess_terminal_text = customtkinter.CTkTextbox(\n            master=self.preprocess_terminal,\n            font=(self.FONT, -14),\n            width=250,\n            height=250,\n            bg_color=\"transparent\",\n            fg_color=\"transparent\",\n            text_color=\"#CCCCCC\",\n        )\n        self.preprocess_terminal_text.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n\n        def get_usage_info():\n            while True:\n                cpu_usage = psutil.cpu_percent()\n                mem_usage = psutil.virtual_memory().percent\n                try:\n                    gpu_usage = GPUtil.getGPUs()[0].load * 100\n                except:\n                    gpu_usage = \"N/A\" #CPU version of MISST\n                self.system_info.configure(\n                    text=f\"CPU: {cpu_usage:.1f}% | Mem: {mem_usage:.1f}% | GPU: {f'{gpu_usage:.1f}' if gpu_usage != 'N/A' else 'N/A'}%\"\n                )\n                time.sleep(1)\n        threading.Thread(target=get_usage_info, daemon=True).start()\n\n        self.system_info = customtkinter.CTkLabel(\n            master=self.imports_frame,\n            text=f\"CPU: 00.0% | Mem: 00.0% | GPU: 00.0%\",\n            font=(self.FONT, -12),\n            text_color=self.logolabel.cget(\"text_color\"),\n            state=tkinter.DISABLED,\n        )\n        self.system_info.place(relx=0.76, rely=0.95, anchor=tkinter.CENTER)\n\n        self.return_button = customtkinter.CTkButton(\n            master=self.imports_frame,\n            command=lambda: self.imports_frame.place_forget(),\n            image=self.ImageCache[\"return\"],\n            fg_color='transparent',\n            hover_color=self.imports_frame.cget(\"bg_color\"),\n            text=\"Return\",\n            font=(self.FONT, -12),\n            width=5,\n            text_color=\"#6D6D6D\",\n        )\n        self.return_button.place(relx=0.24, rely=0.95, anchor=tkinter.CENTER)\n\n        self.console = MISSTconsole(self.preprocess_terminal_text, \"MISST Preprocessor\\nCopyright (C) @MISST App.\\n\")\n        self.console.update(\"\\nMISST> waiting\")\n\n    def retrieve_metadata(self, save_dir:str = None, temp_dir:str = None, file:str = None) -> None:\n        \"\"\"\n        Retrieves metadata from a file and saves it to a directory.\n\n        Args:\n            save_dir (str): The directory to save the metadata to.\n            temp_dir (str): The directory to retrieve the metadata from.\n            file (str): The file to retrieve the metadata from.\n        \"\"\"\n        self.console.update(\"\\nMISST> Getting Metadata\")\n        if temp_dir is not None:\n            save_dir = f\"{self.importsDest}/{os.path.splitext(os.path.basename(os.listdir(temp_dir)[0]))[0]}\"\n            if not os.path.exists(save_dir):\n                os.mkdir(save_dir)\n            file = f\"{temp_dir}/{os.listdir(temp_dir)[0]}\"\n        else:\n            file = file\n        config = MISSTconfig(save_dir) #Create config file\n        try:\n            f = music_tag.load_file(file)\n            art = f['artwork']\n            raw_art = art.first.data\n            image = Image.open(io.BytesIO(raw_art))\n\n            square_size = min(image.size)\n            left = (image.width - square_size) // 2\n            top = (image.height - square_size) // 2\n            right = left + square_size\n            bottom = top + square_size\n\n            # Crop the square region from the center of the image\n            cropped_image = image.crop((left, top, right, bottom))\n\n            image = cropped_image.resize((40, 40), Image.Resampling.LANCZOS)\n            raw_art = image.tobytes()\n            png_bytes = io.BytesIO()\n            image.save(png_bytes, format=\"PNG\")\n            raw_art = png_bytes.getvalue()\n            config.setConfig(save_dir, \"image_url\", MISSThelpers().freeimage_upload(raw_art))\n            config.setConfig(save_dir, \"image_raw\", base64.b64encode(raw_art).decode('utf-8'))\n            self.console.endUpdate()\n            self.console.addLine(\"\\nMISST> Metadata Retrieved.\")\n        except:\n            self.logger.error(traceback.format_exc())\n            self.console.endUpdate()\n            self.console.addLine(\"\\nMISST> Error getting metadata.\")\n\n    def filePreprocess(self) -> None:\n        \"\"\"\n        Preprocesses a file.\n        \"\"\"\n        self.console.editLine(f\"MISST Preprocessor\\nCopyright (C) @MISST App.\\n\", 0)\n        self.import_file_button.configure(state=tkinter.DISABLED)\n        self.import_button.configure(state=tkinter.DISABLED)\n        file = tkinter.filedialog.askopenfilename(initialdir = \"/\",title = \"Select file\",filetypes = ((\"mp3 files\",\"*.mp3\"),(\"wav files\", \"*.wav\"),(\"flac files\", \"*.flac\"),(\"all files\",\"*.*\")), multiple=False)\n        if file != \"\":\n            self.console.endUpdate()\n            save_name = os.path.splitext(os.path.basename(file))[0]\n            save_dir = f\"{self.importsDest}/{save_name}\"\n            if not os.path.exists(save_dir):\n                os.mkdir(save_dir)\n            self.retrieve_metadata(save_dir=save_dir, file=file)\n            thread = threading.Thread(target=MISSTpreprocess.preprocess, args=(self, file, self.importsDest, self.settings.getSetting(\"chosen_model\"), \"cuda\" if self.settings.getSetting(\"accelerate_on_gpu\") == \"true\" else \"cpu\"), daemon=True)\n            thread.start()\n            thread.join()\n            self.import_file_button.configure(state=tkinter.NORMAL)\n            self.import_button.configure(state=tkinter.NORMAL)\n        else:\n            self.import_file_button.configure(state=tkinter.NORMAL)\n            self.import_button.configure(state=tkinter.NORMAL)\n            \n    def sourcePreprocess(self, url:str) -> None:\n        \"\"\"\n        Preprocesses a source.\n\n        Args:\n            url (str): The URL of the source to preprocess.\n        \"\"\"\n        self.console.editLine(f\"MISST Preprocessor\\nCopyright (C) @MISST App.\\n\", 0)\n        if url != \"\":\n            # Spotify Import\n            if self.import_Spotify_var.get() == \"on\":\n                self.import_file_button.configure(state=tkinter.DISABLED)\n                self.import_button.configure(state=tkinter.DISABLED)\n                if \"https://open.spotify.com/track\" not in url:\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Invalid URL.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.update(\"\\nMISST> Downloading\")\n                temp_dir = tempfile.mkdtemp()\n                cmd = [os.path.abspath(\"./Assets/Bin/spotdl.exe\"),\n                       f\"{url}\",\n                       \"--output\",\n                       temp_dir,\n                       \"--ffmpeg\",\n                       \"./ffmpeg.exe\"\n                       ]\n                process = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, creationflags=0x08000000)\n                if process.returncode != 0:\n                    self.logger.error(process.stderr)\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Error downloading file.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.addLine(\"\\nMISST> Downloaded.\")\n                self.retrieve_metadata(temp_dir=temp_dir)\n                thread = threading.Thread(target=MISSTpreprocess.preprocess, args=(self, f\"{temp_dir}/{os.listdir(temp_dir)[0]}\", self.importsDest, self.settings.getSetting(\"chosen_model\"), \"cuda\" if self.settings.getSetting(\"accelerate_on_gpu\") == \"true\" else \"cpu\"), daemon=True)\n                thread.start()\n                thread.join()\n                os.remove(os.path.join(temp_dir, os.listdir(temp_dir)[0]))\n                os.rmdir(temp_dir)\n                self.import_file_button.configure(state=tkinter.NORMAL)\n                self.import_button.configure(state=tkinter.NORMAL)\n                self.source_entry.delete(0, tkinter.END) #Clear entry\n            \n            # Youtube Import\n            elif self.import_Youtube_var.get() == \"on\":\n                self.import_file_button.configure(state=tkinter.DISABLED)\n                self.import_button.configure(state=tkinter.DISABLED)\n                if \"https://music.youtube.com/watch?v=\" not in url and \"https://www.youtube.com/watch?v=\" not in url:\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Invalid URL.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.update(\"\\nMISST> Downloading\")\n                temp_dir = tempfile.mkdtemp()\n                cmd = [os.path.abspath(\"./Assets/Bin/music-dl.exe\"), \n                       \"-v\", \n                       \"-x\",\n                       \"--embed-thumbnail\",\n                       \"--audio-format\",\n                       \"flac\",\n                       \"-o\",\n                       f\"{temp_dir}/%(title)s.%(ext)s\",\n                       f\"{url}\",\n                       \"--ffmpeg-location\",\n                       \"./ffmpeg.exe\"\n                ] \n                process = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, creationflags=0x08000000)\n                if process.returncode != 0:\n                    self.logger.error(process.stderr)\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Error downloading file.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.addLine(\"\\nMISST> Downloaded.\")\n                self.retrieve_metadata(temp_dir=temp_dir)\n                thread = threading.Thread(target=MISSTpreprocess.preprocess, args=(self, f\"{temp_dir}/{os.listdir(temp_dir)[0]}\", self.importsDest, self.settings.getSetting(\"chosen_model\"), \"cuda\" if self.settings.getSetting(\"accelerate_on_gpu\") == \"true\" else \"cpu\"), daemon=True)\n                thread.start()\n                thread.join()\n                os.remove(os.path.join(temp_dir, os.listdir(temp_dir)[0]))\n                os.rmdir(temp_dir)\n                self.import_file_button.configure(state=tkinter.NORMAL)\n                self.import_button.configure(state=tkinter.NORMAL)\n                self.source_entry.delete(0, tkinter.END) #Clear entry\n\n            # AppleMusic Import\n            elif self.import_AppleMusic_var.get() == \"on\":\n                self.import_file_button.configure(state=tkinter.DISABLED)\n                self.import_button.configure(state=tkinter.DISABLED)\n                if \"https://music.apple.com/\" not in url:\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Invalid URL.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.update(\"\\nMISST> Downloading\")\n                temp_dir = tempfile.mkdtemp()\n                try:\n                    MISSThelpers.apple_music(url, temp_dir) # Download\n                except:\n                    self.logger.error(traceback.format_exc())\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Error downloading file.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.addLine(\"\\nMISST> Downloaded.\")\n                self.retrieve_metadata(temp_dir=temp_dir)\n                thread = threading.Thread(target=MISSTpreprocess.preprocess, args=(self, f\"{temp_dir}/{os.listdir(temp_dir)[0]}\", self.importsDest, self.settings.getSetting(\"chosen_model\"), \"cuda\" if self.settings.getSetting(\"accelerate_on_gpu\") == \"true\" else \"cpu\"), daemon=True)\n                thread.start()\n                thread.join()\n                os.remove(os.path.join(temp_dir, os.listdir(temp_dir)[0]))\n                os.rmdir(temp_dir)\n                self.import_file_button.configure(state=tkinter.NORMAL)\n                self.import_button.configure(state=tkinter.NORMAL)\n                self.source_entry.delete(0, tkinter.END) #Clear entry\n\n            # Soundcloud Import\n            elif self.import_Soundcloud_var.get() == \"on\":\n                self.import_file_button.configure(state=tkinter.DISABLED)\n                self.import_button.configure(state=tkinter.DISABLED)\n                if \"https://soundcloud.com\" not in url:\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Invalid URL.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.update(\"\\nMISST> Downloading\")\n                temp_dir = tempfile.mkdtemp()\n                cmd = [\n                    os.path.abspath(\"./Assets/Bin/music-dl.exe\"),\n                    \"-v\",\n                    \"-x\",\n                    \"--embed-thumbnail\",\n                    \"--audio-format\",\n                    \"flac\",\n                    \"-o\",\n                    f\"{temp_dir}/%(title)s.%(ext)s\",\n                    f\"{url}\",\n                    \"--ffmpeg-location\",\n                    \"./ffmpeg.exe\"\n                ]\n                process = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, creationflags=0x08000000)\n                if process.returncode != 0:\n                    self.logger.error(process.stderr)\n                    self.console.endUpdate()\n                    self.console.addLine(\"\\nMISST> Error downloading file.\")\n                    self.import_file_button.configure(state=tkinter.NORMAL)\n                    self.import_button.configure(state=tkinter.NORMAL)\n                    return\n                self.console.endUpdate()\n                self.console.addLine(\"\\nMISST> Downloaded.\")\n                self.retrieve_metadata(temp_dir=temp_dir)\n                thread = threading.Thread(target=MISSTpreprocess.preprocess, args=(self, f\"{temp_dir}/{os.listdir(temp_dir)[0]}\", self.importsDest, self.settings.getSetting(\"chosen_model\"), \"cuda\" if self.settings.getSetting(\"accelerate_on_gpu\") == \"true\" else \"cpu\"), daemon=True)\n                thread.start()\n                thread.join()\n                os.remove(os.path.join(temp_dir, os.listdir(temp_dir)[0]))\n                os.rmdir(temp_dir)\n                self.import_file_button.configure(state=tkinter.NORMAL)\n                self.import_button.configure(state=tkinter.NORMAL)\n                self.source_entry.delete(0, tkinter.END) #Clear entry\n\n            else:\n                pass\n        else:\n            self.console.endUpdate()\n            self.console.addLine(\"\\nMISST> Empty URL.\")\n            self.console.update(\"\\nMISST> waiting\")\n            return\n        return\n\n    def change_model(self, model):\n        self.settings.setSetting(\"chosen_model\", model)\n        self.setup = MISSTSetup(self, self.settings.getSetting(\"chosen_model\"))\n        try:\n            self.setup.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n        except:\n            pass\n\n    def draw_settings_frame(self) -> None:\n        \"\"\"\n        Draws the settings frame.\n        \"\"\"\n        self.settings_window = customtkinter.CTkFrame(\n            master=self, width=self.WIDTH * (755 / self.WIDTH), height=self.HEIGHT * (430 / self.HEIGHT), corner_radius=0\n        )\n        self.settings_window.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n\n        self.settings_frame = customtkinter.CTkFrame(\n            master=self.settings_window, width=350, height=380, corner_radius=10\n        )\n        self.settings_frame.place(relx=0.25, rely=0.47, anchor=tkinter.CENTER)\n\n        self.setting_header = customtkinter.CTkLabel(\n            master=self.settings_frame, text=\"Settings\", font=(self.FONT, -18)\n        )\n        self.setting_header.place(relx=0.5, rely=0.1, anchor=tkinter.CENTER)\n\n        self.general_frame = customtkinter.CTkTabview(master=self.settings_frame, width=300, height=160)\n        self.general_frame.place(relx=0.5, rely=0.34, anchor=tkinter.CENTER)\n\n        self.general_frame.add(\"General\")\n        self.general_frame.add(\"Advanced\")\n\n        self.general_header = customtkinter.CTkLabel(\n            master=self.general_frame.tab(\"General\"), text=\"General\", font=(self.FONT, -16)\n        )\n        self.general_header.place(relx=0.2, rely=0.15, anchor=tkinter.CENTER)\n\n        self.autoplay_box = customtkinter.CTkSwitch(\n            master=self.general_frame.tab(\"General\"),\n            text=\"Autoplay\",\n            font=(self.FONT, -12),\n            command=lambda: MISSThelpers.autoplay_event(self),\n            width=50,\n        )\n        self.autoplay_box.place(relx=0.28, rely=0.4, anchor=tkinter.CENTER)\n        if self.settings.getSetting('autoplay') == 'true':\n            self.autoplay_box.select()\n\n        self.rpc_box = customtkinter.CTkSwitch(\n            master=self.general_frame.tab(\"General\"),\n            text=\"Discord RPC\",\n            font=(self.FONT, -12),\n            command=lambda: MISSThelpers.rpc_event(self),\n            width=50,\n        )\n        self.rpc_box.place(relx=0.31, rely=0.625, anchor=tkinter.CENTER)\n        if self.settings.getSetting('rpc') == 'true':\n            self.rpc_box.select()\n\n        self.preprocess_method_box = customtkinter.CTkSwitch(\n            master=self.general_frame.tab(\"General\"),\n            text=\"Accelerate on GPU?\",\n            font=(self.FONT, -12),\n            command=lambda: threading.Thread(target=MISSThelpers.accelerate_event, args=(self,), daemon=True).start(),\n            width=50,\n        )\n        self.preprocess_method_box.place(relx=0.38, rely=0.85, anchor=tkinter.CENTER)\n        if self.settings.getSetting('accelerate_on_gpu') == 'true':\n            self.preprocess_method_box.select()\n\n        ### General Settings ###\n\n        self.storage_frame = customtkinter.CTkFrame(master=self.settings_frame, width=300, height=140)\n        self.storage_frame.place(relx=0.5, rely=0.76, anchor=tkinter.CENTER)\n\n        self.storage_header = customtkinter.CTkLabel(\n            master=self.storage_frame, text=\"Storage\", font=(self.FONT, -16)\n        )\n        self.storage_header.place(relx=0.2, rely=0.15, anchor=tkinter.CENTER)\n\n        self.downloads_header = customtkinter.CTkLabel(\n            master=self.storage_frame, text=\"Downloads:\", font=(self.FONT, -12, \"bold\")\n        )\n        self.downloads_header.place(relx=0.24, rely=0.4, anchor=tkinter.CENTER)\n\n        bytes = MISSThelpers.getsize(MISSThelpers, self.importsDest)\n        gb = bytes / 1000000000\n        gb = round(gb, 2)\n\n        text = str(gb) + \" GB\"\n\n        self.downloads_info = customtkinter.CTkLabel(\n            master=self.storage_frame,\n            text=text,\n            font=(self.FONT, -12),\n            width=25,\n            state=tkinter.DISABLED,\n        )\n        self.downloads_info.place(relx=0.46, rely=0.4, anchor=tkinter.CENTER)\n\n        self.downloads_subheader = customtkinter.CTkLabel(\n            master=self.storage_frame,\n            text=\"Downloaded Content\",\n            font=(self.FONT, -11),\n            state=tkinter.DISABLED,\n        )\n        self.downloads_subheader.place(relx=0.29, rely=0.55, anchor=tkinter.CENTER)\n\n        self.clear_downloads_button = customtkinter.CTkButton(\n            master=self.storage_frame,\n            text=\"Clear Downloads\",\n            font=(self.FONT, -12),\n            width=15,\n            height=2,\n            command=lambda: MISSThelpers.clearDownloads(self)\n        )\n        self.clear_downloads_button.place(relx=0.75, rely=0.475, anchor=tkinter.CENTER)\n\n        self.storage_location_header = customtkinter.CTkLabel(\n            master=self.storage_frame, text=\"Storage Location:\", font=(self.FONT, -12, \"bold\")\n        )\n        self.storage_location_header.place(relx=0.305, rely=0.7, anchor=tkinter.CENTER)\n\n        dir = os.path.abspath(self.importsDest)\n        dirlen = len(dir)\n        n = 20\n        location_text = dir if dirlen <= n else \"...\" + dir[-(n - dirlen) :]\n\n        self.storage_location_info = customtkinter.CTkLabel(\n            master=self.storage_frame,\n            text=location_text,\n            font=(self.FONT, -11),\n            width=25,\n            state=tkinter.DISABLED,\n        )\n        self.storage_location_info.place(relx=0.345, rely=0.85, anchor=tkinter.CENTER)\n\n        self.change_location_button = customtkinter.CTkButton(\n            master=self.storage_frame,\n            text=\"Change Location\",\n            font=(self.FONT, -12),\n            width=15,\n            height=2,\n            command=lambda: MISSThelpers.change_location(self),\n            corner_radius=10,\n        )\n        self.change_location_button.place(relx=0.75, rely=0.775, anchor=tkinter.CENTER)\n\n        ### Advanced Settings ###\n        self.advanced_header = customtkinter.CTkLabel(\n            master=self.general_frame.tab(\"Advanced\"), text=\"Advanced\", font=(self.FONT, -16)\n        )\n        self.advanced_header.place(relx=0.2, rely=0.15, anchor=tkinter.CENTER)\n\n        self.chosen_model_header = customtkinter.CTkLabel(\n            master=self.general_frame.tab(\"Advanced\"), text=\"Model:\", font=(self.FONT, -12, \"bold\")\n        )\n        self.chosen_model_header.place(relx=0.2, rely=0.45, anchor=tkinter.CENTER)\n\n        self.model_select = customtkinter.CTkOptionMenu(\n            master=self.general_frame.tab(\"Advanced\"), \n            font=(self.FONT, -12), \n            width=175, \n            values=[\"hdemucs_mmi\",\n                    \"htdemucs\",\n                    \"htdemucs_ft\",\n                    \"mdx\",\n                    \"mdx_extra\",\n                    \"mdx_extra_q\",\n                    \"mdx_q\",\n                    \"repro_mdx_a\",\n                    \"repro_mdx_a_hybrid_only\",\n                    \"repro_mdx_a_time_only\"]\n        )\n        self.model_select.place(relx=0.65, rely=0.45, anchor=tkinter.CENTER)\n        self.model_select.set(self.settings.getSetting(\"chosen_model\"))\n\n        self.save_model_button = customtkinter.CTkButton(\n            master=self.general_frame.tab(\"Advanced\"),\n            text=\"Download and Save Model\",\n            font=(self.FONT, -12),\n            command=lambda: self.change_model(self.model_select.get()),\n            corner_radius=10,\n            height=15,\n            width=30,\n        )\n        self.save_model_button.place(relx=0.5, rely=0.8, anchor=tkinter.CENTER)\n\n        ### Theme Settings ###\n\n        self.theme_frame = customtkinter.CTkFrame(master=self.settings_window, width=350, height=380)\n        self.theme_frame.place(relx=0.75, rely=0.47, anchor=tkinter.CENTER)\n\n        self.theme_header = customtkinter.CTkLabel(\n            master=self.theme_frame, text=\"Theme\", font=(self.FONT, -18)\n        )\n        self.theme_header.place(relx=0.5, rely=0.1, anchor=tkinter.CENTER)\n\n        self.theme_frame_mini = customtkinter.CTkFrame(master=self.theme_frame, width=300, height=292)\n        self.theme_frame_mini.place(relx=0.5, rely=0.56, anchor=tkinter.CENTER)\n\n        self.button_light = customtkinter.CTkButton(\n            master=self.theme_frame_mini,\n            height=100,\n            width=200,\n            corner_radius=10,\n            border_color=\"white\",\n            fg_color=self.settings.getSetting(\"chosenLightColor\"),\n            hover_color=self.settings.getSetting(\"chosenLightColor\"),\n            border_width=2,\n            text=\"Light\",\n            command=lambda: MISSThelpers.updateTheme(self, \"light\"),\n        )\n        self.button_light.place(relx=0.5, rely=0.25, anchor=tkinter.CENTER)\n\n        self.button_dark = customtkinter.CTkButton(\n            master=self.theme_frame_mini,\n            height=100,\n            width=200,\n            corner_radius=10,\n            border_color=\"white\",\n            fg_color=self.settings.getSetting(\"chosenDarkColor\"),\n            hover_color=self.settings.getSetting(\"chosenDarkColor\"),\n            border_width=2,\n            text=\"Dark\",\n            command=lambda: MISSThelpers.updateTheme(self, \"dark\"),\n        )\n        self.button_dark.place(relx=0.5, rely=0.75, anchor=tkinter.CENTER)\n\n        self.info_label = customtkinter.CTkLabel(\n            master=self.settings_window,\n            text=\"Note: You may need to restart the app for changes to take effect.\",\n            font=(self.FONT, -11),\n            state=tkinter.DISABLED,\n            height=10,\n        )\n        self.info_label.place(relx=0.5, rely=0.95, anchor=tkinter.CENTER)\n\n        self.reset_button = customtkinter.CTkButton(\n            master=self.settings_window,\n            text=\"Reset\",\n            font=(self.FONT, -12, \"underline\"),\n            command=lambda: MISSThelpers.resetSettings(self),\n            fg_color=self.settings_window.cget(\"fg_color\"),\n            hover_color=self.theme_frame.cget(\"fg_color\"),\n            width=25,\n            height=25,\n            text_color=self.info_label.cget(\"text_color\")\n        )\n        self.reset_button.place(relx=0.75, rely=0.95, anchor=tkinter.CENTER)\n\n        self.return_button = customtkinter.CTkButton(\n            master=self.settings_window,\n            command=lambda: self.settings_window.destroy(),\n            image=self.ImageCache[\"return\"],\n            fg_color='transparent',\n            hover_color=self.theme_frame.cget(\"fg_color\"),\n            text=\"\",\n            font=(self.FONT, -14),\n            width=25,\n            height=25,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.return_button.place(relx=0.25, rely=0.95, anchor=tkinter.CENTER)\n\n    def eq_sliders_event(self, curVal:int, curSlider:int, sliders:list) -> None:\n        \"\"\"\n        Event that is called when a slider is moved. If the move sliders together option is enabled, it will move all the sliders together.\n\n        Args:\n            curVal (int): The current value of the slider.\n            curSlider (int): The index of the slider that was moved.\n            sliders (list): A list of all the sliders.\n        \"\"\"\n        self.settings.setSetting(f\"eq_{curSlider+1}\", str(curVal))\n        if self.move_sliders_together.get() == 0:\n            return\n        slider = sliders[curSlider]\n        for slider in sliders:\n            index = sliders.index(slider)\n            distance = abs(index - curSlider)\n            if curVal < 0:\n                multiplier = 1 * distance\n                set = curVal + multiplier\n                slider.set(set if set < 0 else 0)\n                self.settings.setSetting(f\"eq_{index+1}\", str(slider.get()))\n            else:\n                multiplier = -1 * distance\n                set = curVal + multiplier\n                slider.set(set if set > 0 else 0)\n                self.settings.setSetting(f\"eq_{index+1}\", str(slider.get()))\n        return\n        \n    def moveSlidersTogether(self) -> None:\n        \"\"\"\n        Event that is called when the move sliders together option is changed. It will save the setting.\n        \"\"\"\n        self.settings.setSetting(\"eq_move_sliders_together\", \"true\" if str(self.move_sliders_together.get()) == \"1\" else \"false\")\n        return\n    \n    def eqOnOff(self) -> None:\n        \"\"\"\n        Event that is called when the eq on/off button is changed. It will save the setting and enable/disable the eq sliders.\n        \"\"\"\n        self.settings.setSetting(\"eq\", \"true\" if str(self.eqOnOffButton.get()) == \"1\" else \"false\")\n        if self.eqOnOffButton.get() == 0:\n            self.eqOnOffButton.configure(text=\"Off\")\n            for child in self.eq_frame.winfo_children():\n                child.configure(state=tkinter.DISABLED)\n            self.eqOnOffButton.configure(state='normal')\n            self.return_button.configure(state='normal')\n            self.eq_header.configure(state='normal')\n        else:\n            self.eqOnOffButton.configure(text=\"On\")\n            for child in self.eq_frame.winfo_children():\n                child.configure(state='normal')\n        return\n\n    def draw_effects_frame(self) -> None:\n        \"\"\"\n        Draws the effects frame.\n        \"\"\"\n        self.effects_window = customtkinter.CTkFrame(\n            master=self, width=self.WIDTH * (755 / self.WIDTH), height=self.HEIGHT * (430 / self.HEIGHT)\n        )\n        self.effects_window.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)\n\n        self.eq_frame = customtkinter.CTkFrame(master=self.effects_window, width=450, height=350)\n        self.eq_frame.place(relx=0.35, rely=0.5, anchor=tkinter.CENTER)\n\n        self.eq_header = customtkinter.CTkLabel(\n            master=self.eq_frame, text=\"Equalizer\", font=(self.FONT, -16)\n        )\n        self.eq_header.place(relx=0.15, rely=0.12, anchor=tkinter.CENTER)\n\n        self.return_button = customtkinter.CTkButton(\n            master=self.eq_frame,\n            command=lambda: self.effects_window.destroy(),\n            image=self.ImageCache[\"return\"],\n            fg_color='transparent',\n            hover_color=self.effects_window.cget(\"bg_color\"),\n            text=\"\",\n            font=(self.FONT, -14),\n            width=5,\n            text_color=self.logolabel.cget(\"text_color\"),\n        )\n        self.return_button.place(relx=0.87, rely=0.9, anchor=tkinter.CENTER)\n\n        val = 0.02\n        frqs = [\"62 Hz\", \"125 Hz\", \"250 Hz\", \"500 Hz\", \"1 KHz\", \"2.5 KHz\", \"4 KHz\", \"8 KHz\", \"16 KHz\"]\n        sliders = [eq_slider1, eq_slider2, eq_slider3, eq_slider4, eq_slider5, eq_slider6, eq_slider7, eq_slider8, eq_slider9] = [None] * 9\n        for i in range(0, len(sliders)):\n            sliders[i] = customtkinter.CTkSlider(\n                master=self.eq_frame,\n                from_=-12,\n                to=12,\n                number_of_steps=24,\n                orientation=\"vertical\",\n                height=175,\n                command= lambda x, curSlider=i, sliders=sliders: self.eq_sliders_event(x, curSlider, sliders)\n            )\n            sliders[i].set(float(self.settings.getSetting(f\"eq_{i+1}\")))\n            val += 0.1\n            sliders[i].place(relx=val, rely=0.5, anchor=tkinter.CENTER)\n\n        val = 0.02\n        for frq in frqs:\n            eq_label = customtkinter.CTkLabel(\n                master=self.eq_frame, text=frq, font=(self.FONT, -10), state=tkinter.DISABLED\n            )\n            val += 0.1\n            eq_label.place(relx=val, rely=0.8, anchor=tkinter.CENTER)\n\n        self.eq_12dB_label = customtkinter.CTkLabel(\n            master=self.eq_frame, text=\"+12dB\", font=(self.FONT, -10), state=tkinter.DISABLED\n        )\n        self.eq_12dB_label.place(relx=0.05, rely=0.27, anchor=tkinter.CENTER)\n\n        self.eq_6dB_label = customtkinter.CTkLabel(\n            master=self.eq_frame, text=\"+6dB\", font=(self.FONT, -10), state=tkinter.DISABLED\n        )\n        self.eq_6dB_label.place(relx=0.05, rely=0.395, anchor=tkinter.CENTER)\n\n        self.eq_0dB_label = customtkinter.CTkLabel(\n            master=self.eq_frame, text=\"0dB\", font=(self.FONT, -10), state=tkinter.DISABLED\n        )\n        self.eq_0dB_label.place(relx=0.05, rely=0.5, anchor=tkinter.CENTER)\n\n        self.eq_m6dB_label = customtkinter.CTkLabel(\n            master=self.eq_frame, text=\"-6dB\", font=(self.FONT, -10), state=tkinter.DISABLED\n        )\n        self.eq_m6dB_label.place(relx=0.05, rely=0.615, anchor=tkinter.CENTER)\n\n        self.eq_m12dB_label = customtkinter.CTkLabel(\n            master=self.eq_frame, text=\"-12dB\", font=(self.FONT, -10), state=tkinter.DISABLED\n        )\n        self.eq_m12dB_label.place(relx=0.05, rely=0.73, anchor=tkinter.CENTER)\n\n        self.move_sliders_together = customtkinter.CTkCheckBox(\n            master=self.eq_frame, text=\"Move nearby sliders together\", font=(self.FONT, -12), command=lambda: self.moveSlidersTogether()\n        )\n        self.move_sliders_together.place(relx=0.28, rely=0.9, anchor=tkinter.CENTER)\n        if self.settings.getSetting(\"eq_move_sliders_together\") == \"true\":\n            self.move_sliders_together.select()\n            self.moveSlidersTogether()\n        else:\n            self.move_sliders_together.deselect()\n            self.moveSlidersTogether()\n\n        self.eqOnOffButton = customtkinter.CTkSwitch(\n            master=self.eq_frame,\n            text=\"On\",\n            width=50,\n            height=50,\n            font=(self.FONT, -14),\n            command=lambda: self.eqOnOff(),\n        )\n        self.eqOnOffButton.place(relx=0.85, rely=0.12, anchor=tkinter.CENTER)\n        if self.settings.getSetting(\"eq\") == \"true\":\n            self.eqOnOffButton.select()\n            self.eqOnOff()\n        else:\n            self.eqOnOffButton.deselect()\n            self.eqOnOff()\n\n        # Effects\n        self.effects_frame = customtkinter.CTkFrame(master=self.effects_window, width=200, height=350)\n        self.effects_frame.place(relx=0.82, rely=0.5, anchor=tkinter.CENTER)\n\n        self.effects_header = customtkinter.CTkLabel(\n            master=self.effects_frame, text=\"Effects\", font=(self.FONT, -16)\n        )\n        self.effects_header.place(relx=0.5, rely=0.12, anchor=tkinter.CENTER)\n\n        def setEffect(effect, value):\n            self.settings.setSetting(effect, f\"{value}\")\n            if effect == \"speed\":\n                self.speed_slider.set(float(value))\n            elif effect == \"pitch\":\n                self.pitch_slider.set(float(value))\n            elif effect == \"bass\":\n                self.bass_slider.set(float(value))\n            elif effect == \"reverb\":\n                self.reverb_slider.set(float(value))\n\n        # Effect - Speed\n        self.speed_header = customtkinter.CTkLabel(\n            master=self.effects_frame, text=\"Speed\", font=(self.FONT, -14)\n        )\n        self.speed_header.place(relx=0.17, rely=0.23, anchor=tkinter.CENTER)\n\n        self.speed_slider = customtkinter.CTkSlider(\n            master=self.effects_frame,\n            from_=0.25,\n            to=1.75,\n            number_of_steps=6,\n            width=165,\n            height=10,\n            command=lambda x: setEffect(\"speed\", x)\n        )\n        self.speed_slider.set(float(self.settings.getSetting(\"speed\")))\n        self.speed_slider.place(relx=0.5, rely=0.3, anchor=tkinter.CENTER)\n\n        speeds = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75]\n        # create little indicators\n        val = 0\n        for value in speeds:\n            speed_label = customtkinter.CTkLabel(\n                master=self.effects_frame, text=value, font=(self.FONT, -10), state=tkinter.DISABLED\n            )\n            val += 0.125\n            speed_label.place(relx=val, rely=0.37, anchor=tkinter.CENTER)\n\n        # Effect - Pitch\n        self.pitch_header = customtkinter.CTkLabel(\n            master=self.effects_frame, text=\"Pitch\", font=(self.FONT, -14)\n        )\n        self.pitch_header.place(relx=0.17, rely=0.48, anchor=tkinter.CENTER)\n\n        self.pitch_slider = customtkinter.CTkSlider(\n            master=self.effects_frame,\n            from_=-1,\n            to=1,\n            number_of_steps=8,\n            width=165,\n            height=10,\n            command=lambda x: setEffect(\"pitch\", x)\n        )\n        self.pitch_slider.set(float(self.settings.getSetting(\"pitch\")))\n        self.pitch_slider.place(relx=0.5, rely=0.55, anchor=tkinter.CENTER)\n\n        pitch_factors = [-1.0, -0.5, 0.0, 0.5, 1.0]\n        # create little indicators\n        val = -0.06\n        for value in pitch_factors:\n            speed_label = customtkinter.CTkLabel(\n                master=self.effects_frame, text=value, font=(self.FONT, -10), state=tkinter.DISABLED\n            )\n            val += 0.19\n            speed_label.place(relx=val, rely=0.62, anchor=tkinter.CENTER)\n\n        # Effect - Reverb\n        self.reverb_header = customtkinter.CTkLabel(\n            master=self.effects_frame, text=\"Reverb\", font=(self.FONT, -14)\n        )\n        self.reverb_header.place(relx=0.17, rely=0.73, anchor=tkinter.CENTER)\n\n        self.reverb_slider = customtkinter.CTkSlider(\n            master=self.effects_frame,\n            from_=0,\n            to=1.5,\n            number_of_steps=6,\n            width=165,\n            height=10,\n            command=lambda x: setEffect(\"reverb\", x)\n        )\n        self.reverb_slider.set(float(self.settings.getSetting(\"reverb\")))\n        self.reverb_slider.place(relx=0.5, rely=0.8, anchor=tkinter.CENTER)\n\n        reverb_factors = [0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5]\n        # create little indicators\n        val = 0\n        for value in reverb_factors:\n            value = value if value != 0 else \"Off\"\n            reverb_label = customtkinter.CTkLabel(\n                master=self.effects_frame, text=value, font=(self.FONT, -10), state=tkinter.DISABLED\n            )\n            val += 0.125\n            reverb_label.place(relx=val, rely=0.87, anchor=tkinter.CENTER)\n    \n    def imports_check(self, search_entry:customtkinter.CTkEntry, songs_box:customtkinter.CTkTextbox) -> None:\n        \"\"\"\n        Checks for new songs in the imports folder and adds them to the songs box\n\n        Args:\n            search_entry (tkinter.Entry): The search entry\n            songs_box (tkinter.Text): The songs box\n        \"\"\"\n        def add_highlight(text, start, end):\n            text.tag_add(\"start\", start, end)\n            text.tag_config(\"start\", background = self.settings.getSetting(\"chosenLightColor\") if customtkinter.get_appearance_mode() == \"Light\" else self.settings.getSetting(\"chosenDarkColor\"), foreground= \"black\")\n        entry_val = None\n        num = 0\n        songs = []\n        for _ in MISSThelpers.MISSTlistdir(self, self.importsDest):\n            num += 1\n            songs.append(f\"{num}. {_}\")\n        while True:\n            time.sleep(0.25)\n            if self.songlabel.cget(\"text\") == \"Play Something!\":\n                self.export_button.configure(text=\"Nothing Playing\")\n                self.export_button.configure(state=tkinter.DISABLED)\n            else:\n                if (self.export_button.cget(\"text\").startswith(\"Export\")):\n                    pass\n                else:\n                    self.export_button.configure(state=tkinter.NORMAL)\n                    self.export_button.configure(text=\"Export\")\n            if len(MISSThelpers.MISSTlistdir(self, self.importsDest)) != num:\n                num = 0\n                songs = []\n                for _ in MISSThelpers.MISSTlistdir(self, self.importsDest):\n                    num += 1\n                    songs.append(f\"{num}. {_}\")\n                songs_box.configure(state=\"normal\")\n                songs_box.delete(\"0.0\", \"end\")\n                songs_box.insert(\"0.0\", \"\\n\\n\".join(songs))\n                songs_box.configure(state=tkinter.DISABLED)\n            if len(songs) == 0:\n                songs_box.configure(state=\"normal\")\n                songs_box.delete(\"0.0\", \"end\")\n                songs_box.insert(\"0.0\", \"No songs Imported!\")\n                songs_box.configure(state=tkinter.DISABLED)\n            search = search_entry.get()\n            found_songs = []\n            for _ in songs:\n                if search.lower() in _.lower():\n                    found_songs.append(_)\n            if entry_val == search_entry.get():\n                pass\n            else:\n                songs_box.configure(state=\"normal\")\n                songs_box.delete(\"0.0\", \"end\")\n                songs_box.insert(\"0.0\", \"\\n\\n\".join(found_songs))\n                for line in songs_box.get(\"0.0\", \"end\").splitlines():\n                    if search.lower() in line.lower():\n                        start = line.lower().find(search.lower())\n                        end = line.lower().find(search.lower()) + len(search)\n                        line_num = songs_box.get(\"0.0\", \"end\").splitlines().index(line)\n                        add_highlight(songs_box, f\"{line_num + 1}.{start}\", f\"{line_num + 1}.{end}\")\n                songs_box.configure(state=tkinter.DISABLED)\n                entry_val = search_entry.get()\n\n    def play(self, dir:str) -> None:\n        \"\"\"\n        Plays a song\n\n        Args:\n            dir (str): The directory of the song\n        \"\"\"\n        self.player.change_files([\n            f\"{self.importsDest}/{dir}/bass.flac\", \n            f\"{self.importsDest}/{dir}/drums.flac\", \n            f\"{self.importsDest}/{dir}/other.flac\", \n            f\"{self.importsDest}/{dir}/vocals.flac\"\n            ], \n            [self.slider1.get(), \n             self.slider2.get(), \n             self.slider3.get(), \n             self.slider4.get()\n            ]\n        )\n        self.update_UI(\n            f\"{self.importsDest}/{dir}/other.flac\", \n            0\n        )\n\n    def play_search(self, index_label:str, songs:list) -> None:\n        \"\"\"\n        Plays a song from the search box\n\n        Args:\n            index_label (str): The index of the song\n            songs (list): The list of songs\n        \"\"\"\n        self.playbutton.configure(state=tkinter.DISABLED)\n        try:\n            index = int(index_label)\n            song = songs[index - 1]\n            self.playing = True\n            self.effects_checkbox.deselect()\n            self.effects()\n            self.play(song)\n        except:\n            self.logger.error(traceback.format_exc())\n            pass\n        self.playbutton.configure(state=tkinter.NORMAL)\n\n    def export(self, songname:str, sliders:list) -> None:\n        \"\"\"\n        Exports a song\n\n        Args:\n            songname (str): The name of the song\n        \"\"\"\n        file = tkinter.filedialog.asksaveasfilename(initialfile=f\"{songname}.mp3\", filetypes=(('mp3 files', '*.mp3'),('All files', '*.*')))\n        if file == \"\":\n            self.export_button.configure(text=\"Export Cancelled.\")\n            threading.Timer(1.5, lambda: self.export_button.configure(text=\"Export\")).start()\n            return\n        self.export_button.configure(text=\"Exporting...\")\n        self.player.save([\n            f\"{self.importsDest}/{songname}/bass.flac\",\n            f\"{self.importsDest}/{songname}/drums.flac\",\n            f\"{self.importsDest}/{songname}/other.flac\",\n            f\"{self.importsDest}/{songname}/vocals.flac\"\n        ], [\n            sliders[0].get(),\n            sliders[2].get(),\n            sliders[1].get(),\n            sliders[3].get()\n        ], file, MISSTconfig.getConfig(self, f\"{self.importsDest}/{songname}\")[\"image_raw\"]\n        )\n        self.export_button.configure(text=\"Exported!\")\n        threading.Timer(1.5, lambda: self.export_button.configure(text=\"Export\")).start()\n\n    def shuffle(self) -> None:\n        \"\"\"\n        Plays a random song\n        \"\"\"\n        self.shuffle_button.configure(state=tkinter.DISABLED)\n        try:\n            songs = MISSThelpers.MISSTlistdir(self, self.importsDest) \n            random.shuffle(songs)\n            self.playing = True\n            self.effects_checkbox.deselect()\n            self.effects()\n            self.play(songs[0])\n        except:\n            # can ignore this error\n            pass\n        self.shuffle_button.configure(state=tkinter.NORMAL)\n\n    def play_next(self, songName:str) -> None:\n        \"\"\"\n        Plays the next song\n\n        Args:\n            songName (str): The name of the current song\n        \"\"\"\n        self.next_button.configure(state=tkinter.DISABLED)\n        try:\n            songs = MISSThelpers.MISSTlistdir(self, self.importsDest) \n            index = songs.index(songName)\n            self.playing = True\n            self.effects_checkbox.deselect()\n            self.effects()\n            self.play(songs[index + 1])\n        except:\n            # can ignore this error\n            pass\n        self.next_button.configure(state=tkinter.NORMAL)\n\n    def play_previous(self, songName:str) -> None:\n        \"\"\"\n        Plays the previous song\n\n        Args:\n            songName (str): The name of the current song\n        \"\"\"\n        self.previous_button.configure(state=tkinter.DISABLED)\n        try:\n            songs = MISSThelpers.MISSTlistdir(self, self.importsDest) \n            index = songs.index(songName)\n            self.playing = True\n            self.effects_checkbox.deselect()\n            self.effects()\n            self.play(songs[index - 1])\n        except:\n            # can ignore this error\n            pass\n        self.previous_button.configure(state=tkinter.NORMAL)\n\n    def slider_event(self, value:int) -> None:\n        \"\"\"\n        Sets the position of the song\n\n        Args:\n            value (int): The position of the song\n        \"\"\"\n        frames_per_millisecond = self.player.frame_rate / 1000\n        ms = value * 1000\n        frame = int(ms * frames_per_millisecond)\n        self.player.set_position(0, frame)\n        self.player.set_position(1, frame)\n        self.player.set_position(2, frame)\n        self.player.set_position(3, frame)\n        return\n    \n    def effects(self) -> None:\n        \"\"\"\n        Sets the effects state\n        \"\"\"\n        if self.effects_checkbox.get() == 'on':\n            self.player.set_effects(True)\n        else:\n            self.player.set_effects(False)\n    \n    def playpause(self) -> None:\n        \"\"\"\n        Pauses or resumes the song\n        \"\"\"\n        if self.playing == True:\n            self.playpause_button.configure(state=\"normal\", image=self.ImageCache[\"paused\"])\n            self.player.pause()\n            self.playing = False\n            self.progressbar.configure(state=tkinter.DISABLED)\n            self.effects_checkbox.configure(state=tkinter.DISABLED)\n            self.effects_button.configure(state=tkinter.DISABLED)\n            self.effects()\n        else:\n            self.playpause_button.configure(state=\"normal\", image=self.ImageCache[\"playing\"])\n            self.player.resume()\n            self.playing = True\n            self.progressbar.configure(state=\"normal\")\n            self.effects_checkbox.configure(state=\"normal\")\n            self.effects_button.configure(state=\"normal\")\n\n    def loopEvent(self) -> None:\n        \"\"\"\n        Sets the loop state\n        \"\"\"\n        if self.loop == True:\n            self.loop = False\n            self.loop_button.configure(state=\"normal\", image=self.ImageCache[\"loop-off\"])\n        else:\n            self.loop = True\n            self.loop_button.configure(state=\"normal\", image=self.ImageCache[\"loop\"])\n\n    def update_progress_bar(self, current_time:int, total_duration:int) -> None:\n        \"\"\"\n        Updates the progress bar\n\n        Args:\n            current_time (int): The current time of the song\n            total_duration (int): The total duration of the song\n        \"\"\"\n        progress = current_time / total_duration\n        progress_in_seconds = int(progress * total_duration)\n\n        self.progressbar.set(progress_in_seconds)\n        self.progress_label_left.configure(text=f\"{str(datetime.timedelta(seconds=progress_in_seconds))[2:7]}\")\n        self.progress_label_right.configure(text=f\"{str(datetime.timedelta(seconds=total_duration))[2:7]}\")\n        \n    def update_UI(self, audioPath:str, start_ms:int) -> None:\n        \"\"\"\n        Updates the UI\n\n        Args:\n            audioPath (str): The path to the song\n            start_ms (int): The start time of the song\n        \"\"\"\n        try:\n            self.lyrics_window.destroy() # Destroy the lyrics window if it exists\n        except:\n            pass\n        try:\n            self.next_button.configure(state=\"normal\")\n            self.previous_button.configure(state=\"normal\")\n            self.playpause_button.configure(state=\"normal\")\n            self.effects_checkbox.configure(state=\"normal\")\n            self.effects_button.configure(state=\"normal\")\n            self.effects_checkbox.deselect()\n            self.effects()\n\n            if self.playing == True:\n                self.playpause_button.configure(image=self.ImageCache[\"playing\"])\n            else:\n                self.playpause_button.configure(image=self.ImageCache[\"paused\"])\n        except:\n            pass # This is just to prevent errors when the player is closed or the song is changed before the UI is updated.\n\n        self.songlabel.configure(text=\"\")\n        song_name = os.path.basename(os.path.dirname(audioPath))\n        song_dir = os.path.dirname(audioPath)\n        config = MISSTconfig(song_dir)\n\n        self.next_button.configure(command=lambda: self.play_next(song_name))\n        self.previous_button.configure(command=lambda: self.play_previous(song_name))\n        try:\n            byte_string = config.getConfig(song_dir)[\"image_raw\"]\n            byte_data = base64.b64decode(byte_string)\n            byte_stream = io.BytesIO(byte_data)\n            byte_stream.seek(0)\n            cover_art = customtkinter.CTkImage(Image.open(byte_stream), size=(40, 40))\n        except:\n            self.logger.error(traceback.format_exc())\n            self.logger.error(\"No cover art found.\")\n            cover_art = self.ImageCache[\"no-cover-art\"]\n\n        namelen = len(song_name)\n        n = 30\n        shortname = song_name if namelen <= n else song_name[:(n - namelen)] + \"...\"\n        self.current_song = song_name\n\n        self.songlabel.configure(text=shortname)\n        self.songlabel.configure(image=cover_art)\n\n        duration = int(self.player.duration)\n        self.progressbar.configure(from_=0, to=duration, state=\"normal\")\n        self.progressbar.set(start_ms // 1000)\n\n        # Define a variable to track the current time\n        current_time = start_ms // 1000\n\n        MISSThelpers.update_rpc(\n            self,\n            Ltext=\"Listening to separated audio\",\n            Dtext=song_name,\n            image=config.getConfig(song_dir)[\"image_url\"],\n            large_text=song_name,\n            end_time=time.time() + duration,\n            small_image=\"icon-0\",\n        )\n\n        self.progressbar_active = False\n\n        def reset_to_default():\n            self.logger.info(\"No more songs to play. Returning to default state.\")\n            self.playpause_button.configure(image=self.ImageCache[\"paused\"], state=tkinter.DISABLED)\n            self.playing = False\n            self.progressbar.configure(state=tkinter.DISABLED)\n            self.effects_checkbox.configure(state=tkinter.DISABLED)\n            self.effects_button.configure(state=tkinter.DISABLED)\n            self.progressbar.set(0)\n            self.progress_label_left.configure(text=\"00:00\")\n            self.progress_label_right.configure(text=\"00:00\")\n            self.songlabel.configure(text=\"Play Something!\", image=self.ImageCache[\"empty\"])\n            self.next_button.configure(state=tkinter.DISABLED)\n            self.previous_button.configure(state=tkinter.DISABLED)\n            MISSThelpers.update_rpc(\n                self,\n                Ltext=\"Idle\",\n                Dtext=\"Nothing is playing\",\n                image=\"icon-0\",\n                large_text=\"MISST\",\n            )    \n        \n        def on_end():\n            if self.loop == True:\n                try:\n                    self.play(song_name)\n                except:\n                    self.logger.error(traceback.format_exc())\n                    reset_to_default()\n            elif self.autoplay == True:\n                try:\n                    songs = MISSThelpers.MISSTlistdir(self, self.importsDest) \n                    index = songs.index(song_name)\n                    self.playing = True\n                    self.effects_checkbox.deselect()\n                    self.effects()\n                    self.play(songs[index + 1])\n                except:\n                    self.logger.error(traceback.format_exc())\n                    reset_to_default()      \n            else:\n                reset_to_default()\n\n        def update_progress():\n            nonlocal current_time\n            while True:\n                time.sleep(0.1) # Update the progress bar every 100ms\n                # Update the progress bar\n                current_time = self.player.get_position(3)\n                self.update_progress_bar(current_time, duration)\n                # Increment the current time only if the user hasn't interacted with the progress bar\n                if self.playing == False:\n                    MISSThelpers.update_rpc(\n                        self,\n                        Ltext=\"(Paused)\",\n                        Dtext=song_name,\n                        image=config.getConfig(song_dir)[\"image_url\"],\n                        large_text=song_name,\n                        end_time=None,\n                        small_image=\"icon-0\",\n                    )\n                if not self.progressbar_active and self.playing == True:\n                    MISSThelpers.update_rpc(\n                        self,\n                        Ltext=\"Listening to separated audio\",\n                        Dtext=song_name,\n                        image=config.getConfig(song_dir)[\"image_url\"],\n                        large_text=song_name,\n                        end_time=time.time() + duration - current_time,\n                        small_image=\"icon-0\",\n                    )\n                if current_time >= duration:\n                    stop_update_thread()\n                    on_end()\n                    return\n\n        def stop_update_thread():\n            try:\n                if self.update_timer:\n                    MISSThelpers.terminate_thread(self, self.update_timer)\n            except:\n                pass # Can ignore this error because the threads pointer is killed when this function is called (which is when a new song is played)\n\n        def on_progressbar_drag_start(event):\n            self.progressbar_active = True\n\n        def on_progressbar_drag_stop(event):\n            nonlocal current_time\n            self.progressbar_active = False\n            # Update the current time based on the user's selection\n            current_time = self.progressbar.get()\n\n        # Bind the drag start and drag stop events to the progress bar\n        self.progressbar.bind(\"<ButtonPress-1>\", on_progressbar_drag_start)\n        self.progressbar.bind(\"<ButtonRelease-1>\", on_progressbar_drag_stop)\n\n        # Stop the previous update thread if it exists\n        stop_update_thread()\n\n        # Start the progress update timer\n        self.update_timer = threading.Thread(target=update_progress, daemon=True)\n        self.update_timer.start()\n\nif __name__ == \"__main__\":\n    app = MISSTapp()\n    MISSThelpers.update_rpc(app, Ltext=\"Idle\", Dtext=\"Nothing is playing\")\n    app.mainloop()"
  },
  {
    "path": "MISST/MISSThelpers.py",
    "content": "import ctypes\nimport os\nimport platform\nimport re\nimport shutil\nimport sys\nimport threading\nimport time\nimport tkinter\nimport uuid\nfrom colorsys import hls_to_rgb, rgb_to_hls\n\nimport customtkinter\nimport demucs\nimport music_tag\nimport psutil\nimport requests\nimport torch\nfrom MISSTplayer import MISSTplayer\nfrom MISSTsettings import MISSTsettings\nfrom vcolorpicker import getColor, hex2rgb, rgb2hex, useLightTheme\n\n\nclass MISSTconsole():\n    \"\"\"\n    A class to handle the console output of MISST\n    \"\"\"\n    def __init__(self, terminal:customtkinter.CTkTextbox, ogText:str) -> None:\n        \"\"\"\n        Parameters\n\n        terminal : tkinter.Text\n            The tkinter.Text widget to be used as the console\n        ogText : str\n            The original text to be displayed in the console\n        \"\"\"\n        self.consoleText = ogText\n        self.terminal = terminal\n        self.curThread = None\n        self.terminal.delete(\"0.0\", \"end\")  # delete all text\n        self.terminal.insert(\"0.0\", self.consoleText)\n        self.terminal.configure(state=\"disabled\")\n\n    def updateThread(self, text:str) -> None:\n        \"\"\"\n        A thread to update the console text\n\n        Args:\n            text (str): The text to be added to the console\n        \"\"\"\n        t = 0\n        while True:\n            time.sleep(0.5)\n            if t > 3:\n                t -= t\n            periods = [\"\", \".\", \"..\", \"...\"]\n            self.terminal.configure(state=\"normal\")\n            self.terminal.delete(\"0.0\", \"end\")\n            self.terminal.insert(\"0.0\", f\"{self.consoleText}{text}{periods[t]}\")\n            self.terminal.configure(state=\"disabled\")\n            t += 1\n\n    def update(self, text:str) -> None:\n        \"\"\"\n        Update the console text\n\n        Args:\n            text (str): The text to be added to the console\n        \"\"\"\n        self.curThread = threading.Thread(target=self.updateThread, args=(text,), daemon=True)\n        self.curThread.start()\n\n    def endUpdate(self) -> None:\n        \"\"\"\n        End the update thread\n\n        Args:\n            text (str): The text to be added to the console\n        \"\"\"\n        MISSThelpers.terminate_thread(self, self.curThread)\n        self.terminal.configure(state=\"normal\")\n        self.terminal.delete(\"0.0\", \"end\")\n        self.terminal.insert(\"0.0\", self.consoleText)\n        self.terminal.configure(state=\"disabled\")\n\n    def addLine(self, text:str) -> None:\n        \"\"\"\n        Add a line to the console\n\n        Args:\n            text (str): The text to be added to the console\n        \"\"\"\n        self.consoleText += f\"{text}\"\n        self.terminal.configure(state=\"normal\")\n        self.terminal.delete(\"0.0\", \"end\")\n        self.terminal.insert(\"0.0\", self.consoleText)\n        self.terminal.configure(state=\"disabled\")\n\n    def editLine(self, text:str, line_number:int) -> None:\n        \"\"\"\n        Edit a line in the console\n\n        Args:\n            text (str): The text to be added to the console\n            line_number (int): The line number to be edited\n        \"\"\"\n        self.consoleText = text\n        self.terminal.configure(state=\"normal\")\n        self.terminal.delete(f\"{line_number + 1}.0\", f\"end\")\n        self.terminal.insert(f\"{line_number + 1}.0\", text)\n        self.terminal.configure(state=\"disabled\")\n\nclass MISSThelpers():\n    \"\"\"\n    A class filled with helper methods for MISST\n    \"\"\"\n    def update_rpc(\n        self,\n        Ltext:str = None,\n        Dtext:str = None,\n        image:str = \"icon-0\",\n        large_text:str = \"MISST\",\n        end_time:int = None,\n        small_image:str = None,\n    ) -> None:\n        \"\"\"\n        Update the Discord Rich Presence\n\n        Args:\n            Ltext (str, optional): The large text to be displayed. Defaults to None.\n            Dtext (str, optional): The details text to be displayed. Defaults to None.\n            image (str, optional): The image to be displayed. Defaults to \"icon-0\".\n            large_text (str, optional): The large text to be displayed. Defaults to \"MISST\".\n            end_time (int, optional): The end time of the activity. Defaults to None.\n            small_image (str, optional): The small image to be displayed. Defaults to None.\n        \"\"\"\n        start_time = time.time()\n        if self.RPC_CONNECTED:\n            try:\n                self.RPC.update(\n                    large_image=image,\n                    small_image=small_image,\n                    start=start_time,\n                    end=end_time,\n                    large_text=large_text,\n                    state=Ltext,\n                    details=Dtext,\n                )\n            except:\n                return\n        return\n    \n    def apple_music(url:str, outdir:str) -> None:\n        \"\"\"\n        Download an Apple Music song\n\n        Args:\n            url (str): The Apple Music song URL\n            outdir (str): The output directory\n        \"\"\"\n        host = 'https://api.fabdl.com'\n        info = requests.get(host + '/apple-music/get?url=', params={'url': url}).json()['result']\n        convert_task = requests.get(host + f'/apple-music/mp3-convert-task/{info[\"gid\"]}/{info[\"id\"]}')\n        tid = convert_task.json()['result']['tid']\n        convert_task = requests.get(host + f'/apple-music/mp3-convert-progress/{tid}')\n        r = requests.get(host + convert_task.json()['result']['download_url'])  \n        with open(f\"{outdir}/{info['artists'] + ' - ' + info['name']}.mp3\", 'wb') as f:\n            f.write(r.content)\n        try:\n            audiofile = music_tag.load_file(f\"{outdir}/{info['artists'] + ' - ' + info['name']}.mp3\")\n            audiofile['artwork'] = requests.get(info['image']).content\n            audiofile.save()\n        except:\n            pass\n\n    def change_theme(theme:str) -> None:\n        \"\"\"\n        Change the theme of the application\n\n        Args:\n            theme (str): The theme to be changed to\n        \"\"\"\n        customtkinter.set_appearance_mode(theme)\n\n    def checkbox_event(checkbox:customtkinter.CTkCheckBox, export_slider:customtkinter.CTkSlider, sound:str, player:MISSTplayer, slider:customtkinter.CTkSlider) -> None:\n        \"\"\"\n        Change the volume of a sound\n\n        Args:\n            checkbox (tkinter.Checkbutton): The checkbox\n            sound (str): The sound to be changed\n            player (MISSTplayer): The sound player\n            slider (tkinter.Scale): The volume slider\n        \"\"\"\n        if checkbox.get() == \"on\":\n            player.set_volume(sound, slider.get())\n        else:\n            slider.set(0)\n            player.set_volume(sound, slider.get())\n\n        MISSThelpers.slider_event(slider.get(), export_slider, sound, player, checkbox)\n\n    def slider_event(value:int, export_slider:customtkinter.CTkSlider, sound:str, player:MISSTplayer, checkbox:customtkinter.CTkCheckBox) -> None:\n        \"\"\"\n        Change the volume of a sound\n\n        Args:\n            value (int): The volume value\n            sound (str): The sound to be changed\n            player (MISSTplayer): The sound player\n            checkbox (tkinter.Checkbutton): The checkbox\n        \"\"\"\n        settings = MISSTsettings()\n        export_slider[0].set(value)\n        if value >= 0.01:\n            checkbox.set(\"on\")\n            export_slider[1].configure(border_color=settings.getSetting(\"chosenLightColor\") if customtkinter.get_appearance_mode() == \"Light\" else settings.getSetting(\"chosenDarkColor\"))\n            player.set_volume(sound, value)\n        else:\n            checkbox.set(\"off\")\n            export_slider[1].configure(border_color=\"#3E454A\")\n            player.set_volume(sound, value)\n    \n    def MISSTlistdir(self, directory:str) -> list:\n        \"\"\"\n        List all MISST folders in a directory\n\n        Args:\n            directory (str): The directory to be searched\n        \"\"\"\n        try:\n            os_list = os.listdir(directory)\n            misst_list = []\n            for _ in os_list:\n                required_files = [\"bass.flac\", \"drums.flac\", \"other.flac\", \"vocals.flac\", \".misst\"]\n                found = 0\n                for file in required_files:\n                    if os.path.isfile(f\"{directory}/{_}/{file}\"):\n                        found += 1\n                if len(required_files) == found:\n                    misst_list.append(_)\n            return misst_list\n        except:\n            return []\n        \n    def getsize(self, dir:str) -> int:\n        \"\"\"\n        Get the size of a directory\n\n        Args:\n            dir (str): The directory to be searched\n        \"\"\"\n        total = 0\n        for entry in os.scandir(dir):\n            if entry.is_file():\n                total += entry.stat().st_size\n            elif entry.is_dir():\n                total += self.getsize(self, entry.path)\n        return total\n\n    def adjust_color_lightness(r:int, g:int, b:int, factor:int) -> str:\n        \"\"\"\n        Adjust the lightness of a color\n\n        Args:\n            r (int): The red value\n            g (int): The green value\n            b (int): The blue value\n            factor (int): The factor to be adjusted by\n        \"\"\"\n        h, l, s = rgb_to_hls(r / 255.0, g / 255.0, b / 255.0)\n        l = max(min(l * factor, 1.0), 0.0)\n        r, g, b = hls_to_rgb(h, l, s)\n        return f\"#{rgb2hex(int(r * 255), int(g * 255), int(b * 255))}\"\n    \n    def darken_color(r:int, g:int, b:int, factor:int = 0.1) -> str:\n        \"\"\"\n        Darken a color\n\n        Args:\n            r (int): The red value\n            g (int): The green value\n            b (int): The blue value\n            factor (int, optional): The factor to be darkened by. Defaults to 0.1.\n        \"\"\"\n        return MISSThelpers.adjust_color_lightness(r, g, b, 1 - factor)\n\n    def updateTheme(self, color:str) -> str: \n        \"\"\"\n        Update the theme of the application\n\n        Args:\n            color (str): The color to be changed\n        \"\"\"\n        if color == \"light\":\n            cur_color = self.settings.getSetting(\"chosenLightColor\")\n            old_color = (hex2rgb(cur_color.replace(\"#\", \"\")))\n            useLightTheme(True if customtkinter.get_appearance_mode() == \"Light\" else False)\n            self.withdraw() # Hide the window\n            chosen_color = f\"#{rgb2hex(getColor(old_color))}\"\n            self.deiconify() # Show the window\n            rgb_chosen = hex2rgb(chosen_color.replace(\"#\", \"\"))\n            self.settings.setSetting(\"chosenLightColor\", chosen_color)\n            self.settings.setSetting(\"chosenLightHoverColor\", MISSThelpers.darken_color(rgb_chosen[0], rgb_chosen[1], rgb_chosen[2], 0.2))\n            self.settings.setSetting(\"chosenLightDarker\", MISSThelpers.darken_color(rgb_chosen[0], rgb_chosen[1], rgb_chosen[2], 0.35))\n            self.settings.applyThemeSettings(\"./Assets/Themes/MISST.json\", \"./Assets/Themes/maluableJSON\")\n            self.button_light.configure(fg_color=chosen_color, hover_color=chosen_color)\n        else:\n            cur_color = self.settings.getSetting(\"chosenDarkColor\")\n            old_color = (hex2rgb(cur_color.replace(\"#\", \"\")))\n            useLightTheme(True if customtkinter.get_appearance_mode() == \"Light\" else False)\n            self.withdraw() # Hide the window\n            chosen_color = f\"#{rgb2hex(getColor(old_color))}\"\n            self.deiconify() # Show the window\n            rgb_chosen = hex2rgb(chosen_color.replace(\"#\", \"\"))\n            self.settings.setSetting(\"chosenDarkColor\", chosen_color)\n            self.settings.setSetting(\"chosenDarkHoverColor\", MISSThelpers.darken_color(rgb_chosen[0], rgb_chosen[1], rgb_chosen[2], 0.2))\n            self.settings.setSetting(\"chosenDarkDarker\", MISSThelpers.darken_color(rgb_chosen[0], rgb_chosen[1], rgb_chosen[2], 0.35))\n            self.settings.applyThemeSettings(\"./Assets/Themes/MISST.json\", \"./Assets/Themes/maluableJSON\")\n            self.button_dark.configure(fg_color=chosen_color, hover_color=chosen_color)\n        return chosen_color\n    \n    def resetSettings(self) -> None:\n        \"\"\"\n        Reset the settings of the application\n        \"\"\"\n        cuda = torch.cuda.is_available()\n        self.settings.resetDefaultTheme(\"./Assets/Themes/MISST.json\", \"./Assets/Themes/maluableJSON\")\n        self.settings.setSetting(\"rpc\", \"true\")\n        self.settings.setSetting(\"autoplay\", \"true\")\n        self.settings.setSetting(\"accelerate_on_gpu\", \"true\" if cuda else \"false\")\n        self.rpc_box.select()\n        self.autoplay_box.select()\n        self.preprocess_method_box.select() if cuda else self.preprocess_method_box.deselect()\n        self.button_light.configure(fg_color=self.settings.getSetting(\"defaultLightColor\"), hover_color=self.settings.getSetting(\"defaultLightColor\"))\n        self.button_dark.configure(fg_color=self.settings.getSetting(\"defaultDarkColor\"), hover_color=self.settings.getSetting(\"defaultDarkColor\"))\n        self.model_select.set(\"htdemucs\")\n        self.settings.setSetting(\"chosen_model\", \"htdemucs\")\n        self.change_model(self.model_select.get())\n\n    def autoplay_event(self) -> None:\n        \"\"\"\n        Event for when the autoplay box is checked\n        \"\"\"\n        if self.autoplay_box.get() == 1:\n            self.settings.setSetting(\"autoplay\", \"true\")\n        else:\n            self.settings.setSetting(\"autoplay\", \"false\")\n\n    def rpc_event(self) -> None:\n        \"\"\"\n        Event for when the rpc box is checked\n        \"\"\"\n        if self.rpc_box.get() == 1:\n            self.settings.setSetting(\"rpc\", \"true\")\n        else:\n            self.settings.setSetting(\"rpc\", \"false\")\n\n    def accelerate_event(self) -> None:\n        \"\"\"\n        Event for when the accelerate box is checked\n        \"\"\"\n        if self.preprocess_method_box.get() == 1 and torch.cuda.is_available() == True:\n            self.settings.setSetting(\"accelerate_on_gpu\", \"true\")\n        elif self.preprocess_method_box.get() == 1 and torch.cuda.is_available() == False:\n            self.preprocess_method_box.deselect()\n            self.preprocess_method_box.place(relx=0.39, rely=0.85, anchor=tkinter.CENTER)\n            self.preprocess_method_box.configure(text=\"CUDA Not Available\")\n            self.settings.setSetting(\"accelerate_on_gpu\", \"false\")\n            time.sleep(1.5)\n            self.preprocess_method_box.place(relx=0.38, rely=0.85, anchor=tkinter.CENTER)\n            self.preprocess_method_box.configure(text=\"Accelerate on GPU?\")\n        else:\n            self.settings.setSetting(\"accelerate_on_gpu\", \"false\")\n\n    def clearDownloads(self) -> None:\n        \"\"\"\n        Clear the downloads folder\n        \"\"\"\n        self.confirmation_frame = customtkinter.CTkFrame(\n            master=self.settings_window, width=350, height=350, corner_radius=0\n        )\n        self.confirmation_frame.place(relx=0.25, rely=0.5, anchor=tkinter.CENTER)\n\n        self.confirmation_header = customtkinter.CTkLabel(\n            master=self.confirmation_frame, text=\"Are you sure?\", font=(self.FONT, -16)\n        )\n        self.confirmation_header.place(relx=0.5, rely=0.45, anchor=tkinter.CENTER)\n        self.confirmation_yes = customtkinter.CTkButton(\n            master=self.confirmation_frame,\n            text=\"Yes\",\n            font=(self.FONT, -12),\n            command=lambda: clear(),\n            width=80,\n        )\n        self.confirmation_yes.place(relx=0.35, rely=0.55, anchor=tkinter.CENTER)\n        self.confirmation_no = customtkinter.CTkButton(\n            master=self.confirmation_frame,\n            text=\"No\",\n            font=(self.FONT, -12),\n            command=lambda: self.confirmation_frame.destroy(),\n            width=80,\n        )\n        self.confirmation_no.place(relx=0.65, rely=0.55, anchor=tkinter.CENTER)\n        def clear():\n            try:\n                shutil.rmtree(self.importsDest)\n                os.mkdir(self.importsDest)\n                self.confirmation_frame.destroy()\n                bytes = MISSThelpers.getsize(MISSThelpers, self.importsDest)\n                gb = bytes / 1000000000\n                gb = round(gb, 2)\n                text = str(gb) + \" GB\"\n                self.downloads_info.configure(text=text)\n            except:\n                pass\n\n    def change_location(self) -> None:\n        \"\"\"\n        Change the location of the downloads folder\n        \"\"\"\n        try:\n            importsdest_nocheck = tkinter.filedialog.askdirectory(\n                initialdir=os.path.abspath(self.importsDest)\n            )\n            importsdest_nocheck = importsdest_nocheck.replace(\"\\\\\", \"/\")\n            if importsdest_nocheck != \"\" and os.path.isdir(\n                os.path.abspath(importsdest_nocheck)\n            ):\n                dummypath = os.path.join(importsdest_nocheck, str(uuid.uuid4()))\n                try:\n                    with open(dummypath, \"w\"):\n                        pass\n                    os.remove(dummypath)\n                    importsdest = importsdest_nocheck\n                except IOError:\n                    importsdest = os.path.abspath(importsdest)\n                self.settings.setSetting(\"importsDest\", importsdest)\n                self.importsDest = importsdest\n                dir = os.path.abspath(self.importsDest)\n                dirlen = len(dir)\n                n = 20\n                location_text = dir if dirlen <= n else \"...\" + dir[-(n - dirlen) :]\n                self.storage_location_info.configure(text=location_text)\n                return None\n            else:\n                self.importsDest = os.path.abspath(self.importsDest)\n                return None\n        except Exception as e:\n            print(e)\n            self.importsDest = os.path.abspath(self.importsDest)\n            return None\n\n    def loading_label(label:customtkinter.CTkLabel, text:str, og_text:str = \"\") -> None:\n        \"\"\"\n        Loading animation for the settings window\n\n        Args:\n            label (tkinter.Label): The label to animate\n            text (str): The text to append to the label\n            og_text (str, optional): The original text of the label. Defaults to \"\".\n        \"\"\"\n        t = 0\n        try:\n            while True:\n                time.sleep(0.5)\n                if label.cget(\"text\") == \"\":\n                    break\n                if t > 3:\n                    t -= t\n                periods = [\"\", \".\", \"..\", \"...\"]\n                label.configure(text=f\"{og_text}{text}{periods[t]}\")\n                t += 1\n        except:\n            pass\n        return\n    \n    def GenerateSystemInfo(self) -> str:\n        \"\"\"\n        Generate system info for the settings window\n        \"\"\"\n        info = \"\"\n        info += \"Python version:\\t%s\\n\" % sys.version\n        info += \"System:\\t%s\\n\" % platform.platform()\n        info += \"CPU:\\t%s\\n\" % platform.processor()\n        info += \"Memory:\\t%.3fMB\\n\" % (psutil.virtual_memory().total / 1048576)\n        info += \"PyTorch version:\\t%s\\n\" % torch.__version__\n        info += \"CUDA available:\\t%s\\n\" % torch.cuda.is_available()\n        if torch.cuda.is_available():\n            for i in range(torch.cuda.device_count()):\n                info += \"CUDA %d:\\t%s\\n\" % (i, re.findall(\"\\\\((.*)\\\\)\", str(torch.cuda.get_device_properties(i)))[0])\n        info += \"Demucs version:\\t%s\\n\" % demucs.__version__\n        info += \"FFMpeg available:\\t%s\\n\" % self.FFMpegAvailable\n        info += \"MISST version:\\t%s\\n\" % self.version\n        return info\n    \n    def freeimage_upload(self, img:str) -> str:\n        \"\"\"\n        Upload an image to freeimage.host\n\n        Args:\n            img (str): The path to the image\n        \"\"\"\n        key = \"6d207e02198a847aa98d0a2a901485a5\"\n\n        response = requests.post(\n            url=\"https://freeimage.host/api/1/upload\",\n            data={\"key\": key},\n            files={\"source\": img},\n        )\n        if not response.ok:\n            raise Exception(\"Error uploading image\", response.json())\n\n        return response.json()[\"image\"][\"url\"]\n    \n    def terminate_thread(self, thread:threading.Thread) -> None:\n        \"\"\"\n        Terminate a thread\n\n        Args:\n            thread (threading.Thread): The thread to terminate\n        \"\"\"\n        if not thread.is_alive():\n            return\n\n        exc = ctypes.py_object(SystemExit)\n        res = ctypes.pythonapi.PyThreadState_SetAsyncExc(\n            ctypes.c_long(thread.ident), exc)\n        if res == 0:\n            raise ValueError(\"nonexistent thread id\")\n        elif res > 1:\n            # \"\"\"if it returns a number greater than one, you're in trouble,\n            # and you should call it again with exc=NULL to revert the effect\"\"\"\n            ctypes.pythonapi.PyThreadState_SetAsyncExc(thread.ident, None)\n            raise SystemError(\"PyThreadState_SetAsyncExc failed\")"
  },
  {
    "path": "MISST/MISSTlogger.py",
    "content": "import datetime\r\nimport logging\r\nimport sys\r\n\r\n\r\nclass MISSTlogger:\r\n    \"\"\"\r\n    MISSTlogger class\r\n    \"\"\"\r\n    def __init__(self) -> None:\r\n        \"\"\"\r\n        Initialize the logger\r\n        \"\"\"\r\n        loggerName = \"MISST\"\r\n        logFormatter = logging.Formatter(fmt=\" %(name)s :: %(levelname)-8s :: %(message)s\")\r\n        self.logger = logging.getLogger(loggerName)\r\n\r\n        logging.basicConfig(\r\n            filename=\"MISST.log\",\r\n            filemode=\"a\",\r\n            format=\" %(name)s :: %(levelname)-8s :: %(message)s\",\r\n            level=logging.INFO,\r\n        )\r\n\r\n        consoleHandler = logging.StreamHandler()\r\n        consoleHandler.setFormatter(logFormatter)\r\n\r\n        self.logger.addHandler(consoleHandler)\r\n        self.logger.info(f'Logger initialized ({str(datetime.datetime.now()).split(\".\")[0]})')\r\n\r\n        sys.excepthook = self.handler\r\n    \r\n    def handler(self, type, value, tb) -> None:\r\n        self.logger.exception(\"Uncaught exception: {0}\".format(str(value)))"
  },
  {
    "path": "MISST/MISSTplayer.py",
    "content": "import base64\nimport io\nimport threading\nfrom typing import List\n\nimport music_tag  # for exporting song metadata\nimport numpy as np\nimport pyaudio\nimport soundfile as sf\nfrom MISSTsettings import MISSTsettings\nfrom scipy.signal import butter, fftconvolve, filtfilt\n\n\nclass MISSTplayer:\n    \"\"\"\n    MISSTplayer class\n    \"\"\"\n    def __init__(self, files:list, volumes:list) -> None:\n        \"\"\"\n        Initialize the player\n\n        Args:\n            files (list): List of file paths\n            volumes (list): List of volume values\n        \"\"\"\n        self.files = files\n        self.p = pyaudio.PyAudio()\n        self.streams = []\n        self.paused = False\n        self.positions = [0] * len(files)\n        self.volumes = volumes\n        self.chunk_size = 1024\n        self.effects = False\n        self.settings = MISSTsettings()\n        self.bands = lambda: [self.settings.getSetting(f\"eq_{n}\") for n in range(1,10)] # lambda so the player can access the latest information \n        self.eq = lambda: True if self.settings.getSetting(\"eq\") == \"true\" else False\n        self.center_freqs = [62, 125, 250, 500, 1_000, 2_500, 4_000, 8_000, 16_000] # 62 Hz, 125 Hz, 250 Hz, 500 Hz, 1 KHz, 2.5 KHz, 4 KHz, 8 KHz, 16 KHz\n\n        for file in self.files:\n            data, self.frame_rate = sf.read(file, dtype='int16')\n            self.duration = len(data) / self.frame_rate\n            self.channels = data.shape[1]\n            stream = self.p.open(format=self.p.get_format_from_width(2),\n                                 channels=self.channels,\n                                 rate=self.frame_rate,\n                                 output=True)\n            self.streams.append(stream)\n\n        reverb_length = int(self.frame_rate * 0.3)\n        self.impulse_response = self.generate_impulse_response(reverb_length, 0.5)\n        self.reverb_tails = [np.zeros(self.chunk_size, dtype=np.float32) for _ in self.streams]\n\n    def play(self) -> None:\n        \"\"\"\n        Play the audio\n        \"\"\"\n        self.paused = False\n        while not self.paused:\n            for i, stream in enumerate(self.streams):\n                data = self.get_data(i)\n                if data:\n                    stream.write(data)\n                else:\n                    break\n    \n    def get_data(self, stream_index:int) -> bytes:\n        \"\"\"\n        Get the audio data\n\n        Args:\n            stream_index (int): Index of the stream\n        \"\"\"\n        data, _ = sf.read(self.files[stream_index], dtype='int16', start=self.positions[stream_index], frames=self.chunk_size)\n        if len(data) > 0:\n            self.positions[stream_index] += len(data)\n            data = self.adjust_volume(data, self.volumes[stream_index])\n            if self.effects == True:\n                try:\n                    data = self.apply_effects(data, float(self.settings.getSetting(\"speed\")),\n                                                    float(self.settings.getSetting(\"reverb\")),\n                                                    float(self.settings.getSetting(\"pitch\")),\n                                                    stream_index)\n                except:\n                    # json error\n                    pass\n            try:\n                if self.eq() == True:\n                        data = self.apply_eq(data)  # apply eq last so it can be applied to nightcore data as well\n            except:\n                # json error\n                pass\n        return data\n    \n    def get_position(self, stream_index:int) -> float:\n        \"\"\"\n        Get the position of the audio\n\n        Args:\n            stream_index (int): Index of the stream\n        \"\"\"\n        return self.positions[stream_index] / float(self.frame_rate)\n    \n    def adjust_volume(self, data:bytes, volume:float) -> bytes:\n        \"\"\"\n        Adjust the volume of the audio\n\n        Args:\n            data (bytes): Audio data\n            volume (float): Volume value\n        \"\"\"\n        data = bytearray(data)\n        for i in range(0, len(data), 2):\n            sample = int.from_bytes(data[i:i+2], byteorder='little', signed=True)\n            sample = int(sample * volume)\n            data[i:i+2] = sample.to_bytes(2, byteorder='little', signed=True)\n        return bytes(data)\n    \n    def apply_effects(self, data: bytes, speed_factor: float, reverb_factor: float, pitch_shift: float, stream_index:int) -> bytes:\n        \"\"\"\n        Modify the audio\n\n        Args:\n            data (bytes): Audio data\n            speed_factor (float): Speed value between 0.5 and 2.0 (0.5 = half speed, 2.0 = double speed)\n            reverb_factor (float): Reverb value between 0.0 and 1.0 (0.0 = no reverb, 1.0 = full reverb)\n            delay_time (float): Delay time in seconds\n            stream_index (int): Index of the stream\n        \"\"\"\n        # Convert bytes to numpy array\n        samples = np.frombuffer(data, dtype=np.int16)\n        samples = samples.astype(np.float32)\n        samples = samples.reshape((len(samples) // 2, 2)).T\n        samples = samples.mean(axis=0)\n\n        # Modify speed\n        samples = self.modify_speed(samples, speed_factor)\n\n        # Modify pitch\n        samples = self.modify_pitch(samples, pitch_shift)\n\n        # Add reverb\n        samples = self.apply_reverb(samples, reverb_factor, stream_index)\n\n        # Convert back to bytes\n        samples = samples.astype(np.int16)\n        samples = np.repeat(samples, 2)\n\n        return samples.tobytes()\n    \n    def modify_speed(self, samples:np.ndarray, speed_factor:float) -> bytes:\n        \"\"\"\n        Modify the speed of the audio\n\n        Args:\n            samples (np.ndarray): Audio data\n            speed_factor (float): Speed value between 0.5 and 2.0 (0.5 = half speed, 2.0 = double speed)\n        \"\"\"\n        if speed_factor == 1.0:\n            return samples\n        num_samples = len(samples)\n        new_num_samples = int(num_samples / speed_factor)\n\n        # Resample the audio to the new length\n        resampled = np.interp(\n            np.linspace(0, num_samples, new_num_samples, endpoint=False),\n            np.arange(num_samples),\n            samples\n        )\n\n        return resampled\n\n    def apply_antialiasing_filter(self, samples: np.ndarray, cutoff_freq: float, frame_rate: int) -> np.ndarray:\n        \"\"\"\n        Apply an anti-aliasing filter to the audio\n\n        Args:\n            samples (np.ndarray): Audio data\n            cutoff_freq (float): Cutoff frequency in Hz\n            frame_rate (int): Frame rate in Hz\n        \"\"\"\n        # Create a low-pass Butterworth filter\n        nyquist = 0.5 * frame_rate\n        normal_cutoff = cutoff_freq / nyquist\n        b, a = butter(8, normal_cutoff, btype='low', analog=False)\n        \n        # Apply the filter to the samples\n        filtered_samples = filtfilt(b, a, samples, axis=0)\n        return filtered_samples\n\n    def modify_pitch(self, samples:np.ndarray, pitch_shift:float) -> bytes:\n        \"\"\"\n        Modify the pitch of the audio\n\n        Args:\n            samples (np.ndarray): Audio data\n            pitch_shift (float): Pitch value between -12.0 and 12.0 (-12.0 = one octave down, 12.0 = one octave up)\n        \"\"\"\n        if pitch_shift == 0:\n            return samples\n\n        pitch_shift *= 12  # Convert pitch shift from octaves to semitones\n        samples = samples.astype(np.float32) / np.iinfo(np.int16).max  # Convert samples to float32 between -1.0 and 1.0\n\n        # Continue with the pitch shift as before\n        shift_ratio = 2 ** (pitch_shift / 12)  # Shift by half-steps (semitones)\n        time_axis = np.arange(samples.shape[0]) / self.frame_rate\n        shifted_audio = np.interp(time_axis * shift_ratio, time_axis, samples)\n\n        # Apply an anti-aliasing filter to attenuate high frequencies\n        cutoff_freq = 0.9 * self.frame_rate / 2.0  # You can adjust the cutoff frequency as needed\n        shifted_audio = self.apply_antialiasing_filter(shifted_audio, cutoff_freq, self.frame_rate)\n\n        shifted_audio = np.clip(shifted_audio, -1.0, 1.0)  # Clip samples to prevent overflow\n        \n        # Convert samples back to 16-bit integer range\n        return shifted_audio * np.iinfo(np.int16).max\n    \n    def generate_impulse_response(self, length:int, decay_factor:float) -> np.ndarray:\n        \"\"\"\n        Generate impulse response\n\n        Args:\n            length (int): Length of the impulse response in samples (44100 samples = 1 second)\n            decay_factor (float): Decay factor between 0.0 and 1.0 (0.0 = no decay, 1.0 = full decay)\n        \"\"\"\n        impulse_response = np.zeros(length, dtype=np.float32)\n        impulse_response[0] = 1.0\n\n        # Generate decaying exponential tail\n        for i in range(1, length):\n            impulse_response[i] = impulse_response[i - 1] * decay_factor\n\n        # Add some random noise for early reflections\n        impulse_response += np.random.normal(0, 0.05, length)\n        return impulse_response\n\n    def apply_reverb(self, samples: np.ndarray, reverb_factor: float, stream_index: int) -> bytes:\n        \"\"\"\n        Add reverb to the audio\n\n        Args:\n            samples (np.ndarray): Audio data\n            reverb_factor (float): Reverb value between 0.0 and 1.0 (0.0 = no reverb, 1.0 = full reverb)\n            stream_index (int): Index of the stream\n        \"\"\"\n        if reverb_factor == 0:\n            return samples\n\n        samples = samples.astype(np.float32) / np.iinfo(np.int16).max  # Convert samples to float32 between -1.0 and 1.0\n\n        # Apply reverb impulse response to the current chunk\n        reverb_audio = fftconvolve(samples, self.impulse_response, mode='full')\n\n        # Concatenate previous reverb tail with the current reverb tail\n        reverb_audio[:len(self.reverb_tails[stream_index])] += self.reverb_tails[stream_index]\n\n        # Store the current reverb tail for the next chunk\n        self.reverb_tails[stream_index] = reverb_audio[len(samples):]\n\n        mixed_audio = samples * (1 - reverb_factor) + reverb_audio[:len(samples)] * reverb_factor  # Mix original and reverb audio\n        mixed_audio = np.clip(mixed_audio, -1.0, 1.0)  # Clip samples to prevent overflow\n\n        # Convert samples back to 16-bit integer range\n        return mixed_audio * np.iinfo(np.int16).max\n\n    def apply_eq(self, data:bytes) -> bytes:\n        \"\"\"\n        Apply the equalizer effect to the audio\n\n        Args:\n            data (bytes): Audio data\n        \"\"\"\n        # Convert data to float32\n        audio_data = np.frombuffer(data, dtype=np.int16)\n\n        try:\n            gains = np.array(self.bands(), dtype=np.float32)  # Gain values in dB\n        except:\n            gains = np.array([0] * 9, dtype=np.float32)\n\n        # Number of frequency bands\n        num_bands = len(gains)\n\n        # Generate frequency range (20Hz to 20kHz)\n        frequencies = np.fft.rfftfreq(len(audio_data), d=1 / 44100)\n\n        # Create equalizer response\n        response = np.zeros_like(frequencies)\n\n        # Apply gain to each frequency band\n        for i in range(num_bands):\n            lower_cutoff = self.center_freqs[i] / np.sqrt(2)  # Lower cutoff frequency\n            upper_cutoff = self.center_freqs[i] * np.sqrt(2)  # Upper cutoff frequency\n\n            # Find indices within the frequency range\n            indices = np.where((frequencies >= lower_cutoff) & (frequencies <= upper_cutoff))[0]\n\n            # Apply gain to the corresponding indices\n            response[indices] += gains[i]\n\n        # Convert response to linear scale and normalize\n        response_linear = 10 ** (response / 20)\n\n        # Apply equalization to audio data\n        audio_fft = np.fft.rfft(audio_data)\n        audio_fft *= response_linear[:len(audio_fft)]\n        equalized_audio = np.fft.irfft(audio_fft).astype(np.int16)\n\n        # Clip the audio to avoid distortion\n        equalized_audio = np.clip(equalized_audio, -32768, 32767)\n\n        return equalized_audio.tobytes()\n    \n    def set_effects(self, effects:bool) -> None:\n        \"\"\"\n        Set the effects of the audio\n\n        Args:\n            effects (bool): Effects value\n        \"\"\"\n        self.effects = effects\n\n    def set_volume(self, stream_index:int, volume:float) -> None:\n        \"\"\"\n        Set the volume of the audio\n\n        Args:\n            stream_index (int): Index of the stream\n            volume (float): Volume value\n        \"\"\"\n        self.volumes[stream_index] = volume\n    \n    def set_position(self, stream_index:int, position:float) -> None:\n        \"\"\"\n        Set the position of the audio\n\n        Args:\n            stream_index (int): Index of the stream\n            position (float): Position value\n        \"\"\"\n        self.positions[stream_index] = position\n\n    def save(self, files:List[str], volumes:List[int], filename:str, cover_art:bytes=None) -> None:\n        \"\"\"\n        Save the audio\n\n        Args:\n            files (List[str]): List of audio files\n            volumes (List[int]): List of volume values\n            filename (str): Name of the file\n        \"\"\"\n        # Load the audio files and get the sample rate\n        audio_data = []\n        sample_rate = None\n        for file in files:\n            data, sr = sf.read(file)\n            audio_data.append(data)\n            if sample_rate is None:\n                sample_rate = sr\n\n        adjusted_data = []\n        for i in range(len(audio_data)):\n            adjusted_data.append(audio_data[i] * volumes[i])\n\n        overlapped_data = np.sum(adjusted_data, axis=0)\n\n        sf.write(filename, overlapped_data, sample_rate)\n        if cover_art is not None and cover_art != \"null\":\n            byte_data = base64.b64decode(cover_art)\n            byte_stream = io.BytesIO(byte_data)\n            byte_stream.seek(0)\n            f = music_tag.load_file(filename)\n            f['artwork'] = byte_stream.read() \n            f.save()\n\n    def pause(self) -> None:\n        \"\"\"\n        Pause the audio\n        \"\"\"\n        self.paused = True\n\n    def resume(self) -> None:\n        \"\"\"\n        Resume the audio\n        \"\"\"\n        if self.paused:\n            self.paused = False\n            threading.Thread(target=self.play, daemon=True).start()\n    \n    def stop(self) -> None:\n        \"\"\"\n        Stop the audio\n        \"\"\"\n        for i, stream in enumerate(self.streams):\n            stream.stop_stream()\n            stream.close()\n        self.p.terminate()\n\n    def change_files(self, new_files:list, volumes:list) -> None:\n        \"\"\"\n        Change the files of the audio\n\n        Args:\n            new_files (list): List of new files\n            volumes (list): List of volumes\n        \"\"\"\n        self.paused = True\n        self.volumes = volumes\n\n        for i, stream in enumerate(self.streams):\n            stream.stop_stream()\n            stream.close()\n\n        self.streams.clear()\n        self.files = new_files\n        self.positions = [0] * len(new_files)\n\n        for file in self.files:\n            data, self.frame_rate = sf.read(file, dtype='int16')\n            self.duration = len(data) / self.frame_rate\n            self.channels = data.shape[1]\n            stream = self.p.open(format=self.p.get_format_from_width(2),\n                                channels=self.channels,\n                                rate=self.frame_rate,\n                                output=True)\n            self.streams.append(stream)\n\n        self.paused = False\n        threading.Thread(target=self.play, daemon=True).start()"
  },
  {
    "path": "MISST/MISSTpreprocess.py",
    "content": "import concurrent.futures\nimport logging\nimport os\nimport pathlib\nimport time\nimport traceback\nimport wave\n\nimport julius\nimport numpy as np\nimport soundfile\nimport soundfile as sf\nimport torch\nfrom demucs.apply import BagOfModels, apply_model\nfrom demucs.pretrained import get_model\nfrom MISSThelpers import MISSTconsole\n\n# Modified functions from https://github.com/facebookresearch/demucs, \n#                         https://pytorch.org/audio/main/tutorials/hybrid_demucs_tutorial.html \n#                         and https://github.com/CarlGao4/Demucs-Gui\n\nclass MISSTpreprocess():\n    \"\"\"\n    MISSTpreprocess class\n    \"\"\"\n    def __init__(self) -> None:\n        pass\n\n    def LoadModel(self, name:str, repo:str = None, device:str = \"cuda\" if torch.cuda.is_available() else \"cpu\",) -> BagOfModels:\n        \"\"\"\n        Load the model\n\n        Args:\n            name (str): Name of the model\n            repo (str): Repository of the model\n            device (str): Device to use\n        \"\"\"\n        model = get_model(name=name, repo=repo)\n        model.to(device)\n        model.eval()\n        return model\n\n    def GetData(self, model:BagOfModels) -> dict:\n        \"\"\"\n        Get the data from the model\n\n        Args:\n            model (demucs.pretrained.BagOfModels): Model to get the data from\n        \"\"\"\n        res = {}\n        res[\"channels\"] = model.audio_channels\n        res[\"samplerate\"] = model.samplerate\n        if isinstance(model, BagOfModels):\n            res[\"models\"] = len(model.models)\n        else:\n            res[\"models\"] = 1\n        res[\"sources\"] = model.sources\n        return res\n\n    def Apply(self, model:BagOfModels, wav:np.ndarray, shifts:int = 1) -> dict:\n        \"\"\"\n        Apply the model to the audio\n\n        Args:\n            model (demucs.pretrained.BagOfModels): Model to apply\n            wav (numpy.ndarray): Audio data\n            shifts (int): Number of shifts\n        \"\"\"\n        audio = wav\n        ref = audio.mean(0)\n        audio -= ref.mean()\n        audio /= ref.std()\n        sources = apply_model(model, audio[None], shifts=shifts, split=False, overlap=0.25, progress=False)[0]\n        sources *= ref.std()\n        sources += ref.mean()\n        return dict(zip(model.sources, sources))\n\n    def convert_audio_channels(self, wav:np.ndarray, channels:int = 2) -> np.ndarray:\n        \"\"\"\n        Convert the audio channels\n\n        Args:\n            wav (numpy.ndarray): Audio data\n            channels (int): Number of channels\n        \"\"\"\n        *shape, src_channels, length = wav.shape\n        if src_channels == channels:\n            pass\n        elif channels == 1:\n            wav = wav.mean(dim=-2, keepdim=True)\n        elif src_channels == 1:\n            wav = wav.expand(*shape, channels, length)\n        elif src_channels >= channels:\n            wav = wav[..., :channels, :]\n        else:\n            raise Exception(\"Error changing audio dims\")\n        return wav\n\n    def write_wav(self, wav:np.ndarray, filename:str, samplerate:int) -> None:\n        \"\"\"\n        Write the audio to a WAV file\n\n        Args:\n            wav (numpy.ndarray): Audio data\n            filename (str): Filename\n            samplerate (int): Samplerate\n        \"\"\"\n        if wav.dtype.is_floating_point:\n            wav = (wav.clamp_(-1, 1) * (2**15 - 1)).short()\n        with wave.open(filename, \"wb\") as f:\n            f.setnchannels(wav.shape[1])\n            f.setsampwidth(2)\n            f.setframerate(samplerate)\n            f.writeframes(bytearray(wav.numpy()))\n\n    def compress_wav_to_flac(self, wav_file:str, flac_file:str) -> None:\n        \"\"\"\n        Compress the WAV file to a FLAC file\n\n        Args:\n            wav_file (str): WAV filename\n            flac_file (str): FLAC filename\n        \"\"\"\n        # Read the WAV file\n        data, samplerate = sf.read(wav_file)\n\n        # Write the FLAC file and delete the WAV file\n        sf.write(flac_file, data, samplerate, format='FLAC')\n        os.remove(wav_file)\n\n    def convert_audio(self, wav:np.ndarray, from_samplerate:int, to_samplerate:int, channels:int) -> np.ndarray:\n        \"\"\"\n        Convert the audio\n\n        Args:\n            wav (numpy.ndarray): Audio data\n            from_samplerate (int): From samplerate\n            to_samplerate (int): To samplerate\n            channels (int): Number of channels\n        \"\"\"\n        wav = self.convert_audio_channels(wav, channels)\n        return julius.resample_frac(wav, from_samplerate, to_samplerate)\n\n    def load_audio(self, fn:str, sr:int) -> np.ndarray:\n        \"\"\"\n        Load the audio\n\n        Args:\n            fn (str): Filename\n            sr (int): Samplerate\n        \"\"\"\n        audio, raw_sr = soundfile.read(fn, dtype=\"float32\")\n        if len(audio.shape) == 1:\n            audio = np.atleast_2d(audio).transpose()\n        converted = self.convert_audio(torch.from_numpy(audio.transpose()), raw_sr, sr, 2)\n        return converted.numpy()\n    \n    def apply_fade_in_out(self, input_file:str, output_file:str, fade_duration:float) -> None:\n        \"\"\"\n        Apply fade in and out to the audio\n\n        Args:\n            input_file (str): Input filename\n            output_file (str): Output filename\n            fade_duration (float): Fade duration\n        \"\"\"\n        # Read the audio file\n        audio_data, sample_rate = sf.read(input_file)\n        \n        # Calculate the number of samples for the fade duration\n        fade_samples = int(fade_duration * sample_rate)\n        \n        # Apply fade-in\n        fade_in_curve = np.linspace(0.0, 1.0, fade_samples)\n        audio_data[:fade_samples] *= fade_in_curve[:, np.newaxis]\n        \n        # Apply fade-out\n        fade_out_curve = np.linspace(1.0, 0.0, fade_samples)\n        audio_data[-fade_samples:] *= fade_out_curve[:, np.newaxis]\n        \n        # Save the modified audio to a new file\n        sf.write(output_file, audio_data, sample_rate)\n\n    def process(\n        self, \n        model:BagOfModels, \n        infile:str, \n        write:bool = True, \n        outpath:pathlib.Path = pathlib.Path(\"\"), \n        split:float = 5.0, \n        overlap:float = 0.25, \n        sample_rate:int = 44100, \n        device:str = \"cuda\" if torch.cuda.is_available() else \"cpu\", \n        logger:logging.Logger = logging.getLogger(\"MISST\"),\n        console:MISSTconsole = None,\n    ) -> None:\n        \"\"\"\n        Process the audio\n\n        Args:\n            model (demucs.pretrained.BagOfModels): Model to apply\n            infile (str): Input filename\n            write (bool): Write the output\n            outpath (pathlib.Path): Output path\n            split (float): Split (seconds)\n            overlap (float): Overlap\n            sample_rate (int): Sample rate\n            device (str): Device\n            logger (logging.Logger): Logger\n            console (MISSTConsole): Console\n        \"\"\"\n        # Start the timer\n        start_time = time.time()\n        split = int(split * sample_rate)\n        overlap = int(overlap * split)\n        logger.info(\"Loading file\")\n        audio = self.load_audio(str(infile), sample_rate)\n        logger.info(f\"Loaded audio of shape {audio.shape}\")\n        orig_len = audio.shape[1]\n        n = int(np.ceil((orig_len - overlap) / (split - overlap)))\n        audio = np.pad(audio, [(0, 0), (0, n * (split - overlap) + overlap - orig_len)])\n        logger.info(\"Loading model to device %s\" % device)\n        model.to(device)\n        stems = self.GetData(model)[\"sources\"]\n        new_audio = np.zeros((len(stems), 2, audio.shape[1]))\n        total = np.zeros(audio.shape[1])\n        logger.info(\"Total splits of '%s' : %d\" % (str(infile), n))\n\n        def separation(i):\n            logger.info(\"Separation %d/%d\" % (i + 1, n))\n            console.editLine(f\"MISST Preprocessor\\nCopyright (C) @MISST App.\\n\\nMISST> Split {i + 1}/{n} ({((i + 1)/n) * 100:.1f}%)\", 0)\n            l = i * (split - overlap)\n            r = l + split\n            result = self.Apply(model, torch.from_numpy(audio[:, l:r]).to(device))\n            for (j, stem) in enumerate(stems):\n                new_audio[j, :, l:r] += result[stem].cpu().numpy()\n            total[l:r] += 1\n\n        workers = 1 if device == \"cuda\" else (os.cpu_count() // 2) # CPU parallelization on half the cores available, CUDA kernels are already parallelized\n\n        with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor:\n            futures = [executor.submit(separation, i) for i in range(n)]\n            concurrent.futures.wait(futures)\n\n        if write:\n            console.endUpdate()\n            console.addLine(\"\\nMISST> Preprocessed.\")\n            console.update(\"\\nMISST> Writing to file\")\n            outpath.mkdir(exist_ok=True)\n            for i in range(len(stems)):\n                if np.all(total == 0):\n                    stem = np.zeros_like(new_audio[i])\n                else:\n                    stem = (new_audio[i] / total)[:, :orig_len]\n                self.write_wav(torch.from_numpy(stem.transpose()), str(outpath / f\"{stems[i]}.wav\"), sample_rate)\n                self.compress_wav_to_flac(str(outpath / f\"{stems[i]}.wav\"), str(outpath / f\"{stems[i]}.flac\"))\n                self.apply_fade_in_out(str(outpath / f\"{stems[i]}.flac\"), str(outpath / f\"{stems[i]}.flac\"), 3.5)\n            logger.info(\"Wrote to %s\" % str(outpath))\n            logger.info(\"Done in %.2f seconds\" % (time.time() - start_time))\n            console.endUpdate()\n        else:\n            pass\n        del model # Free up memory\n\n    def preprocess(self, file:str, outDir:str, chosen_model:str, device:str = \"cuda\") -> None:\n        \"\"\"\n        Preprocess the audio\n\n        Args:\n            file (str): Input filename\n            outDir (str): Output directory\n            device (str): Device\n        \"\"\"\n        self.logger.info(f\"Preprocessing {file}...\")\n        console = MISSTconsole(self.preprocess_terminal_text, \"MISST Preprocessor\\nCopyright (C) @MISST App.\\n\")\n        try:\n            savename = os.path.basename(file).replace('.mp3', '').replace('.wav', '').replace('.flac', '')\n            console.update(\"\\nMISST> Loading model\")\n            processor = MISSTpreprocess()\n            model = processor.LoadModel(name=chosen_model, repo=pathlib.Path(\"Pretrained\"))\n            console.endUpdate()\n            console.addLine(\"\\nMISST> Model loaded.\")\n            console.update(\"\\nMISST> Preprocessing\")\n            processor.process(model, infile=pathlib.Path(file), outpath=pathlib.Path(f\"{outDir}/{savename}\"), device=device, console=console)\n            del model # Free up memory\n        except Exception as e:\n            self.logger.error(e)\n            self.logger.error(traceback.format_exc())\n            console.addLine(\"\\nMISST> Error.\")\n            pass\n        console.addLine(\"\\nMISST> Done.\")\n        self.import_file_button.configure(state='normal')\n        self.import_button.configure(state='normal')\n        return"
  },
  {
    "path": "MISST/MISSTsettings.py",
    "content": "import json\nimport os\nimport shutil\n\nimport torch\n\n\nclass MISSTsettings():\n    \"\"\"\n    Class for handling the settings of MISST\n    \"\"\"\n    def __init__(self) -> None:\n        \"\"\"\n        Initialize the settings\n        \"\"\"\n        # Check if the config file exists, if not create it\n        # Path: MISST\\MISSTsettings.py\n        if not os.path.isfile(\"config.json\"):\n            self.createSettings()\n        return\n    \n    def getSetting(self, setting:str) -> str:\n        \"\"\"\n        Get the setting from the saved config file\n\n        Args:\n            setting (str): The setting to be retrieved\n        \"\"\"\n        # Get the setting from the saved config file\n        # Path: MISST\\MISSTsettings.py\n        # setting: The setting to be retrieved\n        with open(\"config.json\", \"r\") as f:\n            data = json.load(f)\n        return data[setting]\n    \n    def setSetting(self, setting:str, value:str) -> None:\n        \"\"\"\n        Set the setting in the saved config file\n\n        Args:\n            setting (str): The setting to be set\n            value (str): The value to be set\n        \"\"\"\n        # Set the setting in the saved config file\n        # Path: MISST\\MISSTsettings.py\n        # setting: The setting to be set\n        # value: The value to be set\n        with open(\"config.json\", \"r\") as f:\n            data = json.load(f)\n        data[setting] = value\n        with open(\"config.json\", \"w\") as f:\n            json.dump(data, f, indent=4)\n\n    def applyThemeSettings(self, themeFile:str, baseTheme:str) -> None:\n        \"\"\"\n        Apply the chosen colorways to the theme file\n\n        Args:\n            themeFile (str): The theme file to be modified\n            baseTheme (str): The base theme file\n        \"\"\"\n        # Apply the chosen colorways to the theme file\n        # Path: MISST\\MISSTsettings.py\n        # themeFile: The theme file to be modified\n        # colorways: The colorways to be applied\n        with open(baseTheme, \"r\") as f:\n            data = f.read()\n        colorways = [\"defaultLightColor\", \"defaultDarkColor\", \"defaultLightHoverColor\", \"defaultDarkHoverColor\", \"defaultLightDarker\", \"defaultDarkDarker\"]\n        for colorway in colorways:\n            data = data.replace(colorway, self.getSetting(colorway.replace('default', 'chosen')))\n            with open(themeFile, \"w\") as f:\n                f.write(data)\n\n    def resetDefaultTheme(self, themeFile:str, baseTheme:str) -> None:\n        \"\"\"\n        Reset the theme file to the default theme\n\n        Args:\n            themeFile (str): The theme file to be modified\n            baseTheme (str): The base theme file\n        \"\"\"\n        # Reset the theme file to the default theme\n        # Path: MISST\\MISSTsettings.py\n        # themeFile: The theme file to be modified\n        # colorways: The colorways to be applied\n        with open(baseTheme, \"r\") as f:\n            data = f.read()\n        colorways = [\"defaultLightColor\", \"defaultDarkColor\", \"defaultLightHoverColor\", \"defaultDarkHoverColor\", \"defaultLightDarker\", \"defaultDarkDarker\"]\n        for colorway in colorways:\n            self.setSetting(colorway.replace('default', 'chosen'), self.getSetting(colorway))\n            data = data.replace(colorway, self.getSetting(colorway))\n            with open(themeFile, \"w\") as f:\n                f.write(data)\n\n    def createSettings(self) -> None:\n        \"\"\"\n        Create the config file\n        \"\"\"\n        # Creates a new config file in the apps directory with all the default settings.\n        shutil.copy(\"Assets/config_base.json\", \"config.json\")\n        self.setSetting(\"accelerate_on_gpu\", \"true\" if torch.cuda.is_available() else \"false\") #Automatically set GPU acceleration to true if available.\n\n\nclass MISSTconfig:\n    \"\"\"\n    Class for handling the metadata of the current song\n    \"\"\"\n    def __init__(self, configPath:str) -> None:\n        \"\"\"\n        Initialize the config for the current song\n\n        Args:\n            configPath (str): The path to the config file\n        \"\"\"\n        # Check if the config file exists, if not create it\n        # Path: MISST\\MISSTsettings.py\n        if not os.path.isfile(f\"{configPath}/.misst\"):\n            self.createConfig(configPath)\n        return\n    \n    def getConfig(self, configPath:str) -> str:\n        \"\"\"\n        Get the setting from the saved config file\n\n        Args:\n            configPath (str): The path to the config file\n        \"\"\"\n        # Get the setting from the saved config file\n        # Path: MISST\\MISSTsettings.py\n        # setting: The setting to be retrieved\n        with open(f\"{configPath}/.misst\", \"r\") as f:\n            data = json.load(f)\n        return data\n    \n    def setConfig(self, configPath:str, setting:str, value:str) -> None:\n        \"\"\"\n        Set the setting in the saved config file\n\n        Args:\n            configPath (str): The path to the config file\n            setting (str): The setting to be set\n            value (str): The value to be set\n        \"\"\"\n        # Set the setting in the saved config file\n        # Path: MISST\\MISSTsettings.py\n        # setting: The setting to be set\n        # value: The value to be set\n        with open(f\"{configPath}/.misst\", \"r\") as f:\n            data = json.load(f)\n        data[setting] = value\n        with open(f\"{configPath}/.misst\", \"w\") as f:\n            json.dump(data, f, indent=4)\n\n    def createConfig(self, configPath:str) -> None:\n        \"\"\"\n        Create the config file\n\n        Args:\n            configPath (str): The path to the config file\n        \"\"\"\n        # Creates a new config file in the apps directory with all the default settings.\n        with open(f\"{configPath}/.misst\", \"w\") as f:\n            json.dump({\"image_url\": \"null\", \"image_raw\": \"null\", \"lyrics\": \"null\"}, f, indent=4)\n        f.close()"
  },
  {
    "path": "MISST/Pretrained/files.txt",
    "content": "# MDX Models\nroot: mdx_final/\n0d19c1c6-0f06f20e.th\n5d2d6c55-db83574e.th\n7d865c68-3d5dd56b.th\n7ecf8ec1-70f50cc9.th\na1d90b5c-ae9d2452.th\nc511e2ab-fe698775.th\ncfa93e08-61801ae1.th\ne51eebcc-c1b80bdd.th\n6b9c2ca1-3fd82607.th\nb72baf4e-8778635e.th\n42e558d4-196e0e1b.th\n305bc58f-18378783.th\n14fc6a69-a89dd0ee.th\n464b36d7-e5a9386e.th\n7fd6ef75-a905dd85.th\n83fc094f-4a16d450.th\n1ef250f1-592467ce.th\n902315c2-b39ce9c9.th\n9a6b4851-03af0aa6.th\nfa0cb7f9-100d8bf4.th\n# Hybrid Transformer models\nroot: hybrid_transformer/\n955717e8-8726e21a.th\nf7e0c4bc-ba3fe64a.th\nd12395a8-e57c48e6.th\n92cfc3b6-ef3bcb9c.th\n04573f0d-f3cf25b2.th\n75fc33f5-1941ce65.th"
  },
  {
    "path": "MISST/Pretrained/hdemucs_mmi.yaml",
    "content": "models: ['75fc33f5']\nsegment: 44\n"
  },
  {
    "path": "MISST/Pretrained/htdemucs.yaml",
    "content": "models: ['955717e8']\n"
  },
  {
    "path": "MISST/Pretrained/htdemucs_ft.yaml",
    "content": "models: ['f7e0c4bc', 'd12395a8', '92cfc3b6', '04573f0d']\nweights: [\n  [1., 0., 0., 0.],\n  [0., 1., 0., 0.],\n  [0., 0., 1., 0.],\n  [0., 0., 0., 1.],\n]"
  },
  {
    "path": "MISST/Pretrained/mdx.yaml",
    "content": "models: ['0d19c1c6', '7ecf8ec1', 'c511e2ab', '7d865c68']\nweights: [\n  [1., 1., 0., 0.],\n  [0., 1., 0., 0.],\n  [1., 0., 1., 1.],\n  [1., 0., 1., 1.],\n]\nsegment: 44\n"
  },
  {
    "path": "MISST/Pretrained/mdx_extra.yaml",
    "content": "models: ['e51eebcc', 'a1d90b5c', '5d2d6c55', 'cfa93e08']\nsegment: 44"
  },
  {
    "path": "MISST/Pretrained/mdx_extra_q.yaml",
    "content": "models: ['83fc094f', '464b36d7', '14fc6a69', '7fd6ef75']\nsegment: 44\n"
  },
  {
    "path": "MISST/Pretrained/mdx_q.yaml",
    "content": "models: ['6b9c2ca1', 'b72baf4e', '42e558d4', '305bc58f']\nweights: [\n  [1., 1., 0., 0.],\n  [0., 1., 0., 0.],\n  [1., 0., 1., 1.],\n  [1., 0., 1., 1.],\n]\nsegment: 44\n"
  },
  {
    "path": "MISST/Pretrained/repro_mdx_a.yaml",
    "content": "models: ['9a6b4851', '1ef250f1', 'fa0cb7f9', '902315c2']\nsegment: 44\n"
  },
  {
    "path": "MISST/Pretrained/repro_mdx_a_hybrid_only.yaml",
    "content": "models: ['fa0cb7f9', '902315c2', 'fa0cb7f9', '902315c2']\nsegment: 44\n"
  },
  {
    "path": "MISST/Pretrained/repro_mdx_a_time_only.yaml",
    "content": "models: ['9a6b4851', '9a6b4851', '1ef250f1', '1ef250f1']\nsegment: 44\n"
  },
  {
    "path": "MISST/__version__.py",
    "content": "__version__ = '3.1.0'"
  },
  {
    "path": "README.md",
    "content": "<div align=\"center\">\n\n[![](./MISST/Assets/showcase/banner.png)](https://github.com/Frikallo/MISST)\n[![GitHub release](https://img.shields.io/github/release/frikallo/misst.svg)](https://github.com/Frikallo/MISST/releases/latest) [![Github All Releases](https://img.shields.io/github/downloads/frikallo/misst/total?color=blue)](https://github.com/Frikallo/MISST/releases/latest) [![License](https://img.shields.io/github/license/frikallo/misst?color=blue)](https://github.com/Frikallo/MISST/blob/main/LICENSE) [![Hits-of-Code](https://hitsofcode.com/github/frikallo/MISST?branch=main)](https://github.com/Frikallo/MISST/graphs/contributors)\n\n</div>\n\n---\n\n![](./MISST/Assets/showcase/showcaseimage1.png)\n| _`MISST` on Windows 11 with Dark mode and 'Blue' theme with 'Steve Lacy's Infrunami' playing_\n\n![](./MISST/Assets/showcase/showcaseimage2.png)\n| _`MISST` on Windows 11 with Light mode and 'Blue' theme with 'Frank Ocean's Ivy' playing_\n\n![](./MISST/Assets/showcase/showcaseimage3.png)\n| _`MISST` on Windows 11 Showcasing how versatile and personal you can be with MISST!_\n\n![](./MISST/Assets/showcase/showcaseimage4.png)\n| _`MISST` on Windows 11 Showcasing how importing audios is as easy as two clicks!_\n\n###\n\nOriginal Repository of MISST : **M**usic/**I**nstrumental **S**tem **S**eparation **T**ool.\n\nThis application uses state-of-the-art [demucs](https://github.com/facebookresearch/demucs) source separation models to extract the 4 core stems from audio files (Bass, Drums, Other Instrumentals and Vocals). But it is not limited to this. MISST acts as a developped music player aswell, fit to enjoy and medal with your audio files as you see fit. MISST even comes prepared to import songs and playlists directly from your music library.\n\nThis project is OpenSource, feel free to use, study and/or send pull request.\n\n## Objectives:\n- [x] Import songs and playlists from your music library\n- [x] Easy to use UI\n- [x] Play your songs and playlists\n- [x] Extract and manipulate the 4 core stems from your audio files as they play\n- [x] Discord rich presence to show off your music to your friends\n- [x] Save your stems as audio files\n- [x] If imported from your music library, view lyrics and metadata just as you would in your old music player\n- [x] Minimal memory usage\n- [x] Customizable themes\n- [x] Additional Efects like nightcore\n- [x] Easy to use equalizer\n- [x] Preprocessing service available on both CPU and GPU\n- [x] Ability to change the pre-trained model used for separation\n- [x] Small save size, comparable to the size of the inputted audio\n- [ ] Docker image (WIP)\n- [ ] Stable on Windows, Linux and MacOS (WIP)\n- [ ] Proper installer/updater (Not a priority)\n\n## Installation\nAs of version 3.1.0, MISST is only available on windows with guaranteed compatibility. \n\nUntil a later release : \n- if you are **not on a windows device** please refer to [Manual Installation](https://github.com/Frikallo/MISST/#manual-installation).\n- if you are **using conda on MacOs** device please refer to [Manual Installation - MacOS](https://github.com/CAprogs/MISST/blob/main/Installation%20Guide%20-%20MacOS.md)\n-   Otherwise, refer to the latest [Release](https://github.com/Frikallo/MISST/releases/latest)\n\n## Manual Installation\nThese instructions are for those installing MISST v3.1.0 **manually** only.\n\n1. Download & install Python 3.9 or higher (but no lower than 3.9.0) [here](https://www.python.org/downloads/)\n    - **Note:** Ensure the *\"Add Python to PATH\"* box is checked\n2. Download the Source code [here](https://github.com/Frikallo/MISST/releases/latest)\n3. Open the command prompt from the MISST directory and run the following commands, separately - \n\n```\n$ python3 -m venv ./venv\n$ pip install -r requirements.txt\n$ python3 MISSTapp.py\n```\n- **Note:** Install `requirements-minimal.txt` if you don't intend to accelerate preprocessing with your GPU.\n\nFrom here you should be able to open and run the MISSTapp.py file\n\n- CUDA \n\n    - CUDA must be installed and configured for the application to process any track with GPU acceleration. You will need to look up instruction on how to configure it on your operating system. Click [here](https://developer.nvidia.com/cuda-downloads) for nvidia's installation guide.\n\n## Benchmark\n\nThe audio processing performance was evaluated using an **NVIDIA GeForce RTX 2070 SUPER** with **8GB VRAM** and an **AMD Ryzen 3700X 8-Core Processor** on the htdemucs pretrained model. This test aimed to compare the processing time of audio on a CPU versus a GPU.\n\nHere are the results of the test:\n\n| Source                                                           | Source Length | CPU       | GPU       | Model     |\n|------------------------------------------------------------------|---------------|-----------|-----------| --------- |\n| [Frank Ocean - Ivy](https://www.youtube.com/watch?v=AE005nZeF-A) | 4m 09.00s     | 2m 22.16s | 0m 28.04s | htdemucs  |\n\n## Demo\n\nhttps://github.com/Frikallo/MISST/assets/88942100/15fb7ce3-9f83-4228-9ab0-f453593be632\n\n[Open in YouTube](https://www.youtube.com/watch?v=XYJm5WW9Zvs)\n\n## License\n\nThe **MISST** code is [GPL-licensed](LICENSE). \n\n- **Please Note:** For all third-party application developers who wish to use MISST or its code, please honor the GPL license by providing credit to MISST and its developer.\n\n## Issue Reporting\n\nPlease be as detailed as possible when posting a new issue. \n\nIf possible, check the \"MISST.log\" file in your install directory for detailed error information that can be provided to me.\n\n## Contributing\n\n- For anyone interested in the ongoing development of **MISST**, please send us a pull request, and I will review it. \n- This project is 100% open-source and free for anyone to use and modify as they wish. \n- I only maintain the development for **MISST** and the models provided. \n\n## More documentation to come...\n"
  }
]