themoeway / local-audio-yomichan

Anki add-on to run a local audio server for Yomichan.
MIT License
73 stars 10 forks source link

Feature: config option to point to custom user_files folder #8

Closed Aquafina-water-bottle closed 1 year ago

Aquafina-water-bottle commented 1 year ago

Reason: 5gb might be a lot for people who have a close-to-full drive

Note: Implement the feature such that run_server.py can still be ran correctly + the custom directory can also be passed into the script (use a flag?)

Aquafina-water-bottle commented 1 year ago

No longer necessary, as the path attribute for each source now supports absolute paths. If you want to use a custom user_files folder, copy/paste the exact path to it for each source, i.e.

    {
      "type": "ajt_jp",
      "id": "jpod",
      "path": "/home/user/path/to/user_files/jpod_files",
      "display": "Jpod"
    },
ChienTingLu commented 4 months ago

Thanks for the hint!

In case someone else needs this in the future, here's a way to achieve the same effect with just one line of code modification.

  1. Open audio_source.py in the source folder after clicking View files.
  2. Find this section at the end of the code.
    def get_media_dir_path(self) -> Path:
        return get_program_root_path().joinpath(self.data.media_dir)
  3. Change get_program_root_path() into Path("XXX"). Where XXX is the path to the parent folder of your user_files folder.

e.g. D:/myData/user_files/ Then XXX should be D:/myData