Skip to content

Commit b24afed

Browse files
committed
unardel: flatten wrapper archive folder
1 parent 8afa80e commit b24afed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+633
-566
lines changed

library/createdb/av.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
from library.createdb import subtitle
44
from library.mediafiles import media_check
5-
from library.utils import consts, date_utils, file_utils, iterables, nums, objects, path_utils, processes, strings
5+
from library.utils import (
6+
consts,
7+
date_utils,
8+
file_utils,
9+
iterables,
10+
nums,
11+
objects,
12+
path_utils,
13+
processes,
14+
shell_utils,
15+
strings,
16+
)
617
from library.utils.consts import DBType
718
from library.utils.log_utils import log
819

@@ -148,7 +159,7 @@ def munge_av_tags(args, m) -> dict:
148159
and not path.startswith("http")
149160
and not file_utils.is_file_open(path)
150161
):
151-
file_utils.trash(args, path, detach=False)
162+
shell_utils.trash(args, path, detach=False)
152163
m["time_deleted"] = consts.APPLICATION_START
153164
m["error"] = "Metadata check failed"
154165
return m
@@ -207,7 +218,7 @@ def munge_av_tags(args, m) -> dict:
207218
log.warning(
208219
"Deleting %s corruption %.1f%% exceeded threshold %s", path, corruption * 100, threshold_str
209220
)
210-
file_utils.trash(args, path, detach=False)
221+
shell_utils.trash(args, path, detach=False)
211222
m["time_deleted"] = consts.APPLICATION_START
212223
m["error"] = "Media check failed"
213224

library/createdb/fs_add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
argparse_utils,
1515
consts,
1616
db_utils,
17-
file_utils,
1817
iterables,
1918
objects,
2019
printing,
20+
shell_utils,
2121
)
2222
from library.utils.consts import SC, DBType
2323
from library.utils.log_utils import log
@@ -167,7 +167,7 @@ def find_new_files(args, path) -> list[str]:
167167
exts |= consts.SPEECH_RECOGNITION_EXTENSIONS
168168
exts = tuple(exts)
169169

170-
scanned_set = file_utils.rglob(path, exts or None, args.exclude)[0]
170+
scanned_set = shell_utils.rglob(path, exts or None, args.exclude)[0]
171171

172172
m_columns = db_utils.columns(args, "media")
173173

library/createdb/fs_add_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from library.createdb import av
77
from library.files import sample_hash
88
from library.mediafiles import process_ffmpeg, process_image
9-
from library.utils import consts, file_utils, iterables, nums, objects, processes, strings
9+
from library.utils import consts, file_utils, iterables, nums, objects, processes, shell_utils, strings
1010
from library.utils.consts import DBType
1111
from library.utils.log_utils import log
1212

@@ -110,10 +110,10 @@ def extract_metadata(mp_args, path) -> dict[str, str | int | None] | None:
110110
m["hash"] = sample_hash.sample_hash_file(path)
111111

112112
if getattr(mp_args, "copy", False) and not file_utils.is_file_open(path):
113-
path = m["path"] = file_utils.copy(mp_args, path, mp_args.copy)
113+
path = m["path"] = shell_utils.copy(mp_args, path, mp_args.copy)
114114

115115
if getattr(mp_args, "move", False) and not file_utils.is_file_open(path):
116-
path = m["path"] = file_utils.rel_move(mp_args, path, mp_args.move)
116+
path = m["path"] = shell_utils.rel_move(mp_args, path, mp_args.move)
117117

118118
if getattr(mp_args, "process", False):
119119
if objects.is_profile(mp_args, DBType.audio) and Path(path).suffix not in [".opus", ".mka"]:

library/createdb/gallery_add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from library import usage
55
from library.createdb import gallery_backend
66
from library.mediadb import db_media, db_playlists
7-
from library.utils import arggroups, argparse_utils, consts, db_utils, file_utils
7+
from library.utils import arggroups, argparse_utils, consts, db_utils, shell_utils
88
from library.utils.consts import SC
99
from library.utils.log_utils import log
1010

@@ -38,7 +38,7 @@ def gallery_add(args=None) -> None:
3838
db_playlists.create(args)
3939
db_media.create(args)
4040

41-
paths = file_utils.gen_paths(args)
41+
paths = shell_utils.gen_paths(args)
4242

