pferd/example_config.py

35 lines
877 B
Python
Raw Normal View History

2020-04-23 20:22:41 +02:00
"""
A small sample config for PFERD.
"""
2020-04-23 11:49:15 +02:00
from pathlib import Path
from PFERD import Pferd, enable_logging
2020-04-23 20:22:41 +02:00
from PFERD.ilias.download_strategies import (download_everything,
download_modified_or_new)
2020-04-23 11:49:15 +02:00
2020-04-23 12:35:58 +02:00
def main() -> None:
2020-04-23 11:49:15 +02:00
enable_logging()
pferd = Pferd(Path(__file__).parent)
2020-04-23 20:22:41 +02:00
# Synchronize "databases" and only download files with a more recent timestamp than
# the local copy, if any exists.
pferd.ilias_kit(
Path("DB"),
"1101554",
cookies=Path("ilias_cookies.txt"),
download_strategy=download_modified_or_new
)
# Synchronize "databases" and redownload every file (default).
pferd.ilias_kit(
Path("DB"),
"1101554",
cookies=Path("ilias_cookies.txt"),
download_strategy=download_everything
)
2020-04-23 11:49:15 +02:00
if __name__ == "__main__":
main()