Skip to content

Commit

Permalink
Merge pull request #119 from caffo/fix-unzipped-files
Browse files Browse the repository at this point in the history
Fix downloading for non zipped files (and tests)
  • Loading branch information
MatthieuBizien authored Oct 31, 2024
2 parents 2381924 + 9593614 commit a5c4e64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-20.04, windows-latest]
python: [ 3.6, 3.7, 3.8, 3.9 ]
python: [ 3.13 ]

env:
OS: ${{ matrix.os }}
Expand All @@ -34,4 +34,4 @@ jobs:
python -m pip install mypy
- name: Run backup
run: ./tests.py
run: ./tests.py
8 changes: 6 additions & 2 deletions roam_to_git/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import time
import shutil
from pathlib import Path

import git
Expand Down Expand Up @@ -115,8 +116,11 @@ def main():
return
# Unzip and save all the downloaded files.
for f in roam_formats:
unzip_and_save_archive(f, root_zip_path / f, git_path / f)

if (f == "markdown") or (f == "formatted"):
logger.debug("Unzipping and saving {}", f)
unzip_and_save_archive(f, root_zip_path / f, git_path / f)
else:
shutil.copytree(root_zip_path / f, git_path / f, dirs_exist_ok=True)
if "formatted" in args.formats:
formatted = format_markdown(read_markdown_directory(git_path / "markdown"))
save_files("formatted", git_path / "formatted", formatted)
Expand Down
3 changes: 2 additions & 1 deletion roam_to_git/scrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, browser, output_directory, headless=True, debug=False):
logger.trace("Start Firefox")
self.browser = webdriver.Firefox(firefox_profile=firefox_profile,
firefox_options=firefox_options)

elif browser == Browser.PHANTOMJS:
raise NotImplementedError()
# TODO configure
Expand Down Expand Up @@ -238,7 +239,7 @@ def _download_rr_archive(browser: Browser,
if i % 60 == 0:
logger.debug("Keep waiting for {}, {}s elapsed", output_type, i)
for file in output_directory.iterdir():
if file.name.endswith(".zip"):
if file.name.endswith(".zip") or file.name.endswith(output_type.lower()):
logger.debug("File {} found for {}", file, output_type)
time.sleep(1)
return
Expand Down

0 comments on commit a5c4e64

Please sign in to comment.