mirror of
https://git.srhtnin.garden/sarah/SaraSortd.git
synced 2026-10-14 18:48:11 +02:00
7.6: never sort system files or its own configs; macOS notes
This commit is contained in:
1 parent
a6a5b28631
commit
418f0f581f
7 files changed
+27
-11
No files matched your search
@@ -0,0 +1,2 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
Title = "SaraSortd Config"
|
||||
Version = "7.5"
|
||||
Version = "7.6"
|
||||
SafeMode = 1
|
||||
SilentMode = 0
|
||||
SortTimer = 1
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
Title = "Unset"
|
||||
Version = "7.5"
|
||||
Version = "7.6"
|
||||
ParentDir = "Unset"
|
||||
SortDirs = 0
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
Title = "Unset"
|
||||
Version = "7.5"
|
||||
Version = "7.6"
|
||||
LastFile = "Unset"
|
||||
ParentDir = "Unset"
|
||||
ValidInputDirs = ["*"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<img align="center" src="https://git.srhtnin.garden/sarah/RepoAssets/raw/branch/main/SaraSortd/Banners/SaraSortd.png" width="100%" alt="SaraSortd: a file and directory sorting daemon built with python."/>
|
||||
|
||||
(Version = "7.5")
|
||||
(Version = "7.6")
|
||||
|
||||
|
||||
It's made by Sarah, hence the name. :3
|
||||
@@ -44,7 +44,7 @@ Here's a step-by-step tutorial (in case you don't want to watch the video).
|
||||
1. Install ZIP-file by clicking the green "Code" button on the top right, then clicking "Download Zip".
|
||||
2. Unzip ZIP-file wherever you want the program to live.
|
||||
3. Edit your config files to your liking. Make sure to edit your paths! (E.G. RootDir = "/home/janedoe/Programs/SaraSortd")
|
||||
4. Navigate to the new SaraSortd directory in your terminal (CMD / PowerShell on Windows).
|
||||
4. Navigate to the new SaraSortd directory in your terminal (CMD / PowerShell on Windows, Terminal on macOS).
|
||||
5. Run ```python SaraSortd.py``` to run the program. (This will make new directories for you.)
|
||||
6. Edit your new output directories' configs.
|
||||
|
||||
@@ -58,7 +58,7 @@ 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 = "7.5" # Just the version number for the config file.
|
||||
Version = "7.6" # 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.
|
||||
|
||||
@@ -66,7 +66,9 @@ SilentMode = 0 # If SaraSortd should write things it does, to the terminal.
|
||||
|
||||
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.
|
||||
DotFiles = 0 # If SaraSortd should sort files that begin with ".". This is mainly for Linux and macOS users, since hidden files always have "." in front of them.
|
||||
# Files the system makes in every folder you look at are never sorted, whatever DotFiles says (since 7.6): .DS_Store (macOS' Finder), Thumbs.db and desktop.ini (Windows' Explorer).
|
||||
# SaraSortd's own files in an input folder (its config and history) are never sorted either, also with DotFiles = 1 (since 7.6).
|
||||
# Files that are still downloading are never sorted or even checked (since 7.4): anything ending in .part (Firefox), .crdownload (Chrome and other Chromium browsers) or .download (Safari), and a file next to its own unfinished download (like the empty "video.mp4" Firefox makes beside "video.mp4.part"). They're sorted as usual once the download finishes.
|
||||
|
||||
Logging = 1 # If SaraSortd's logging system should be active. If this is 0, nothing will be logged into files.
|
||||
@@ -170,7 +172,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 = "7.5" # The version number of the config.
|
||||
Version = "7.6" # 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.
|
||||
|
||||
@@ -226,7 +228,7 @@ 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 = "7.5"
|
||||
Version = "7.6"
|
||||
|
||||
ParentDir = "Unset" # The name of this directory. It gets automatically updated when this config gets copied to an output directory.
|
||||
|
||||
|
||||
+14
-2
@@ -6,7 +6,7 @@ import shutil
|
||||
import time
|
||||
import toml
|
||||
|
||||
# Version = "7.5"
|
||||
# Version = "7.6"
|
||||
|
||||
ConfPath = "./GlobalConf.toml"
|
||||
|
||||
@@ -403,6 +403,15 @@ def FileInputValid(File, FilePath, ParentName):
|
||||
PartialDownloadSuffixes = (".part", ".crdownload", ".download")
|
||||
|
||||
|
||||
# Files the system makes in every folder you look at (since 7.6): macOS' Finder writes .DS_Store,
|
||||
# Windows' Explorer Thumbs.db and desktop.ini. Never sorted, whatever DotFiles says.
|
||||
SystemFileNames = (".ds_store", "thumbs.db", "desktop.ini")
|
||||
|
||||
|
||||
def IsSystemFile(FilePath):
|
||||
return os.path.basename(FilePath).lower() in SystemFileNames
|
||||
|
||||
|
||||
def IsPartialDownload(FilePath):
|
||||
if os.path.basename(FilePath).lower().endswith(PartialDownloadSuffixes):
|
||||
return True
|
||||
@@ -679,9 +688,12 @@ def Main():
|
||||
with open(FileHistoryPath, "w", encoding = "utf-8") as HistoryFile:
|
||||
toml.dump({"Title": f"{os.path.basename(InputPath)} History", "History": [] }, HistoryFile)
|
||||
|
||||
# SaraSortd's own files in the folder (its configs and history) stay put, also with DotFiles = 1 (since 7.6).
|
||||
OwnFiles = {Slashes(os.path.abspath(Own)) for Own in (DirConfPath(InputPath, "In"), DirConfPath(InputPath, "Out"), HistoryPath(InputPath))}
|
||||
|
||||
for FileName in os.listdir(InputPath):
|
||||
FilePath = f"{InputPath}/{FileName}"
|
||||
if IsPartialDownload(FilePath):
|
||||
if IsPartialDownload(FilePath) or IsSystemFile(FilePath) or Slashes(os.path.abspath(FilePath)) in OwnFiles:
|
||||
continue
|
||||
|
||||
if os.path.isdir(FilePath) and InputDirConf.get("SortDirs", 0) == 0:
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user