3 Commits
Author SHA1 Message Date
sarah 70a36d8b96 Merge pull request #61 from SRHTNIN/SarahTest
Sarah test
2026-05-10 23:35:59 +02:00
sarah 19ceec218f Renamed CheckInput tot SortTimer, added Unzip parameter with a list, and
fixed sorting directories to not need admin (at least on linux).
2026-05-10 23:33:44 +02:00
sarah 2cc72b1730 Added unzipping function, but haven't tested it yet. 2026-05-10 21:42:21 +02:00
5 changed files with 41 additions and 13 deletions

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
Title = "SaraSortd Config"
Version = "6.3"
Version = "7.0"
SafeMode = 1
SilentMode = 0
CheckInput = 5
SortTimer = 1
DotFiles = 0
Logging = 1
OverwriteDirConf = 0
+1 -1
View File
@@ -1,5 +1,5 @@
Title = "Unset"
Version = "6.3"
Version = "7.0"
ParentDir = "Unset"
SortDirs = 0
+2 -1
View File
@@ -1,10 +1,11 @@
Title = "Unset"
Version = "6.3"
Version = "7.0"
LastFile = "Unset"
ParentDir = "Unset"
ValidInputDirs = ["*"]
FileLimit = 0
DeleteOrg = 1
Unzip = []
[[Files]]
Pattern = "*"
+9 -6
View File
@@ -1,6 +1,6 @@
<img align="center" src="https://github.com/SRHTNIN/RepoAssets/blob/main/SaraSortd/Banners/SaraSortd.png" width="100%" alt="SaraSortd: a file and directory sorting daemon built with python."/>
(Version = "6.3")
(Version = "7.0")
It's made by Sarah, hence the name. :3
@@ -58,13 +58,13 @@ Here's a step-by-step tutorial (in case you don't want to watch the video).
```
Title = "SaraSortd Config" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "6.3" # Just the version number for the config file.
Version = "7.0" # Just the version number for the config file.
SafeMode = 1 # If SaraSortd should stop if an error with the config appears. 1 is stop, 0 is continue.
SilentMode = 0 # If SaraSortd should write things it does, to the terminal.
CheckInput = 3 # How many seconds it takes for SaraSortd to check input directories for new files to sort.
SortTimer = 3 # How many seconds it takes for SaraSortd to check input directories for new files to sort.
DotFiles = 0 # If SaraSortd should sort files that begin with ".". This is mainly for linux users, since hidden files always have "." in front of them.
@@ -158,7 +158,7 @@ The output directory config references the SaraSortd config (GlobalConf.toml). T
```
Title = "Unset" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "6.3" # The version number of the config.
Version = "7.0" # The version number of the config.
LastFile = "Unset" # The last file that was sorted to this directory. It gets automatically updated whenever a file gets sorted to this directory.
@@ -170,6 +170,9 @@ FileLimit = 0 # The max limit of files a directory can have. If this is 0, then
DeleteOrg = 1 # If SaraSortd should delete the original file or not. If this is 1, then sorted files will be 'moved' to an output directory. If not, they will be 'copied' to an output directory.
Unzip = [] # What type of files this output directory should try to unzip. E.G:
# Unzip = ["zip", "tar.gz"] would unzip .zip files and .tar files. This pairs insanely well with input directories' config's "SortDirs" parameter.
[[Files]] # The double brackets means that you can add multiple types of files to be sorted here. Just copy [[Files]] and all the parameters under it, and paste it under or over this section, then you may change the values of the new parameters. E.G:
# [[Files]]
@@ -209,11 +212,11 @@ Overwrite = 1 # Whether this specific file type can be overwritten by others of
```
Title = "Unset" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "6.3"
Version = "7.0"
ParentDir = "Unset" # The name of this directory. It gets automatically updated when this config gets copied to an output directory.
SortDirs = 0 # If the input directory should be allowed to sort directories within it. (Currently needs admin privileges to delete the original directory after sorting it).
SortDirs = 0 # If the input directory should be allowed to sort directories within it. Automatically uses .zip to move directories.
[[Files]] # The double brackets means that you can add multiple types of files to be sorted here. Just copy [[Files]] and all the parameters under it, and paste it under or over this section, then you may change the values of the new parameters.
+27 -3
View File
@@ -6,7 +6,7 @@ import shutil
import time
import toml
# Version = "6.3"
# Version = "7.0"
ConfPath = "./GlobalConf.toml"
@@ -500,6 +500,30 @@ def Main():
for Output in ConfDirs["OutputDir"]:
OutputPath = Parse(Output)
OutDirConfPath = f"{OutputPath}/{Parse(ConfNames["OutDirConfName"], Parent = os.path.basename(OutputPath))}.toml"
if len(GetConf("Unzip", OutDirConfPath)) >= 1:
ZipTypes = GetConf("Unzip", OutDirConfPath)
for OutputFile in os.listdir(OutputPath):
if OutputFile.startswith("."):
continue
for ZipType in ZipTypes:
print(ZipType)
if (OutputFile.lower()).endswith((ZipType).lower()):
shutil.unpack_archive(f"{OutputPath}/{OutputFile}", OutputPath)
TextOutput = Parse(String = ConfLog["Unzipping"], VarCall = f"{OutputPath}/{OutputFile}")
LogWrite(TextOutput)
Speak(TextOutput)
try:
os.remove(f"{OutputPath}/{OutputFile}")
except PermissionError:
TextOutput = Parse(String = ConfLog["NoPermission"], VarCall = f"remove {OutputPath}/{OutputFile}")
LogWrite(TextOutput)
Speak(TextOutput)
continue
if (OutputPath == InputPath):
RecurseDir = True
@@ -537,7 +561,7 @@ def Main():
shutil.make_archive(FilePath, "zip", FilePath)
try:
os.rmdir(FilePath)
shutil.rmtree(FilePath, ignore_errors=True)
except PermissionError:
TextOutput = Parse(String = ConfLog["NoPermission"], VarCall = f"remove directory {InputPath}/{FileName}")
@@ -555,7 +579,7 @@ def Main():
Sort(FilePath)
time.sleep(Conf.get("CheckInput", 10))
time.sleep(Conf.get("SortTimer", 10))
except KeyboardInterrupt:
TextOutput = GetConf("Stop", ConfPath)