-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from datawhores/sorting2
Sorting2
- Loading branch information
Showing
15 changed files
with
178 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from rich.console import Group | ||
from rich.panel import Panel | ||
from rich.progress import Progress, BarColumn | ||
from humanfriendly import format_size | ||
|
||
if TYPE_CHECKING: | ||
from cyberdrop_dl.managers.manager import Manager | ||
|
||
class SortProgress: | ||
"""Class that keeps track of sorted files""" | ||
|
||
def __init__(self, manager: 'Manager'): | ||
self.manager = manager | ||
self.sort_progress = Progress("[progress.description]{task.description}", | ||
BarColumn(bar_width=None), | ||
"[progress.percentage]{task.percentage:>3.2f}%", | ||
"{task.completed} of {task.total} Folders") | ||
|
||
self.sorted_dirs = 0 | ||
|
||
self.sort_progress_group = Group( self.sort_progress) | ||
self.sorted_dir_task_id = self.sort_progress.add_task("[green]Completed", total=0) | ||
|
||
|
||
async def set_total(self,total) -> None: | ||
"""sets the total number of directories to be be sorted""" | ||
self.sort_progress.update(self.sorted_dir_task_id,total=total) | ||
|
||
|
||
|
||
async def get_sort_progress(self) -> Panel: | ||
"""Returns the progress bar""" | ||
return Panel(self.sort_progress_group, title=f"Config: {self.manager.config_manager.loaded_config}", border_style="green", padding=(1, 1)) | ||
|
||
|
||
|
||
async def add_sorted_dir(self) -> None: | ||
"""Adds a completed dir to the progress bar""" | ||
self.sort_progress.advance(self.sorted_dir_task_id , 1) | ||
self.sorted_dirs += 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.