changed cache location to be local hdd rather than nextcloud
This commit is contained in:
parent
72f27e56db
commit
0b19f47483
6 changed files with 1577 additions and 5 deletions
|
@ -4,6 +4,9 @@ import std/[strutils,os,db_sqlite,osproc]
|
|||
const CLIP_DB = WM_TOOLS_DIR & ".clipurr_cache.sqlite"
|
||||
const KEEP_ITEMS = 20
|
||||
|
||||
proc openDBConn(): DBConn
|
||||
let db = openDBConn()
|
||||
|
||||
proc addClip(str: var string)
|
||||
|
||||
proc killOldRunningProcesses() =
|
||||
|
@ -42,7 +45,8 @@ proc openDBConn(): DBConn =
|
|||
return db
|
||||
|
||||
proc clearHistory() =
|
||||
let db = openDBConn()
|
||||
# let db = openDBConn()
|
||||
|
||||
defer: db.close()
|
||||
try:
|
||||
db.exec(sql"drop table if exists clip_items")
|
||||
|
@ -50,6 +54,8 @@ proc clearHistory() =
|
|||
echo getCurrentExceptionMsg()
|
||||
|
||||
proc maintainDB() =
|
||||
return # order by and offset doesn't work unless certain sqlite compile time options set
|
||||
# will create a different way to do this
|
||||
let db = openDBConn()
|
||||
try:
|
||||
db.exec(sql"""BEGIN""")
|
||||
|
@ -75,10 +81,10 @@ proc unescapeClip(str: string): string =
|
|||
|
||||
proc readClipFile(): seq[string] =
|
||||
var clips: seq[string] = @[]
|
||||
let db = openDBConn()
|
||||
# let db = openDBConn()
|
||||
defer: db.close()
|
||||
try:
|
||||
for row in db.fastRows(sql"select distinct(clip) from clip_items order by timestamp desc"):
|
||||
for row in db.fastRows(sql"select distinct(clip) from clip_items order by timestamp desc LIMIT ?", KEEP_ITEMS):
|
||||
var str = unescapeClip(row[0])
|
||||
clips.add(str)
|
||||
except:
|
||||
|
@ -92,7 +98,6 @@ proc addClip(str: var string) =
|
|||
var t = str[1..3]
|
||||
echo "Is a ", $t, " file , not storing"
|
||||
str = "[" & t & " Image] (not stored)"
|
||||
let db = openDBConn()
|
||||
defer: db.close()
|
||||
try:
|
||||
db.exec(sql"""BEGIN""")
|
||||
|
|
|
@ -34,7 +34,7 @@ type
|
|||
x*: int
|
||||
y*: int
|
||||
|
||||
const WM_TOOLS_DIR* = getHomeDir() & "Nextcloud/.wm_tools/"
|
||||
const WM_TOOLS_DIR* = getHomeDir() & ".wm_tools/"
|
||||
const background* = "#000000"
|
||||
const backgroundalt* = "#bb222222"
|
||||
const backgroundalt2* = "#bb333333"
|
||||
|
|
1567
i3-tree-example.txt
Normal file
1567
i3-tree-example.txt
Normal file
File diff suppressed because it is too large
Load diff
BIN
urr_example.mp4
BIN
urr_example.mp4
Binary file not shown.
Loading…
Reference in a new issue