1
0
Some super kludgy Python to export all your Taguette tags into Google Docs and then to "reimport" them back. This makes mass renaming much easier. Use at your own risk!
Go to file
2023-02-27 17:21:15 -08:00
.gitignore added gitignore file to help keep things clean 2023-02-27 16:55:36 -08:00
.taguette_gdocs added new configuration file and README 2021-12-08 14:45:08 +09:00
README.md Merge branches 'master' and 'master' of /home/healspersecond/taguette_google_sheet_integration 2023-02-27 16:54:38 -08:00
taguette-export_tags_to_csv.py urlencode tags in the urls we're generating 2023-02-27 17:06:11 -08:00
taguette-update_tags_from_sheet.py add support for multiple projects to the update code 2023-02-27 17:21:15 -08:00

Step 0: Setup

If you have not already done so, please edit the file .taguette_gdocs in this directory. You must enter ever variable marked with "CHANGME." You only need to do this once.

In order to not commit your changes into git, you can run this command:

git update-index --assume-unchanged .taguette_gdocs

I also create a directory called taguette_backups and one called exported_tags like:

mkdir taguette_backups
mkdir exported_tags

Step 1: Backing things up

Do this every time before you run the script:

sudo systemctl stop taguette
BACKUP_FILE="taguette-snapshot-$(date +%Y%m%d-%H%M%S).sqlite3"
sudo cp /var/lib/taguette/taguette.sqlite3 "taguette_backups/$BACKUP_FILE"
cp "taguette_backups/$BACKUP_FILE" ./taguette-working.sqlite3

The first line shuts down Taguette. The second line just creates the backup file name. The third and fourth lines will create a new backup file and copy the backup file into the ./taguette-working.sqlite3.

Step 2a: Import from Google Sheets into the database

If everything is setup well, you should just need to run:

python3 taguette-update_tags_from_sheet.py

Check for errors! If you don't see any, you will need to copy the database back like:

sudo cp ./taguette-working.sqlite3 /var/lib/taguette/taguette.sqlite3
sudo chown taguette:taguette /var/lib/taguette/taguette.sqlite3

Step 2b: Exporting from the database

Exporting tags should be as easy as:

python3 taguette-export_tags_to_csv.py

This will create a new file called exported_tags.tsv which you can manually move into the spreadsheet.

Step 3: Restarting Taguette

Once everything looks good, go ahead and restart Taguette like:

sudo systemctl start taguette

You can check it with systemctl status taguette but keep in mind it takes some time startup.