Skip to content

Latest commit

 

History

History
134 lines (82 loc) · 7.07 KB

google_drive_guide.md

File metadata and controls

134 lines (82 loc) · 7.07 KB

How to Set Up Google Drive with AnkiCollab

AnkiCollab is a collaborative tool for sharing Anki decks. It allows you to share your decks with your subscribers and create a collaborative community of users who can contribute and learn together. However, one of the limitations of AnkiCollab is that it doesn't support media files directly, and this can be a problem if your decks rely heavily on images or audio. Fortunately, you can use Google Drive to store and share your media files with your subscribers. In this guide, we'll walk you through the steps to set up Google Drive with AnkiCollab.

If you follow this guide, it will take you roughly 5-10 minutes to set up full media support for your deck and you won't have to spend another second thinking about it afterwards.

Disclaimer: Use at Your Own Risk

The approach described in this guide involves the use of Google Service Accounts to automate access to Google Drive data. This method requires sharing the private key associated with the service account in a public setting, which poses significant security risks. By exposing the private key, unauthorized parties could potentially gain access to the associated Google Drive data, leading to data breaches, unauthorized modifications, or loss of data.

Users are strongly advised to understand the security implications before proceeding. It is currently the only automated media support AnkiCollab offers, but generally speaking not recommended.

Additionally, the use of Google APIs may incur costs depending on the level of usage. Users should review the Google Cloud pricing structure to avoid unexpected charges.

The authors and contributors of this project disclaim any responsibility for data loss, unauthorized access, security breaches, or financial costs resulting from the use of this approach. Proceed with caution and at your own risk.

Step 1: Create a Google Account

If you don't have a Google account, you'll need to create one. You can use your existing Google account, but we recommend creating a new one so that your subscribers will have limited access to it. In theory, the public has full access to everything on your drive, so always keep that in mind.

  1. Go to the Google Cloud Console.
  2. Click on "Select a project". Select a Project
  3. Create a new project. Create a New Project
  4. Enter a name for the project and click "Create". Enter Project Name
  5. Select the project. Select Project

Step 2: Enable Google Drive API

  1. Open the Google Drive API page in your Google Cloud Console.
  2. Enable the API by clicking the "Enable" button. Enable API
  3. A new page will open. Click on "Credentials". Click on Credentials
  4. Click on "Create Credentials". Create Credentials
  5. Select "Service account" and enter a name for the account. Service Account
  6. Click "Done" to create the account. Create Account
  7. Store the email address displayed on the screen somewhere safe. Store Email Address
  8. Click on "Keys". Click on Keys
  9. Create a new key by clicking on the "Add Key" button and selecting "JSON". Create New Key
  10. Click "Create" to download the JSON file. Download JSON File

Congratulations! You have now completed the hard part of setting up Google Drive with AnkiCollab.

Step 3: Create a Folder in Google Drive

Go to Google Drive and create a new folder by right-clicking somewhere and selecting "New Folder"

new folder

Create a new folder and open it.

open folder

Note that every folder in Google Drive has a unique name worldwide, and we need that unique name to identify the folder that AnkiCollab should put the media in. To obtain this unique identifier, copy the part of the URL after "folders/". In my case, it is 17RJYNO1JlX8veXUedPVlOgTt9jqeV0v-.

Step 11: As a final step, invite the service account we created earlier to your folder so that it has access. Click "Manage Access" in the folder's context menu.

manage access

Enter the email address you stored earlier. If you forgot to save it, you can find it again on the "Credentials" page in the Google Cloud Console.

enter email address

Disable notifications and send the invite.

send invite

The folder should now have two people with access: you and your service account.

folder access

Bonus Step: If you want to allow anyone with the link to view the media files, you can allow "General access" to "Anyone with the link" by clicking "Manage access" again.

general access

Congratulations! You are now 99% done. The final step is to set up your Google media in AnkiCollab.

Step 12: Navigate to https://www.ankicollab.com/ManageDecks/ and select your deck.

select deck

Click "Set up" next to "Google Media".

set up google media

Drag and drop or select the file that was downloaded earlier.

upload file

The upload should be confirmed with blue text.

upload confirmation

Enter the folder ID that you extracted earlier.

enter folder ID

Finally, hit "Save" and you're done!

save

Sync the changes with your Anki Desktop App

You're now done with the hard part! Well done! All you need to do now is sync in your Desktop Anki Application by clicking "Check for new content" in the AnkiCollab Toolbar. This retrieves the latest changes you made on the website and you will be able to upload or download media files. The same applies to your subscribers. They need to sync to get the updated media information.

Next time somebody creates a new card with a media file, it will automatically be uploaded to the Google Drive folder.

If you don't start from scratch with your deck, you can also upload all media files from your deck to the google drive folder with just one button. To do that, open the Deck Overview in Anki, click on the gearwheel next to your deck and click "Upload new Media". This will upload all media files to Google Drive (and skip existing files).

bulk upload media

Your existing subscribers can also quickly download all media files with just one button.

download media

Congratulations again, and enjoy using AnkiCollab with your Google Drive storage solution!