Compare commits

...

3 Commits

Author SHA1 Message Date
7024db1f13 Use transient progessbar
This will ensure no pesky newline ends up in the output, even on
windows.
2020-06-25 18:03:12 +02:00
23bfa42a0d Never use the direct download button, as it is currently broken 2020-06-11 13:31:01 +02:00
fdb57884ed Touch files with same content to update timestamps 2020-05-31 20:27:15 +02:00
5 changed files with 20 additions and 24 deletions

View File

@ -425,7 +425,8 @@ class IliasCrawler:
results: List[IliasCrawlerEntry] = [] results: List[IliasCrawlerEntry] = []
# We can download everything directly! # We can download everything directly!
if len(direct_download_links) == len(video_links): # FIXME: Sadly the download button is currently broken, so never do that
if False and len(direct_download_links) == len(video_links):
for link in direct_download_links: for link in direct_download_links:
results += self._crawl_single_video(video_dir_path, link, True) results += self._crawl_single_video(video_dir_path, link, True)
else: else:

View File

@ -65,6 +65,8 @@ class Organizer(Location):
# Bail out, nothing more to do # Bail out, nothing more to do
PRETTY.ignored_file(dst_absolute, "same file contents") PRETTY.ignored_file(dst_absolute, "same file contents")
self.mark(dst) self.mark(dst)
# Touch it to update the timestamp
dst_absolute.touch()
return return
PRETTY.modified_file(dst_absolute) PRETTY.modified_file(dst_absolute)

View File

@ -7,8 +7,7 @@ from types import TracebackType
from typing import Optional, Type from typing import Optional, Type
import requests import requests
from rich.console import Console, ConsoleOptions, Control, RenderResult from rich.console import Console
from rich.live_render import LiveRender
from rich.progress import (BarColumn, DownloadColumn, Progress, TaskID, from rich.progress import (BarColumn, DownloadColumn, Progress, TaskID,
TextColumn, TimeRemainingColumn, TextColumn, TimeRemainingColumn,
TransferSpeedColumn) TransferSpeedColumn)
@ -23,7 +22,8 @@ _progress: Progress = Progress(
TransferSpeedColumn(), TransferSpeedColumn(),
"", "",
TimeRemainingColumn(), TimeRemainingColumn(),
console=Console(file=sys.stdout) console=Console(file=sys.stdout),
transient=True
) )
@ -61,18 +61,6 @@ def progress_for(settings: Optional[ProgressSettings]) -> 'ProgressContextManage
return ProgressContextManager(settings) return ProgressContextManager(settings)
class _OneLineUp(LiveRender):
"""
Render a control code for moving one line upwards.
"""
def __init__(self) -> None:
super().__init__("not rendered")
def __console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
yield Control(f"\r\x1b[1A")
class ProgressContextManager: class ProgressContextManager:
""" """
A context manager used for displaying progress. A context manager used for displaying progress.
@ -113,9 +101,6 @@ class ProgressContextManager:
_progress.stop() _progress.stop()
_progress.refresh() _progress.refresh()
# And we existed, so remove the line above (remove_task leaves one behind)
Console().print(_OneLineUp())
return None return None
def advance(self, amount: float) -> None: def advance(self, amount: float) -> None:

View File

@ -9,11 +9,19 @@ 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/have installed PFERD: wherever you want to install/have installed PFERD:
``` ```
$ pip install git+https://github.com/Garmelon/PFERD@v2.0.0 $ pip install git+https://github.com/Garmelon/PFERD@v2.1.1
``` ```
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.
### Upgrading from 2.0.0 to 2.1.0+
The `IliasDirectoryType` type was renamed to `IliasElementType` and is now far
more detailed.
The new values are: REGULAR_FOLDER, VIDEO_FOLDER,
EXERCISE_FOLDER, REGULAR_FILE, VIDEO_FILE, FORUM, EXTERNAL_LINK.
Forums and external links are skipped automatically if you use the `kit_ilias` helper.
## Example setup ## Example setup
In this example, `python3` refers to at least Python 3.8. In this example, `python3` refers to at least Python 3.8.
@ -29,8 +37,8 @@ $ mkdir Vorlesungen
$ cd Vorlesungen $ cd Vorlesungen
$ python3 -m venv .venv $ python3 -m venv .venv
$ .venv/bin/activate $ .venv/bin/activate
$ pip install git+https://github.com/Garmelon/PFERD@v2.0.0 $ pip install git+https://github.com/Garmelon/PFERD@v2.1.1
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.0.0/example_config.py $ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.1.1/example_config.py
$ python3 example_config.py $ python3 example_config.py
$ deactivate $ deactivate
``` ```

View File

@ -2,12 +2,12 @@ from setuptools import find_packages, setup
setup( setup(
name="PFERD", name="PFERD",
version="2.1.0", version="2.1.1",
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
"requests>=2.21.0", "requests>=2.21.0",
"beautifulsoup4>=4.7.1", "beautifulsoup4>=4.7.1",
"rich>=1.0.0" "rich>=2.1.0"
], ],
) )