4343
if args.no_extract:
4444
args.db["media"].insert_all(

library/createdb/site_add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from bs4 import BeautifulSoup, element
66

77
from library import usage
8-
from library.utils import arggroups, argparse_utils, consts, db_utils, file_utils, iterables, objects, strings, web
8+
from library.utils import arggroups, argparse_utils, consts, db_utils, iterables, objects, shell_utils, strings, web
99
from library.utils.log_utils import log
1010

1111

@@ -301,7 +301,7 @@ def site_add(args=None) -> None:
301301

302302
web.load_selenium(args, wire=True)
303303
try:
304-
for url in file_utils.gen_paths(args):
304+
for url in shell_utils.gen_paths(args):
305305
load_page(args, url)
306306
finally:
307307
web.quit_selenium(args)

library/createdb/tabs_add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from library import usage
66
from library.mediadb import db_history, db_media
77
from library.utils import arggroups, argparse_utils, consts, iterables
8-
from library.utils.file_utils import gen_paths
98
from library.utils.log_utils import log
9+
from library.utils.shell_utils import gen_paths
1010

1111

1212
def parse_args() -> argparse.Namespace:

library/createdb/torrents_add.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from library import usage
66
from library.mediadb import db_media, db_playlists
7-
from library.utils import arggroups, argparse_utils, consts, db_utils, file_utils, iterables, nums, objects, printing
8-
from library.utils.file_utils import trash
7+
from library.utils import arggroups, argparse_utils, consts, db_utils, iterables, nums, objects, printing, shell_utils
98
from library.utils.log_utils import log
109
from library.utils.path_utils import tld_from_url
10+
from library.utils.shell_utils import trash
1111

1212

1313
def parse_args():
@@ -122,7 +122,7 @@ def torrents_add():
122122
db_playlists.create(args)
123123
db_media.create(args)
124124

125-
scanned_set = set(file_utils.gen_paths(args, default_exts=(".torrent",)))
125+
scanned_set = set(shell_utils.gen_paths(args, default_exts=(".torrent",)))
126126

127127
known_hashes = set()
128128
try:

library/createdb/tube_add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from library import usage
55
from library.createdb import tube_backend
66
from library.mediadb import db_media, db_playlists
7-
from library.utils import arggroups, argparse_utils, consts, db_utils, file_utils
7+
from library.utils import arggroups, argparse_utils, consts, db_utils, shell_utils
88
from library.utils.consts import SC
99
from library.utils.log_utils import log
1010

@@ -35,7 +35,7 @@ def tube_add(args=None) -> None:
3535
sys.argv = ["tubeadd", *args]
3636

3737
args = parse_args(SC.tube_add, usage=usage.tube_add)
38-
paths = file_utils.gen_paths(args)
38+
paths = shell_utils.gen_paths(args)
3939

4040
db_playlists.create(args)
4141
db_media.create(args)

library/createdb/tube_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
)
1515
from library.mediadb import db_media, db_playlists
1616
from library.mediafiles import media_check
17-
from library.utils import consts, db_utils, file_utils, iterables, objects, path_utils, printing, sql_utils, strings
17+
from library.utils import consts, db_utils, iterables, objects, path_utils, printing, shell_utils, sql_utils, strings
1818
from library.utils.consts import DBType, DLStatus, VideoArchiveError
1919
from library.utils.log_utils import Timer, log
2020
from library.utils.processes import FFProbe
@@ -579,7 +579,7 @@ def blocklist_check(info, *pargs, incomplete):
579579
)
580580
local_path = path_utils.clean_path(local_path.encode())
581581
if Path(temp_path).exists(): # may be download error
582-
file_utils.rename_move_file(temp_path, local_path)
582+
shell_utils.rename_move_file(temp_path, local_path)
583583
# TODO: wtf is this doing...
584584
elif Path(local_path).exists(): # media might already be in download archive
585585
local_path = temp_path

library/createdb/web_add.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
nums,
2121
objects,
2222
printing,
23+
shell_utils,
2324
sql_utils,
2425
strings,
2526
web,
@@ -270,7 +271,7 @@ def web_add(args=None) -> None:
270271
if args.no_extract:
271272
media_new = set()
272273
media_known = set()
273-
for p in file_utils.gen_paths(args):
274+
for p in shell_utils.gen_paths(args):
274275
if db_media.exists(args, p):
275276
media_known.add(p)
276277
else:
@@ -283,9 +284,9 @@ def web_add(args=None) -> None:
283284
web.load_selenium(args)
284285
try:
285286
if args.media:
286-
spider(args, list(file_utils.gen_paths(args)))
287+
spider(args, list(shell_utils.gen_paths(args)))
287288
else:
288-
for playlist_path in file_utils.gen_paths(args):
289+
for playlist_path in shell_utils.gen_paths(args):
289290
args.playlists_id = add_playlist(args, playlist_path)
290291
spider(args, [playlist_path])
291292

0 commit comments

Comments
 (0)