mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
9a9018751e | |||
83b75e8254 | |||
35c3fa205d | |||
0b606f02fa | |||
fb78a6e98e | |||
5de68a0400 | |||
f0562049b6 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ build/
|
|||||||
.env
|
.env
|
||||||
.vscode
|
.vscode
|
||||||
ilias_cookies.txt
|
ilias_cookies.txt
|
||||||
|
PFERD.egg-info/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
sync_url.spec
|
sync_url.spec
|
||||||
|
@ -281,7 +281,10 @@ class IliasCrawler:
|
|||||||
result += [IliasCrawlerEntry(element_path, abs_url, element_type, None)]
|
result += [IliasCrawlerEntry(element_path, abs_url, element_type, None)]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
rest_of_name = meeting_name.removeprefix(date_portion_str)
|
rest_of_name = meeting_name
|
||||||
|
if rest_of_name.startswith(date_portion_str):
|
||||||
|
rest_of_name = rest_of_name[len(date_portion_str):]
|
||||||
|
|
||||||
new_name = datetime.datetime.strftime(date_portion, "%Y-%m-%d, %H:%M") \
|
new_name = datetime.datetime.strftime(date_portion, "%Y-%m-%d, %H:%M") \
|
||||||
+ rest_of_name
|
+ rest_of_name
|
||||||
new_path = Path(folder_path, _sanitize_path_name(new_name))
|
new_path = Path(folder_path, _sanitize_path_name(new_name))
|
||||||
|
@ -122,9 +122,22 @@ class IliasDownloader:
|
|||||||
|
|
||||||
tmp_file = self._tmp_dir.new_path()
|
tmp_file = self._tmp_dir.new_path()
|
||||||
|
|
||||||
while not self._try_download(info, tmp_file):
|
download_successful = False
|
||||||
LOGGER.info("Retrying download: %r", info)
|
for _ in range(0, 3):
|
||||||
|
try:
|
||||||
|
if not self._try_download(info, tmp_file):
|
||||||
|
LOGGER.info("Re-Authenticating due to download failure: %r", info)
|
||||||
self._authenticator.authenticate(self._session)
|
self._authenticator.authenticate(self._session)
|
||||||
|
else:
|
||||||
|
download_successful = True
|
||||||
|
break
|
||||||
|
except IOError as e:
|
||||||
|
PRETTY.warning(f"I/O Error when downloading ({e}). Retrying...",)
|
||||||
|
LOGGER.info("Retrying download for %s", info.path)
|
||||||
|
|
||||||
|
if not download_successful:
|
||||||
|
PRETTY.error(f"Download of file {info.path} failed too often! Skipping it...")
|
||||||
|
return
|
||||||
|
|
||||||
dst_path = self._organizer.accept_file(tmp_file, info.path)
|
dst_path = self._organizer.accept_file(tmp_file, info.path)
|
||||||
if dst_path and info.modification_date:
|
if dst_path and info.modification_date:
|
||||||
|
10
README.md
10
README.md
@ -37,7 +37,7 @@ Ensure that you have at least Python 3.8 installed.
|
|||||||
To install PFERD or update your installation to the latest version, run this
|
To install PFERD or update your installation to the latest version, run this
|
||||||
wherever you want to install or have already installed PFERD:
|
wherever you want to install or have already installed PFERD:
|
||||||
```
|
```
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v2.5.1
|
$ pip install git+https://github.com/Garmelon/PFERD@v2.5.4
|
||||||
```
|
```
|
||||||
|
|
||||||
The use of [venv] is recommended.
|
The use of [venv] is recommended.
|
||||||
@ -59,9 +59,9 @@ A full example setup and initial use could look like:
|
|||||||
$ mkdir Vorlesungen
|
$ mkdir Vorlesungen
|
||||||
$ cd Vorlesungen
|
$ cd Vorlesungen
|
||||||
$ python3 -m venv .venv
|
$ python3 -m venv .venv
|
||||||
$ .venv/bin/activate
|
$ source .venv/bin/activate
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v2.5.1
|
$ pip install git+https://github.com/Garmelon/PFERD@v2.5.4
|
||||||
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.5.1/example_config.py
|
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.5.4/example_config.py
|
||||||
$ python3 example_config.py
|
$ python3 example_config.py
|
||||||
$ deactivate
|
$ deactivate
|
||||||
```
|
```
|
||||||
@ -69,7 +69,7 @@ $ deactivate
|
|||||||
Subsequent runs of the program might look like:
|
Subsequent runs of the program might look like:
|
||||||
```
|
```
|
||||||
$ cd Vorlesungen
|
$ cd Vorlesungen
|
||||||
$ .venv/bin/activate
|
$ source .venv/bin/activate
|
||||||
$ python3 example_config.py
|
$ python3 example_config.py
|
||||||
$ deactivate
|
$ deactivate
|
||||||
```
|
```
|
||||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="PFERD",
|
name="PFERD",
|
||||||
version="2.5.1",
|
version="2.5.4",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"requests>=2.21.0",
|
"requests>=2.21.0",
|
||||||
|
@ -113,7 +113,7 @@ def main() -> None:
|
|||||||
if not element_name:
|
if not element_name:
|
||||||
print("Error, could not get element name. Please specify a folder yourself.")
|
print("Error, could not get element name. Please specify a folder yourself.")
|
||||||
return
|
return
|
||||||
folder = Path(element_name)
|
folder = sanitize_windows_path(Path(element_name.replace("/", "-").replace("\\", "-")))
|
||||||
cookie_jar.save_cookies()
|
cookie_jar.save_cookies()
|
||||||
else:
|
else:
|
||||||
folder = Path(args.folder)
|
folder = Path(args.folder)
|
||||||
|
Reference in New Issue
Block a user