| author | |
| committer | |
| log | 5fde9a0d10e1f190f9994c0f3673777365c27902 |
| tree | f22400b7dde1c780e6945c5ad9897bb8fb0c39b6 |
| parent | f171c7f1cd5249ccd190aa99587fe7c3cbb4f209 |
| signature | Commit is signed but in an unrecognized format. |
projects like waterfalls and in the summer now do not show file mtimes,
except for on the project itself. this also fixes a bug regarding
deleting folders.7 files changed, 48 insertions(+), 10 deletions(-)
src/file-viewer/bin/scan3.ts+25-4| ... | ... | @@ -123,6 +123,8 @@ export async function main() { |
| 123 | 123 | dimensions: mediaFile?.dimensions ?? "", |
| 124 | 124 | contents: mediaFile?.contents ?? "", |
| 125 | 125 | }); |
| 126 | const parent = mediaFile.getParent(); | |
| 127 | if (parent) parent.setProcessed(0); | |
| 126 | 128 | |
| 127 | 129 | node.text = `${label}`; |
| 128 | 130 | await queueProcessors({ |
| ... | ... | @@ -263,7 +265,12 @@ export async function main() { |
| 263 | 265 | } |
| 264 | 266 | } |
| 265 | 267 | } |
| 266 | if (node.estimate > 0) errorHandler.move(); | |
| 268 | if (node.estimate > 0) { | |
| 269 | errorHandler.move(); | |
| 270 | ||
| 271 | const parent = mediaFile.getParent(); | |
| 272 | if (parent) parent.setProcessed(0); | |
| 273 | } | |
| 267 | 274 | } |
| 268 | 275 | |
| 269 | 276 | // Add the root & recursively iterate! |
| ... | ... | @@ -322,6 +329,19 @@ export async function main() { |
| 322 | 329 | } |
| 323 | 330 | } |
| 324 | 331 | |
| 332 | // Project Date | |
| 333 | const dateFile = children.find((x) => x.basename === ".date"); | |
| 334 | if (dateFile) { | |
| 335 | const date = new Date(dateFile.contents); | |
| 336 | newestDate = date; | |
| 337 | dir.setProcessors( | |
| 338 | 0, | |
| 339 | JSON.stringify({ hideChildrenDates: true }), | |
| 340 | ); | |
| 341 | } else { | |
| 342 | dir.setProcessors(0, ""); | |
| 343 | } | |
| 344 | ||
| 325 | 345 | const dirHash = crypto |
| 326 | 346 | .createHash("sha1") |
| 327 | 347 | .update(dir.path + allHashes) |
| ... | ... | @@ -846,12 +866,13 @@ function skipBasename(basename: string): boolean { |
| 846 | 866 | // dot files must be incrementally tracked |
| 847 | 867 | if (basename === ".dirsort") return false; |
| 848 | 868 | if (basename === ".friends") return false; |
| 869 | if (basename === ".date") return false; | |
| 849 | 870 | |
| 850 | 871 | return ( |
| 851 | 872 | basename.startsWith(".") || |
| 852 | basename.startsWith("._") || | |
| 853 | basename.startsWith(".tmp") || | |
| 854 | basename === ".DS_Store" || | |
| 873 | // basename.startsWith("._") || | |
| 874 | // basename.startsWith(".tmp") || | |
| 875 | // basename === ".DS_Store" || | |
| 855 | 876 | basename.toLowerCase() === "thumbs.db" || |
| 856 | 877 | basename.toLowerCase() === "desktop.ini" |
| 857 | 878 | ); |
src/file-viewer/models/MediaFile.ts+1-1| ... | ... | @@ -440,7 +440,7 @@ const deleteCascadeQuery = db.prepare<[{ id: number }]>(/* SQL */ ` |
| 440 | 440 | ) |
| 441 | 441 | ) |
| 442 | 442 | delete from media_files |
| 443 | where id in (select id from items) | |
| 443 | where id in (select id from items order by parent_id nulls last) | |
| 444 | 444 | `); |
| 445 | 445 | const getDirectoriesToReindexQuery = db.prepare(` |
| 446 | 446 | with recursive directory_chain as ( |
src/file-viewer/rsync.ts+1-1| ... | ... | @@ -25,7 +25,7 @@ export interface SpawnOptions { |
| 25 | 25 | args: string[]; |
| 26 | 26 | rsync?: string; |
| 27 | 27 | progress: progress.Node; |
| 28 | cwd: string; | |
| 28 | cwd?: string; | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | export async function spawn(options: SpawnOptions) { |
src/file-viewer/rules.ts+1-1| ... | ... | @@ -73,7 +73,7 @@ export const extsDuration = new Set([...extsAudio, ...extsVideo]); |
| 73 | 73 | export const extsDimensions = new Set([...extsImage, ...extsVideo, ".gif"]); |
| 74 | 74 | |
| 75 | 75 | /** These files read file contents into `contents`, as-is */ |
| 76 | export const extsReadContents = new Set([".txt", ".chat", ".dirsort"]); | |
| 76 | export const extsReadContents = new Set([".txt", ".chat", ".dirsort", ".date"]); | |
| 77 | 77 | |
| 78 | 78 | export const extsArchive = new Set([ |
| 79 | 79 | ".zip", |
src/file-viewer/transcode-rules.ts+2-1| ... | ... | @@ -98,7 +98,8 @@ export const imagePresets = [ |
| 98 | 98 | ]; |
| 99 | 99 | |
| 100 | 100 | export async function getVideoInputArgs(path: Path): Promise<InputArgs> { |
| 101 | const config = await path.replaceExt(".json").readIfExists<any>("json"); | |
| 101 | const config = await path.parent!.join("." + path.replaceExt(".json").base) | |
| 102 | .readIfExists<any>("json"); | |
| 102 | 103 | if (config) { |
| 103 | 104 | if (config.encoder && typeof config.encoder.videoSrc === "string") { |
| 104 | 105 | const { videoSrc, audioSrc, rate } = config.encoder; |
src/file-viewer/views/clofi.css+3| ... | ... | @@ -695,6 +695,9 @@ h3 { |
| 695 | 695 | text-decoration: underline; |
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | .nodate { | |
| 699 | padding-left: 0.5rem; | |
| 700 | } | |
| 698 | 701 | |
| 699 | 702 | /* MOBILE */ |
| 700 | 703 | @media (max-width: 1000px) { |
src/file-viewer/views/clofi.tsx+15-2| ... | ... | @@ -330,6 +330,10 @@ const sortOverrides: Record<string, (a: MediaFile, b: MediaFile) => number> = { |
| 330 | 330 | "/2017": sortChronologicalStartToEnd, |
| 331 | 331 | }; |
| 332 | 332 | |
| 333 | interface DirConfig { | |
| 334 | hideChildrenDates?: boolean; | |
| 335 | } | |
| 336 | ||
| 333 | 337 | function DirView({ |
| 334 | 338 | dir, |
| 335 | 339 | activeFilename, |
| ... | ... | @@ -363,12 +367,21 @@ function DirView({ |
| 363 | 367 | const sortedFiles = unsortedFiles.sort(sorter); |
| 364 | 368 | const readme = sortedFiles.find((f) => f.basename === readmeFile); |
| 365 | 369 | if (readme && isLast) activeFilename ||= readmeFile; |
| 370 | ||
| 371 | const extraConfig: DirConfig = dir.processors | |
| 372 | ? JSON.parse(dir.processors) | |
| 373 | : {}; | |
| 374 | ||
| 366 | 375 | const main = ( |
| 367 | 376 | <div class="content primary"> |
| 368 | 377 | <ul> |
| 369 | 378 | {sortedFiles.map((file) => { |
| 370 | 379 | return ( |
| 371 | <ListItem file={file} active={activeFilename === file.basename} /> | |
| 380 | <ListItem | |
| 381 | file={file} | |
| 382 | active={activeFilename === file.basename} | |
| 383 | noDate={extraConfig.hideChildrenDates ?? false} | |
| 384 | /> | |
| 372 | 385 | ); |
| 373 | 386 | })} |
| 374 | 387 | </ul> |
| ... | ... | @@ -434,7 +447,7 @@ function ListItem({ |
| 434 | 447 | <li> |
| 435 | 448 | <a |
| 436 | 449 | class={(active ? "active " : "") + (isReadme ? "readme " : "") + |
| 437 | "li custom"} | |
| 450 | "li custom" + (noDate ? " nodate" : "")} | |
| 438 | 451 | href={file.extension === ".lnk" |
| 439 | 452 | ? file.contents |
| 440 | 453 | : isReadme |