mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
11b9ff66e4 | |||
d730d0064c | |||
ae6cc40fb5 | |||
0891e7f1bc | |||
571c2a6c98 | |||
2d7a2b2d53 | |||
8550d1101c | |||
fd71dc6f6e |
@ -23,7 +23,7 @@ class FfM:
|
|||||||
self._session = requests.Session()
|
self._session = requests.Session()
|
||||||
|
|
||||||
def synchronize(self, urlpart, to_dir, transform=lambda x: x):
|
def synchronize(self, urlpart, to_dir, transform=lambda x: x):
|
||||||
logging.info(f" Synchronizing {urlpart} to {to_dir} using the FfM synchronizer.")
|
logger.info(f" Synchronizing {urlpart} to {to_dir} using the FfM synchronizer.")
|
||||||
|
|
||||||
sync_path = pathlib.Path(self.base_path, to_dir)
|
sync_path = pathlib.Path(self.base_path, to_dir)
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ import bs4
|
|||||||
from .ilias_authenticators import ShibbolethAuthenticator
|
from .ilias_authenticators import ShibbolethAuthenticator
|
||||||
from .organizer import Organizer
|
from .organizer import Organizer
|
||||||
|
|
||||||
__all__ = ["ILIAS"]
|
__all__ = ["Ilias"]
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ILIAS:
|
class Ilias:
|
||||||
FILE_RE = re.compile(r"goto\.php\?target=(file_\d+_download)")
|
FILE_RE = re.compile(r"goto\.php\?target=(file_\d+_download)")
|
||||||
DIR_RE = re.compile(r"ilias\.php\?ref_id=(\d+)")
|
DIR_RE = re.compile(r"ilias\.php\?ref_id=(\d+)")
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class ILIAS:
|
|||||||
self._auth = ShibbolethAuthenticator(base_path / cookie_file)
|
self._auth = ShibbolethAuthenticator(base_path / cookie_file)
|
||||||
|
|
||||||
def synchronize(self, ref_id, to_dir, transform=lambda x: x, filter=lambda x: True):
|
def synchronize(self, ref_id, to_dir, transform=lambda x: x, filter=lambda x: True):
|
||||||
logging.info(f" Synchronizing ref_id {ref_id} to {to_dir} using the ILIAS synchronizer.")
|
logger.info(f" Synchronizing ref_id {ref_id} to {to_dir} using the Ilias synchronizer.")
|
||||||
|
|
||||||
sync_path = pathlib.Path(self.base_path, to_dir)
|
sync_path = pathlib.Path(self.base_path, to_dir)
|
||||||
orga = Organizer(self.base_path, sync_path)
|
orga = Organizer(self.base_path, sync_path)
|
||||||
|
@ -11,9 +11,7 @@ import requests
|
|||||||
from .organizer import Organizer
|
from .organizer import Organizer
|
||||||
from .utils import rename, stream_to_path
|
from .utils import rename, stream_to_path
|
||||||
|
|
||||||
__all__ = [
|
__all__ = ["Norbert"]
|
||||||
"Norbert",
|
|
||||||
]
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Norbert:
|
class Norbert:
|
||||||
@ -26,7 +24,7 @@ class Norbert:
|
|||||||
self._session = requests.Session()
|
self._session = requests.Session()
|
||||||
|
|
||||||
def synchronize(self, to_dir, transform=lambda x: x, unzip=lambda _: True):
|
def synchronize(self, to_dir, transform=lambda x: x, unzip=lambda _: True):
|
||||||
logging.info(f" Synchronizing to {to_dir} using the Norbert synchronizer.")
|
logger.info(f" Synchronizing to {to_dir} using the Norbert synchronizer.")
|
||||||
|
|
||||||
sync_path = pathlib.Path(self.base_path, to_dir)
|
sync_path = pathlib.Path(self.base_path, to_dir)
|
||||||
orga = Organizer(self.base_path, sync_path)
|
orga = Organizer(self.base_path, sync_path)
|
||||||
|
29
README.md
29
README.md
@ -1,23 +1,40 @@
|
|||||||
# PFERD (**P**rogramm **F**ür's **E**infache **R**unterladen von **D**ateien)
|
# PFERD
|
||||||
|
|
||||||
|
**P**rogramm zum **F**lotten, **E**infachen **R**unterladen von **D**ateien
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Ensure that you have at least Python 3.7 installed.
|
Ensure that you have at least Python 3.7 installed (3.6 might also work, didn't
|
||||||
|
test it though).
|
||||||
|
|
||||||
To install PFERD or update your installation to the latest version, run:
|
To install PFERD or update your installation to the latest version, run this
|
||||||
|
wherever you want to install/have installed PFERD:
|
||||||
```
|
```
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v1.0.0
|
$ pip install git+https://github.com/Garmelon/PFERD@v1.1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
The use of [venv](https://docs.python.org/3/library/venv.html) is recommended.
|
The use of [venv](https://docs.python.org/3/library/venv.html) is recommended.
|
||||||
|
|
||||||
|
## Example setup
|
||||||
|
|
||||||
|
In this example, `python3` refers to at least Python 3.7.
|
||||||
|
|
||||||
A full example setup and initial use could look like:
|
A full example setup and initial use could look like:
|
||||||
```
|
```
|
||||||
$ mkdir Vorlesungen
|
$ mkdir Vorlesungen
|
||||||
$ cd Vorlesungen
|
$ cd Vorlesungen
|
||||||
$ python3 -m venv .
|
$ python3 -m venv .
|
||||||
$ . bin/activate
|
$ . bin/activate
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v1.0.0
|
$ pip install git+https://github.com/Garmelon/PFERD@v1.1.0
|
||||||
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/master/example_config.py
|
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/master/example_config.py
|
||||||
$ python example_config.py
|
$ python3 example_config.py
|
||||||
|
$ deactivate
|
||||||
|
```
|
||||||
|
|
||||||
|
Subsequent runs of the program might look like:
|
||||||
|
```
|
||||||
|
$ cd Vorlesungen
|
||||||
|
$ . bin/activate
|
||||||
|
$ python3 example_config.py
|
||||||
|
$ deactivate
|
||||||
```
|
```
|
||||||
|
@ -295,7 +295,7 @@ def main(args):
|
|||||||
args = [arg.lower() for arg in args]
|
args = [arg.lower() for arg in args]
|
||||||
|
|
||||||
ffm = PFERD.FfM(base_dir)
|
ffm = PFERD.FfM(base_dir)
|
||||||
ilias = PFERD.ILIAS(base_dir, "cookie_jar")
|
ilias = PFERD.Ilias(base_dir, "cookie_jar")
|
||||||
norbert = PFERD.Norbert(base_dir)
|
norbert = PFERD.Norbert(base_dir)
|
||||||
|
|
||||||
# Semester 1
|
# Semester 1
|
||||||
|
Reference in New Issue
Block a user