-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git integration #137
base: main
Are you sure you want to change the base?
Git integration #137
Conversation
I would suggest making this completely optional feature. Because using git on PDFs, MP4s and co. increases the storage requirement drastically, usually by at least double. I would then directly make it so that GitPython is an optional dependency (I had that in mind for yt-dlp as well). For this we need to use lazy loading of the modules, I would just include lazy-import in the project for this, https://pypi.org/project/lazy-import/. To use it to load the git module only if needed. We can also build lazy loading ourselves with a 6 line, but I think lazy-import covers more error possibilities and so we are prepared for future lazy imports. |
As an alternative to lazy loading, we could also simply disable the functionality by a try except block if the module is not found. Or we just add GitPython as a dependency, it's actually not a big dependency either, just unnecessary for the users who don't use it. But the functionality itself should be configurable (i.e. deactivatable). |
https://github.com/C0D3D3V/Moodle-Downloader-2/blob/ab4560de165e2e7a0a54e8fda1d5c1cf8d94b9dd/moodle_dl/download_service/path_tools.py#L14 |
Yes, the configuration-thing is added to the todolist! As well as the search for a solution to the debendency.
Ouch, that's a coding-error by myself. Thank you for stating that! |
Just checked the code again. If I understood it correctly, |
I had completely forgotten about this 😂, actually my goal was never to manipulate the data I get from moodle so that they are identical in the local database. Apparently I had changed my mind at one point :D Well then you can ignore that of course. |
Mh but we have to care about the Or we simply read the path from the |
It is also questionable whether you really want to add all untracked files or only the changes that were passed in changed_courses (in the latter case you should also use changed_courses_to_notify instead, because it contains all changed files even after a fatal error). Since the user himself can make changes as he wants, but whether these should be tracked is his decision. Maybe you could make this as an option. Also, files can change if they have changed online. moodle-dl does create a copy of the old file but overwrites the path of the old file with a new file. So you have to stage the modified files as well. |
As discussed in PR C0D3D3V#137, the User can and maybe will change the folder where the files are stored.
As discussed in PR C0D3D3V#137, the User can and maybe will change the folder where the files are stored.
c309031
to
47b3e62
Compare
Be careful when using GitPython:
https://gitpython.readthedocs.io/en/stable/intro.html#limitations |
This is a draft PR, since I'm currently working on the feature asked for in #46 and wanted to just note, that you can ask for changes or bring up your ideas, what I could improve.
At the current stage most planed functionality is not yet implemented, but at least a core function is implemented. An important todo is the documentation, which I still have to add.
The current state is, that I've implemented a git-repository for all courses, and after each call I've added a commit.
Anyway: I'm open to any suggestions/remarks.