Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions config.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ google_drive:
folder:
share_with:

references:
- file: survey.gpkg
table: notes
local_path_column: photo
driver_path_column: ext_url
# Reference rewriting is optional and OFF by default. Uncomment and adjust to
# have media-sync write uploaded file URLs into a GeoPackage table. Leave empty to only copy files.
references: []
#references:
# - file: survey.gpkg
# table: notes
# local_path_column: photo
# driver_path_column: ext_url

daemon:
sleep_time: 10
9 changes: 6 additions & 3 deletions media_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,14 @@ def _update_references(files):
if not all(reference_config):
return

gpkg_path = os.path.join(config.project_working_dir, ref.file)
if not os.path.exists(gpkg_path):
print(f"Skipping references - file not found in project: {ref.file}")
continue

print("Updating references ...")
try:
gpkg_conn = sqlite3.connect(
os.path.join(config.project_working_dir, ref.file)
)
gpkg_conn = sqlite3.connect(gpkg_path)
gpkg_conn.enable_load_extension(True)
gpkg_cur = gpkg_conn.cursor()
gpkg_cur.execute('SELECT load_extension("mod_spatialite")')
Expand Down
Loading