Nextcloud sync
This commit is contained in:
parent
4c56fb8518
commit
7a1af96a19
1 changed files with 57 additions and 1 deletions
|
|
@ -7,6 +7,9 @@ import json
|
||||||
import csv
|
import csv
|
||||||
import sys
|
import sys
|
||||||
from openpyxl import Workbook, load_workbook
|
from openpyxl import Workbook, load_workbook
|
||||||
|
import subprocess
|
||||||
|
from shutil import which, copy2
|
||||||
|
import platform
|
||||||
|
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
# Kalenderwoche bestimmen
|
# Kalenderwoche bestimmen
|
||||||
|
|
@ -357,4 +360,57 @@ print()
|
||||||
print(f"CSV : {csv_file}")
|
print(f"CSV : {csv_file}")
|
||||||
print(f"JSON : {json_file}")
|
print(f"JSON : {json_file}")
|
||||||
print(f"Summary : {summary_file}")
|
print(f"Summary : {summary_file}")
|
||||||
print(f"Excel : {excel_file}")
|
print(f"Excel : {excel_file}")
|
||||||
|
|
||||||
|
# --------------------------------------------------
|
||||||
|
# Synchronisation
|
||||||
|
# --------------------------------------------------
|
||||||
|
|
||||||
|
if which("rclone"):
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
"rclone",
|
||||||
|
"copy",
|
||||||
|
str(excel_file),
|
||||||
|
"nextcloud:Finanzen"
|
||||||
|
],
|
||||||
|
check=True
|
||||||
|
)
|
||||||
|
|
||||||
|
print("Excel nach Nextcloud synchronisiert.")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
|
||||||
|
print(f"rclone Fehler: {e}")
|
||||||
|
|
||||||
|
elif platform.system() == "Windows":
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
target = (
|
||||||
|
Path.home()
|
||||||
|
/ "Nextcloud"
|
||||||
|
/ "Finanzen"
|
||||||
|
/ excel_file.name
|
||||||
|
)
|
||||||
|
|
||||||
|
copy2(excel_file, target)
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"Excel nach {target} kopiert."
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"Nextcloud-Kopie fehlgeschlagen: {e}"
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
print(
|
||||||
|
"Keine Synchronisationsmethode gefunden."
|
||||||
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue