-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path(config) CivitAI.ps1
More file actions
88 lines (87 loc) · 4.05 KB
/
(config) CivitAI.ps1
File metadata and controls
88 lines (87 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
###############################
# Folder where files will be downloaded
$DownloadFolder = ""
$FavoriteScanFolder = ""
###############################
# API endpoint and other settings
$BaseURL = "https://civitai.com/api/v1/images"
$DownloadBaseURL = "https://image.civitai.com/"
###############################
$DBFilename = "CivitAI.sqlite3"
$DBFilePath = "$PSScriptRoot/$DBFilename"
###############################
# API key for authentication
$API_Key = ""
###############################
#metadata fetch per request, minimum 1 maximum 200
$Limit = 200
###############################
#Sets PRAGMA default_cache_size. Increases RAM usage but decreases disk I/O. Default for sqlite is 2000 (pages). Set it to negative to use KB instead of pages.
$PRAGMA_default_cache_size = 20000
###############################
# Here you can choose how the output file will be named
# available options are: %Username%, %FileID%, %Filename%, %FileWidth%, %FileHeight%, %FileCreatedAt% (format: yyyy-mm-dd)
#e.g. [Username1] [123456] 0001-0002-0003 (2024-08-24)
$FilenameTemplate = "[%Username%] (%FileID%) %Filename% (%FileCreatedAt%)"
###### http response error handling
$maxRetries = 5
$initialDelay = 5000 # Initial delay in milliseconds
$MaxDelay = 60000 # max delay in milliseconds
###############################
# this is the amount of file skips that will abort the current user search. Set it to 0 to disable this.
$MaxSkipsBeforeAborting = 50
###############################
#if set to true, metadata such as model used and prompts will be saved to the database
#this will increase database size several times over
$DownloadPromptMetadata = $false
###############################
#time to wait between requests in milliseconds
$TimeToWait = 3000
###############################
#max parallel downloads. Not recommended to set this above the default unless you like to be rate limited.
$MaxConcurrentDownloads = 4
###############################
#how many seconds must pass after fetching metadata for a user's entire gallery before the script will check it again
$TimeToCheckAgainMetadata = 1209600
#how many seconds must pass after downloading a user's entire gallery before the script will try to download any new files from them in the database
#this is to speed things up when the script is closed for whatever reason
$TimeToCheckAgainDownload = 2592000
###############################
#if set to true, will add SFW files to the database
$AllowSFWFiles = $false
#if set to true, will add NSFW files to the database
$AllowNSFWFiles = $true
###############################
#Backup database on metadata/download start, needs 7zip installed and in PATH
$BackupDBOnStart = $false
###############################
#this will rename a file after adding it to favorites in the database using the pattern set in $FilenameTemplate. This is useful to rename old files you have around to a new pattern.
$RenameFileFavorite = $false
###############################
#convert files after downloading them. FFMPEG needs to be installed and in PATH
$ConvertFiles = $true
#Define the maximum number of parallel conversion jobs
$MaxThreads = 4
#Number of files to download before attempting conversion. Better to set it to $MaxThreads * 5
$ConvertFilesAmount = 50
#if set to true, will remove the original file after conversion
$RemoveOriginalFileAfterConversion = $true
#if set to true will save the converted file to directory named "Converted" inside the original folder
$SaveConvertedFileSubfolder = $false
#list of file types
#format is filetype, minimum filesize in KB, filetype to convert to, ffmpeg parameters
$FileListToConvert = @(
@("png", 0, "webp", "-c:v libwebp -q:v 100 -map_metadata 0"), #quality set to 100, keeps metadata
@("jpg", 600, "webp", "-c:v libwebp -q:v 100 -map_metadata 0"),
@("jpeg", 600, "webp", "-c:v libwebp -q:v 100 -map_metadata 0"),
@("gif", 1000, "mp4", "-c:v libx265 -crf 28 -preset slow -pix_fmt yuv420p") #convert gif to mp4 x265
)
###############################
###############################
# List of users to download files from
# format: username
$UserList = @(
"Username1",
"Username2"
)
###########