Skip to content

Commit

Permalink
UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sgorblex committed May 31, 2021
1 parent 589af85 commit fc300fa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@



## [UNRELEASED] v0.3 Menus
## v0.3 Menus
Major improvements to usability.


### Download
See [PyPI release page](https://pypi.org/project/unimi-dl/0.3.0)


### Release notes

#### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Major improvements to usability.

#### Changed
- The default behavior for downloading is now the interactive choice. For the previously default behavior use `-a`
- IMPORTANT: the downloaded list now stores both the manifests and the video titles. The new format is not compatible with the old one, therefore you might have to delete `downloaded.json` (it resides in the same directory specified for `credentials.json` in `unimi-dl --help`)
- IMPORTANT: the downloaded list now stores both the manifests and the video titles. The new format is not compatible with the old one, therefore you might have to delete `downloaded.json` (it resides in the same directory specified for `credentials.json` in `unimi-dl --help`). In this case you may find useful using `--add-to-downloaded-only` for re-adding previously downloaded videos.



Expand Down
50 changes: 28 additions & 22 deletions unimi_dl/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,12 @@ def cleanup_downloaded(downloaded_path: str) -> None:
main_logger.error("Your selection is not valid")
exit(1)
main_logger.debug(f"{len(chosen)} names chosen")
for manifest in chosen:
downloaded_dict.pop(manifest)
downloaded_file.seek(0)
downloaded_file.write(json_dumps(downloaded_dict))
downloaded_file.truncate()
if len(chosen) != 0:
for manifest in chosen:
downloaded_dict.pop(manifest)
downloaded_file.seek(0)
downloaded_file.write(json_dumps(downloaded_dict))
downloaded_file.truncate()
downloaded_file.close()
main_logger.info("Cleanup done")

Expand Down Expand Up @@ -299,23 +300,28 @@ def main():
all_manifest_dict = getPlatform(
email, password, opts.platform).get_manifests(opts.url)

if opts.all or opts.platform == "panopto":
manifest_dict = all_manifest_dict
if len(all_manifest_dict) == 0:
main_logger.warning("No videos found")
else:
try:
selection = multi_select(
list(all_manifest_dict.keys()), selection_text="\nVideos to download: ")
except WrongSelectionError:
main_logger.error("Your selection is not valid")
exit(1)
manifest_dict = {name: all_manifest_dict[name] for name in selection}

main_logger.info(f"Videos: {list(manifest_dict.keys())}")

downloaded_dict, downloaded_file = get_downloaded(downloaded_path)

download(opts.output, manifest_dict, downloaded_dict,
downloaded_file, opts.simulate, opts.add_to_downloaded_only)
downloaded_file.close()
if opts.all or opts.platform == "panopto":
manifest_dict = all_manifest_dict
else:
try:
selection = multi_select(
list(all_manifest_dict.keys()), selection_text="\nVideos to download: ")
except WrongSelectionError:
main_logger.error("Your selection is not valid")
exit(1)
manifest_dict = {
name: all_manifest_dict[name] for name in selection}

if len(manifest_dict) != 0:
main_logger.info(f"Videos: {list(manifest_dict.keys())}")

downloaded_dict, downloaded_file = get_downloaded(downloaded_path)

download(opts.output, manifest_dict, downloaded_dict,
downloaded_file, opts.simulate, opts.add_to_downloaded_only)
downloaded_file.close()
main_logger.debug(
f"=============job end at {datetime.now()}=============\n")

0 comments on commit fc300fa

Please sign in to comment.