-
Notifications
You must be signed in to change notification settings - Fork 0
feat: support video tweets #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DTrombett
wants to merge
47
commits into
main
Choose a base branch
from
feat/tweetVideo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
b983da8
refactor: use ask
DTrombett 64d7fcb
feat: implement video overlay
DTrombett c483b43
fix: support smaller res
DTrombett 4c065cf
fix: better handle max bitrate
DTrombett 2e331fc
feat: add image resolution
DTrombett 4b4359f
fix: change default resolution
DTrombett f5d1e63
refactor: reorder options
DTrombett 4351c62
fix: correct replies regex
DTrombett d470a58
fix: account for missing duration
DTrombett 6695271
refactor: ask before
DTrombett 45ba771
feat: change format based on bitrate
DTrombett c7abf04
refactor: remove threads
DTrombett 1ae991b
feat: add preset choice
DTrombett f591286
feat: add more ffmpeg options
DTrombett 8452998
Merge branch 'main' into feat/tweetVideo
DTrombett be4eea9
feat: add -g option
DTrombett a4dad42
Merge branch 'feat/tweetVideo' of https://github.com/DTrombett/useful…
DTrombett 7d78515
feat: add original preset
DTrombett 74726bf
refactor: start working on tests
DTrombett 03e05eb
feat: inspect rawvideo instead
DTrombett 18e431a
feat: continue working on tests
DTrombett 975ab7d
feat: add tests
DTrombett 6ab7feb
feat: remove follow button
DTrombett 86581de
feat: add more tests
DTrombett 0ed91eb
feat: add shared browser
DTrombett 883d9e0
ci: add playwright and ffmpeg
DTrombett 0d03095
fix: use latest release
DTrombett 4ea3f41
feat: add artifacts
DTrombett 38835d6
ci: resolve failed screenshot path
DTrombett e33c677
ci: actually upload failed files
DTrombett 441cffa
ci: try with another directory
DTrombett 7c24af9
ci: idk try this
DTrombett d929669
ci: i'm completely lost
DTrombett e1e67b1
fix: ts error
DTrombett 67682ff
ci: try with cwd
DTrombett 1c4ca83
fix: use correct rootDirectory
DTrombett ffa857a
ci: remove @actions/artifact
DTrombett 65c6069
ci: run on failure
DTrombett 65f1d5c
ci: try on windows
DTrombett 3cd1d0b
ci: run on all systems
DTrombett a19e21e
ci: change ffmpeg provider
DTrombett ae75ef9
ci: fix artifact name
DTrombett 3fdfa85
test: update macos screenshots
DTrombett ce37133
test: check if it actually fails
DTrombett 4e459dd
ci: let's go! add back correct one
DTrombett e09a878
feat: adapt stockHeatmap too
DTrombett 689d66a
test: mark flaky test as todo
DTrombett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,10 +1,12 @@ | ||
| import { once } from "node:events"; | ||
| import { stdin, stdout } from "node:process"; | ||
|
|
||
| export const ask = async (question: string) => { | ||
| export const ask = async (question: string): Promise<string> => { | ||
| stdin.resume(); | ||
| stdin.setRawMode(false); | ||
| stdout.write(question); | ||
| const [answer] = await once(stdin, "data"); | ||
| stdin.setRawMode(true); | ||
| stdin.pause(); | ||
| return answer.toString().trim(); | ||
| }; |
This file contains hidden or 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,9 @@ | ||
| import type { Locator } from "playwright"; | ||
|
|
||
| /** | ||
| * Removes an element from the DOM. | ||
| * @param element - The element to remove | ||
| * @param timeout - Optional timeout in milliseconds | ||
| */ | ||
| export const removeElement = (element: Locator, timeout?: number) => | ||
| element.evaluate(el => el.remove(), null, { timeout }); |
This file contains hidden or 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,47 @@ | ||
| const baseSizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; | ||
| const searchSizes = ["BYTES", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; | ||
| const bytesRegex = /^(\d*(?:\.\d+)?)\s*([a-zA-Z]+)?$/u; | ||
|
|
||
| /** | ||
| * Formats a number of bytes into a human-readable string. | ||
| * @param bytes The number of bytes to format | ||
| * @param param1 Additional options for formatting | ||
| * @returns A string representing the formatted size | ||
| */ | ||
| export const formatBytes = ( | ||
| bytes: number, | ||
| { | ||
| fractionDigits = 1, | ||
| sizes = baseSizes, | ||
| k = 1_000, | ||
| }: Partial<{ fractionDigits: number; sizes: string[]; k: number }> = {} | ||
| ): string => { | ||
| if (!bytes) return "0 Bytes"; | ||
| const i = Math.floor(Math.log(bytes) / Math.log(k)); | ||
|
|
||
| return `${(bytes / k ** i).toFixed(fractionDigits)}${sizes[i]}`; | ||
| }; | ||
|
|
||
| /** | ||
| * Parses a human-readable size string into bytes. | ||
| * @param sizeStr The size string to parse | ||
| * @param param1 Additional options for parsing | ||
| * @returns The size in bytes | ||
| */ | ||
| export const parseHumanReadableSize = ( | ||
| sizeStr: string, | ||
| { | ||
| sizes = searchSizes, | ||
| k = 1_000, | ||
| }: Partial<{ sizes: string[]; k: number }> = {} | ||
| ): number => { | ||
| const match = bytesRegex.exec(sizeStr); | ||
|
|
||
| if (!match) throw new Error("Invalid size format"); | ||
| const [, value, unit] = match; | ||
| const numericValue = parseFloat(value!); | ||
| const index = sizes.indexOf(unit?.toUpperCase() || "BYTES"); | ||
|
|
||
| if (index === -1) throw new Error(`Unknown unit: ${unit}`); | ||
| return numericValue * k ** index; | ||
| }; |
This file contains hidden or 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,11 @@ | ||
| import type { Locator } from "playwright"; | ||
| import { removeElement } from "./removeElement.ts"; | ||
|
|
||
| /** | ||
| * Watch an element and remove it if it appears. | ||
| * @param element Locator to watch | ||
| */ | ||
| export const watchElement = async (element: Locator) => { | ||
| element = element.first(); | ||
| while (true) await removeElement(element, 0).catch(() => {}); | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.