Fix ISO 8601 timestamp conversion in preview generation#137
Open
tommasongr wants to merge 1 commit intoBenexl:masterfrom
Open
Fix ISO 8601 timestamp conversion in preview generation#137tommasongr wants to merge 1 commit intoBenexl:masterfrom
tommasongr wants to merge 1 commit intoBenexl:masterfrom
Conversation
Replace timestamp extraction with ISO 8601 format conversion for better compatibility across platforms.
|
If it helps, this works flawlessly. I just tested it because I was having the same issue. Thanks for solving it. |
Owner
|
it doesnt work on linux, in the else statement leave the value of timestamp as it originally was |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi everyone 👋
This PR solves an issue I was having with preview generation on macOS. Apparently the preview was failing due to some timestamp format mismatch between the YouTube API and the expected value on macOS.
To be fully transparent, the solution was one-shotted by Mistral AI. Looking at the resulted code I don't see obvious compatibility issues but I tested it on macOS only. Maybe someone should give it a try on other platforms before merging.
Here a rundown of the problem and solution.
Problem
The script fails to generate previews with the error:
This occurs because YouTube API returns timestamps in ISO 8601 format (e.g., "2024-09-15T12:34:56Z"), but the script tries to perform arithmetic directly on these string values.
Solution
Added cross-platform timestamp conversion that:
date -j -f "%Y-%m-%dT%H:%M:%SZ" "timestamp" +%s. Linux/Other:date --date="timestamp" +%s