mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-28 19:06:19 -05:00
Removing FileGroup.full_stem in favor of primary_path. This is to handle when two unrelated files share a name ('some text.txt' and 'some text.jpg').
This commit is contained in:
parent
e557b0157e
commit
18273286dc
12 changed files with 120 additions and 77 deletions
|
|
@ -486,7 +486,7 @@ def test_refresh_archives(test_session, test_directory, test_client, make_files_
|
|||
|
||||
# Cause a re-index of the archive.
|
||||
test_session.query(FileGroup).filter_by(
|
||||
full_stem=str(test_directory / 'archive/example.com/2021-10-05-16-20-10_NA')).one().indexed = False
|
||||
primary_path=str(test_directory / 'archive/example.com/2021-10-05-16-20-10_NA.html')).one().indexed = False
|
||||
test_session.commit()
|
||||
|
||||
# Running the refresh does not result in a new archive.
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ def find_orphaned_video_files(directory: pathlib.Path) -> Generator[pathlib.Path
|
|||
FROM file_group
|
||||
WHERE
|
||||
mimetype NOT LIKE 'video%'
|
||||
AND full_stem LIKE '{directory}/%'
|
||||
AND primary_path LIKE '{directory}/%'
|
||||
''')
|
||||
results = (pathlib.Path(j['path']) for i in curs.fetchall() for j in i[0])
|
||||
yield from results
|
||||
|
|
|
|||
|
|
@ -73,10 +73,9 @@ def test_refresh_videos(test_client, test_session, test_directory, simple_channe
|
|||
# Create a bogus video in the channel.
|
||||
video_file = test_directory / 'foo.mp4'
|
||||
with get_db_curs(commit=True) as curs:
|
||||
full_stem, _ = split_path_stem_and_suffix(video_file, full=True)
|
||||
stmt = "INSERT INTO file_group (mimetype, full_stem, primary_path, indexed, files, model)" \
|
||||
" values ('video/mp4', %(full_stem)s, %(primary_path)s, true, %(files)s, 'video') RETURNING id"
|
||||
params = {'full_stem': full_stem, 'primary_path': str(video_file), 'files': list()}
|
||||
stmt = "INSERT INTO file_group (mimetype, primary_path, indexed, files, model)" \
|
||||
" values ('video/mp4', %(primary_path)s, true, %(files)s, 'video') RETURNING id"
|
||||
params = {'primary_path': str(video_file), 'files': list()}
|
||||
curs.execute(stmt, params)
|
||||
video4_id = curs.fetchall()[0][0]
|
||||
stmt = "INSERT INTO video (file_group_id) values (%(video_id)s)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue