fix: fix rar books with potential issues

fix the media type generated prior to tika 1.24
this prevented extension repair and cbz conversion
fix rar files that could have been incorrectly analyzed prior to 0.91.3
This commit is contained in:
Gauthier Roebroeck 2021-05-17 15:25:12 +08:00
parent 740fa6583a
commit 8befde0ea8

View File

@ -0,0 +1,18 @@
-- fix media type for files analyzed with tika 1.23 or before which didn't get the rar version
update MEDIA
set MEDIA_TYPE = 'application/x-rar-compressed; version=4'
where MEDIA_TYPE = 'application/x-rar-compressed'
and STATUS = 'READY';
-- rar files that could have had an incorrect analysis are marked at OUTDATED to be ra-analyzed
update MEDIA
set STATUS = 'OUTDATED'
where BOOK_ID in (
select F.BOOK_ID
from MEDIA_FILE F
left join MEDIA M on F.BOOK_ID = M.BOOK_ID
where F.FILE_NAME like '%.%'
and M.MEDIA_TYPE like 'application/x-rar-compressed%'
and lower(replace(F.FILE_NAME, rtrim(F.FILE_NAME, replace(F.FILE_NAME, '.', '')), ''))
in ('jpg', 'jpeg', 'webp', 'tiff', 'tif', 'gif', 'png', 'bmp')
);