-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_config.py
155 lines (129 loc) · 6.1 KB
/
my_config.py
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#! /usr/bin/python
# My custom configuration.
from main import Config, Operation, FolderTemplate, create_file_rule
import constants as const
#----------------------------------------------------------------------------------------------
DEFAULT_FOLDERS: list[FolderTemplate] = [
FolderTemplate(
"~/Downloads",
[
"Compressed",
"Documents",
"Documents/Word",
"Documents/txt",
"Documents/Pdf",
"Documents/Ebook",
"Documents/RSS",
"Pictures",
"Pictures/Vector",
"Music",
"Music/midi",
"Music/Tracker",
"Video",
"Programs",
"Programs/Java",
"Programs/Shell",
"Programs/Python",
"Programs/Jupyter Notebook",
"Programs/Android",
"Programs/Sql",
"Programs/Python Libraries",
"Programs/Scratch",
"Programs/DLL",
"Folders",
"Disk Images",
"Torrents",
"Torrents/Linux",
"Torrents/Magnets",
"Misc",
"Misc/Valve stuff",
"Misc/No extension",
"Misc/Fonts",
"Misc/Anki",
"Misc/Bookmarks",
"Misc/Excalidraw",
"Misc/LMMS Projects",
"Misc/LMMS Presets",
"Misc/Krita Projects",
"Misc/SoundFonts",
"Misc/Paint NET Projects",
"Unsorted",
],
place_for_unwanted = "~/Downloads/Folders"
),
FolderTemplate(
"~/Pictures",
[
"Screenshots",
"Wallpapers"
]
)
]
#----------------------------------------------------------------------------------------------
DEFAULT_OPERATION: Operation = Operation(
["~/Downloads", "~/Downloads/Unsorted", "~/Downloads/Documents/"],
[
create_file_rule("~/Downloads/Compressed", const.ARCHIVES),
create_file_rule("~/Downloads/Documents/Word", ["docx"]),
create_file_rule("~/Downloads/Documents/Pdf", ["pdf"]),
create_file_rule("~/Downloads/Documents/Ebook", ["epub"]),
create_file_rule("~/Downloads/Documents/txt", ["txt"]),
create_file_rule("~/Downloads/Documents/RSS", extensions=["rss", "atom"]),
create_file_rule("~/Downloads/Pictures", const.IMAGE),
create_file_rule("~/Downloads/Pictures/Vector", ["svg"]),
create_file_rule("~/Downloads/Music", const.AUDIO),
create_file_rule("~/Downloads/Music/Tracker", ["it","mod","xm","s3m","umx", "mptm"]),
create_file_rule("~/Downloads/Music/midi", extensions=["mid"]),
create_file_rule("~/Downloads/Video", const.VIDEO),
create_file_rule("~/Downloads/Programs", extensions=["exe", "deb", "msi", "appimage", "AppImage","msu", "appinstaller", "flatpak"]),
create_file_rule("~/Downloads/Programs/Java", extensions=["jar"]),
create_file_rule("~/Downloads/Programs/Python", extensions=["py"]),
create_file_rule("~/Downloads/Programs/Shell", extensions=["sh"]),
create_file_rule("~/Downloads/Programs/Jupyter Notebook", extensions=["ipynb"]),
create_file_rule("~/Downloads/Programs/Android", extensions=["apk"]),
create_file_rule("~/Downloads/Programs/Sql", extensions=["sql"]),
create_file_rule("~/Downloads/Programs/Python Libraries", extensions=["whl"]),
create_file_rule("~/Downloads/Programs/DLL", extensions=["dll"]),
create_file_rule("~/Downloads/Programs/Scratch", extensions=["sb", "sb2", "sb3"]),
create_file_rule("~/Downloads/Torrents/Linux", keywords=["linux"], extensions=["torrent"]),
create_file_rule("~/Downloads/Torrents", extensions=["torrent"]),
create_file_rule("~/Downloads/Torrents/Magnets", extensions=["magnet"]),
create_file_rule("~/Downloads/Disk Images", extensions=["iso", "img"]),
create_file_rule("~/Downloads/Misc/Valve stuff", extensions=["vtf", "vpk"]),
create_file_rule("~/Downloads/Misc/Anki", extensions=["apkg"]),
create_file_rule("~/Downloads/Misc/Bookmarks", keywords=["bookmark"], extensions=["html", "json"]),
create_file_rule("~/Downloads/Misc/Excalidraw", extensions=["excalidraw", "drawio"]),
create_file_rule("~/Downloads/Misc/Fonts", extensions=["ttf","woff2","woff"]),
create_file_rule("~/Downloads/Misc/LMMS Projects", extensions=["mmpz", "mmp"]),
create_file_rule("~/Downloads/Misc/LMMS Presets", extensions=["xpf", "xpt", "xptz"]),
create_file_rule("~/Downloads/Misc/Krita Projects", extensions=["kra"]),
create_file_rule("~/Downloads/Misc/Paint NET Projects", extensions=["pdn"]),
create_file_rule("~/Downloads/Misc/SoundFonts", extensions=["sf2","sf3", "sfz"]),
create_file_rule("~/Downloads/Misc/No extension", extensions=""),
]
)
SORT_PICTURES: Operation = Operation(
["~/Pictures","~/Downloads/Pictures","~/Downloads"],
[
create_file_rule("~/Pictures/Screenshots", keywords=["screenshot"]),
create_file_rule("~/Pictures/Wallpapers", keywords=["wallpaper","unsplash", "pexels", "wallhaven", "1920x1080", "4k"])
]
)
# We may have some files after a cleanup, move them to the unsorted folder.
# NOTE: Do not merge with the operation above, this can create a cylce.
SORT_RESIDUAL_FILES: Operation = Operation(
["~/Downloads"],
[create_file_rule("~/Downloads/Unsorted/", keywords="")]
)
#----------------------------------------------------------------------------------------------
DEFAULT_CONFIG: Config = Config(
DEFAULT_FOLDERS,
[
SORT_PICTURES,
DEFAULT_OPERATION,
SORT_RESIDUAL_FILES # Must be placed last or can create a cycle
]
)
#----------------------------------------------------------------------------------------------
if __name__ == "__main__":
DEFAULT_CONFIG.export("./configs/B0ney_config.json")