-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transcript): fix not respond to local subtitle deletion
- Loading branch information
Showing
19 changed files
with
344 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export interface FileInfo { | ||
extension: string; | ||
basename: string; | ||
path: string; | ||
} | ||
|
||
export function toFileInfo( | ||
filepath: string, | ||
sep = "/", | ||
): FileInfo & { name: string; parent: string } { | ||
const filename = filepath.split(sep).pop()!; | ||
const extension = filename.split(".").pop()!; | ||
const info = { | ||
name: filename, | ||
path: filepath, | ||
parent: filepath.slice(0, -filename.length - 1), | ||
}; | ||
if (extension === filename) { | ||
return { | ||
extension: "", | ||
basename: filename, | ||
...info, | ||
}; | ||
} | ||
return { | ||
extension, | ||
basename: filename.slice(0, -extension.length - 1), | ||
...info, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
import type { CachedMetadata, MetadataCache } from "obsidian"; | ||
import type { TextTrackInfo } from "@/info/track-info"; | ||
import type { CachedMetadata } from "obsidian"; | ||
import type { MetaTextTrackInfo } from "@/transcript/handle/meta"; | ||
import { parseTextTrackFields } from "@/transcript/handle/meta"; | ||
|
||
export interface MediaNoteMeta { | ||
textTracks: TextTrackInfo[]; | ||
textTracks: MetaTextTrackInfo[]; | ||
} | ||
|
||
export function parseMediaNoteMeta( | ||
meta: CachedMetadata, | ||
{ | ||
metadataCache, | ||
sourcePath, | ||
}: { metadataCache: MetadataCache; sourcePath: string }, | ||
): MediaNoteMeta { | ||
export function parseMediaNoteMeta(meta: CachedMetadata): MediaNoteMeta { | ||
return { | ||
textTracks: parseTextTrackFields(meta, (linkpath) => | ||
metadataCache.getFirstLinkpathDest(linkpath, sourcePath), | ||
), | ||
textTracks: parseTextTrackFields(meta), | ||
}; | ||
} |
Oops, something went wrong.