mirror of
https://codeberg.org/icewind/galton.git
synced 2026-06-03 10:24:07 +02:00
add xpath extractor
This commit is contained in:
parent
e20f0d7661
commit
b423323473
8 changed files with 1198 additions and 57 deletions
19
README.md
19
README.md
|
|
@ -41,8 +41,12 @@ And two action options:
|
|||
- `move`: directory to move the file into, will be created if necessary
|
||||
- `rename`: rename the file
|
||||
|
||||
Action options can refer to capture groups from the match options and the file
|
||||
mtime to dynamically set the target directory and name.
|
||||
Actions options can refer to the following data extracted from the rule to
|
||||
dynamically set the target directory and name.
|
||||
|
||||
- Any named regex capture group
|
||||
- `mtime`: unix timestamp of the downloaded file
|
||||
- `xpath('....')` an xpath expression to match on the download file
|
||||
|
||||
Multiple rule sections can be configured, the first matching rule will be used.
|
||||
|
||||
|
|
@ -73,6 +77,15 @@ url = "https://www.paypal.com"
|
|||
move = "~/Downloads/Paypal Statements/$mtime.csv" # $mtime is set to the unix timestamp
|
||||
```
|
||||
|
||||
Rename based on an XPath expression
|
||||
|
||||
```toml
|
||||
[[rule]]
|
||||
name = ".+\\.(lss)"
|
||||
move = "~/Livesplits/${xpath('//GameName/text()')}"
|
||||
rename = "${xpath('//CategoryName/text()')} - ${xpath('//Metadata/Variables/Variable[contains(@name, \"Subcategory\")]/text()')}.lss"
|
||||
```
|
||||
|
||||
### Url and referrer
|
||||
|
||||
Galton uses the standard `user.xdg.origin.url` and `user.xdg.referrer.url`
|
||||
|
|
@ -92,7 +105,7 @@ to automatically create a symlink to the new location of the file.
|
|||
symlink = "~/Downloads/last"
|
||||
```
|
||||
|
||||
## Lastest download symlink
|
||||
## Remove duplicate downloads
|
||||
|
||||
Galton can also be used to clean up duplicate downloads, when enabled, it will
|
||||
check for any existing file with the same contents in the target directory and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue