Skip to content

Storage Templates and Migration

Isaac edited this page Jan 11, 2023 · 4 revisions

Storage Templates

Storage templates are used to customize how folders and files are saved. The template settings can be modified at Admin > Settings and clicking the "Storage Template Settings" button. There are two fields, folder and file. The folder template must include {{uuid}} to prevent overwriting files.

The available variables for the folder and file templates are:

Ganymede Variables

  • {{uuid}}: Ganymede internal ID for the video. This must be included somewhere in the folder template.

Twitch Variables

  • {{id}}: Twitch ID for the video.
  • {{channel}}: Channel name that owns the video.
  • {{title}}: Title of the video (note: the title is sanitized for file systems replacing any illegal characters with an underscore).
  • {{date}}: Date the video was streamed or uploaded.
  • {{type}}: Type of video (archive, highlight, or upload).

Examples

Folder

{{id}}-{{uuid}}
// 123456789-92e1ab28-912a-11ed-abfa-0242ac110002
{{date}}-{{id}}-{{type}}-{{uuid}}
// 2022-01-10-123456789-archive-92e1ab28-912a-11ed-abfa-0242ac110002
{{date}}-{{title}}-{{type}}-{{id}}-{{uuid}}
// 2022-01-10-File_Safe_Title-archive-123456789-92e1ab28-912a-11ed-abfa-0242ac110002

Migration

A manual task for applying the current storage templates to existing files can be found at Admin > Tasks under "Storage".

Some notes about this task:

  • May not work if you have custom files or manually imported videos. If you kept the file scheme while manually adding videos as Ganymede videos you should be OK.
  • The task will loop through each video in the database, attempting to rename each file.
    • The first rename attempt uses the video path. If that fails then that video is skipped and logged to the console.
    • If renames error after the video path, the video is not skipped. Any errors are logged to the console and you should fix them manually.
  • All of the *_path (video_path, chat_path, thumbnail_path) database fields are renamed first, then the video folder.
  • Task can be run multiple times if you wish to update the templates further.
Clone this wiki locally