Compare commits

...

2 Commits

Author SHA1 Message Date
towards-a-new-leftypol 2b1940b401 Update Common 2024-03-18 17:44:25 -04:00
towards-a-new-leftypol 3c3fec27b3 Add attachment index 2024-03-18 09:26:49 -04:00
3 changed files with 16 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@
todo
dist-newstyle/
paths.txt
temp_paths.txt
temp_backfill_settings.json

View File

@ -244,8 +244,8 @@ setPostIdInPosts tuples ids = map f ids
(\(a, b, c, i, j) -> (a, b, c, i, j { Posts.post_id = Just asdf1 })) (post_map Map.! (asdf2, asdf3))
fileToAttachment :: Posts.Post -> JS.File -> At.Attachment
fileToAttachment post file =
fileToAttachment :: Int -> Posts.Post -> JS.File -> At.Attachment
fileToAttachment i post file =
At.Attachment
{ At.mimetype = maybe guessed_mime id (JS.mime file)
, At.creation_time = Posts.creation_time post
@ -260,6 +260,7 @@ fileToAttachment post file =
, At.file_size_bytes = JS.fsize file
, At.board_filename = JS.id file
, At.spoiler = maybe False id $ JS.spoiler file
, At.attachment_idx = i
}
where
@ -460,6 +461,7 @@ processFiles settings tuples = do -- perfect just means that our posts have ids,
, At.file_size_bytes = size
, At.board_filename = tim
, At.spoiler = spoiler > 0
, At.attachment_idx = 1
}
return (p, attachment)
@ -477,14 +479,16 @@ processFiles settings tuples = do -- perfect just means that our posts have ids,
-> [(Sites.Site, Boards.Board, Threads.Thread, Posts.Post, At.Paths, At.Attachment)]
parseAttachments (site, board, thread, p, q) = filter notDeleted $
case JSONPosts.files p of
Just files -> map (\x ->
( site
, board
, thread
, q
, At.Paths (withPathPrefix $ JS.file_path x) (withPathPrefix $ JS.thumb_path x)
, fileToAttachment q x)
) files
Just files -> map
(\(i, x) ->
( site
, board
, thread
, q
, At.Paths (withPathPrefix $ JS.file_path x) (withPathPrefix $ JS.thumb_path x)
, fileToAttachment i q x
)
) (zip [1..] files)
Nothing ->
case parseLegacyPaths p of
Nothing -> []

@ -1 +1 @@
Subproject commit 1264424bd541649a2f163542a93203235e996ac3
Subproject commit 1b08b3ac079c6032e1090e79a8074d4cfd9ef24f