Skip to content

Commit 7ace212

Browse files
Cleanup (#211)
* Add path cleanup feature * Update dependencies * Fix default cfg * Fix linting * Minor changes
1 parent 7db72f8 commit 7ace212

File tree

8 files changed

+2195
-2216
lines changed

8 files changed

+2195
-2216
lines changed

namer/comparison_results.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,15 @@ def new_file_name(self, template: str, config: NamerConfig, infix: str = "(0)")
254254
if config.plex_hack:
255255
name = re.sub(r'[sS]\d{1,3}:?[eE]\d{1,3}', '', name)
256256

257+
if config.path_cleanup:
258+
path = PurePath(name)
259+
name = path.stem
260+
name = re.sub(r'[- ]+$', '', name)
261+
name = re.sub(r'-\s+-', '-', name)
262+
name = name + path.suffix
263+
if path.parts:
264+
name = str(path.parent / name)
265+
257266
return name
258267

259268
@staticmethod

namer/configuration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ class NamerConfig:
259259
Should plex movies have S##E## stripped out of movie names (to allow videos to be visible in plex)
260260
"""
261261

262+
path_cleanup: bool = False
263+
"""
264+
Cleanup final filename
265+
"""
266+
262267
override_tpdb_address: str = "https://api.metadataapi.net"
263268
"""
264269
Used only for testing, can override the location of the porn database - usually to point at a locally
@@ -506,6 +511,7 @@ def to_dict(self) -> dict:
506511
"requests_cache_expire_minutes": self.requests_cache_expire_minutes,
507512
"override_tpdb_address": self.override_tpdb_address,
508513
"plex_hack": self.plex_hack,
514+
"path_cleanup": self.path_cleanup,
509515
},
510516
"Phash": {
511517
"search_phash": self.search_phash,

namer/configuration_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def set_boolean(updater: ConfigUpdater, section: str, key: str, value: bool) ->
235235
"requests_cache_expire_minutes": ("namer", to_int, from_int),
236236
"override_tpdb_address": ("namer", None, None),
237237
"plex_hack": ("namer", to_bool, from_bool),
238+
"path_cleanup": ("namer", to_bool, from_bool),
238239
"search_phash": ("Phash", to_bool, from_bool),
239240
"use_distant_matching": ("Phash", to_bool, from_bool),
240241
"send_phash": ("Phash", to_bool, from_bool),

namer/namer.cfg.default

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ max_performer_names = 6
122122
# When plex hack is set to True, any matches of e##s## are removed from the Scene name.
123123
plex_hack = False
124124

125+
# Cleanup final filename
126+
path_cleanup = False
127+
125128
# Path where stores namer system data.
126129
database_path = ./database
127130

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,34 @@
1313
},
1414
"dependencies": {
1515
"@popperjs/core": "^2.11.8",
16-
"bootstrap": "^5.3.1",
17-
"bootstrap-icons": "^1.10.5",
16+
"bootstrap": "^5.3.2",
17+
"bootstrap-icons": "^1.11.1",
1818
"datatables.net": "^1.13.6",
1919
"datatables.net-bs5": "^1.13.6",
20-
"jquery": "^3.7.0",
20+
"jquery": "^3.7.1",
2121
"lodash": "^4.17.21"
2222
},
2323
"devDependencies": {
24-
"@babel/core": "^7.22.10",
25-
"@babel/preset-env": "^7.22.10",
24+
"@babel/core": "^7.23.0",
25+
"@babel/preset-env": "^7.22.20",
2626
"babel-loader": "^9.1.3",
2727
"copy-webpack-plugin": "^11.0.0",
2828
"css-loader": "^6.8.1",
2929
"css-minimizer-webpack-plugin": "^5.0.1",
30-
"eslint": "^8.47.0",
30+
"eslint": "^8.50.0",
3131
"eslint-config-standard": "^17.1.0",
3232
"eslint-plugin-import": "^2.28.1",
33-
"eslint-plugin-n": "^16.0.2",
33+
"eslint-plugin-n": "^16.1.0",
3434
"eslint-plugin-promise": "^6.1.1",
3535
"file-loader": "^6.2.0",
3636
"html-minimizer-webpack-plugin": "^4.4.0",
3737
"husky": "^8.0.3",
3838
"lint-staged": "^14.0.1",
3939
"mini-css-extract-plugin": "^2.7.6",
40-
"postcss": "^8.4.28",
40+
"postcss": "^8.4.30",
4141
"postcss-loader": "^7.3.3",
42-
"postcss-preset-env": "^9.1.1",
43-
"sass": "^1.66.1",
42+
"postcss-preset-env": "^9.1.4",
43+
"sass": "^1.68.0",
4444
"sass-loader": "^13.3.2",
4545
"terser-webpack-plugin": "^5.3.9",
4646
"webpack": "^5.88.2",

0 commit comments

Comments
 (0)