mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
12.06k stars 982 forks source link

Multiple characters in path-restrict strings #1707

Open github-account1111 opened 3 years ago

github-account1111 commented 3 years ago

I'm trying to transliterate cyrillic to latin and replace all the remaining characters that aren't A-Z, a-z and 0-9 with _, then replace any resultant _ repeats (__, ___, ____ etc.) with a single _. Relevant part of the config file (all but 3 transliteration mappings are omitted):

{
  "extractor": {
    "path-restrict": {
      "\\u0430": "a",
      "\\u0436": "zh",
      "\\u044E\\u0439": "yuy",
      "\\u0020-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-": "_",
      "__": "_"
    },
    "path-remove": "\\u0000-\\u001f\\u007f"
  }
}

This gives me this error: string keys in translate table must be of length 1 I'm not sure where to go from here. I need to somehow be able to replace multiple character strings as well as character ranges. I assumed path-restrict strings follow the same syntax as the path-remove string. Is what I'm trying to do here possible?

mikf commented 3 years ago

Not possible at the moment. path-restrict must either be a character range OR a 1-to-N mapping, everything else is not supported.