Skip to content

Read preferences from GoldenDict config file #6

@dohliam

Description

@dohliam

Currently gdcl uses gdcg.rb to prepare custom groups of dictionaries for searching. Ideally, gdcl should look in the GoldenDict home folder and read the preferences in the GoldenDict config file so that we can use groups that have already been set up by the user.

The config file is relatively simple and the groups are arranged under <group> tags, e.g.:

  <group id="1" name="zh">

followed by a list of dictionaries between dictionary tags, e.g.:

   <dictionary name="Chinese Wikipedia">935a97e41606b54a232c18374b15754b</dictionary>

The only problem is that, as seen in the example above, the dictionaries are listed by their index hash rather than file name or location. So to get the file location we need to first read the preferences folder to discover the group name, and then get the location and other information from the index file.

Unfortunately, the index file is encoded, so we need to decode the file to read the location information. It is not immediately obvious how to do that, but someone more familiar with the GoldenDict source code might be able to help.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions