Kethsar / ytarchive

Garbage Youtube livestream downloader
MIT License
1.08k stars 87 forks source link

Resume state issue when using --no-audio (1 line fix). #201

Closed keredau closed 1 month ago

keredau commented 1 month ago

I have found a problem when resuming a save-state download whilst also using the --no-audio switch.

Reproduction:

# ytarchive --save-state --no-save --no-audio https://www.youtube.com/watch?v=IhWWW2l-pP0 best
ytarchive 0.4.0
2024/07/14 20:17:53 Channel: WebcamSydney
2024/07/14 20:17:53 Video Title: Live webcam view of Sydney Harbour 24/7
2024/07/14 20:17:55 Selected quality: 2160p (VP9)
2024/07/14 20:17:55 Stream started at time 2024-05-05T04:59:15+00:00
2024/07/14 20:17:55 WARNING: video: Failed to open D:\IhWWW2l-pP0__651597202\Live webcam view of Sydney Harbour 24_7-IhWWW2l-pP0.f313.ts to resume download: open D:\IhWWW2l-pP0__651597202\Live webcam view of Sydney Harbour 24_7-IhWWW2l-pP0.f313.ts: The system cannot find the file specified.
2024/07/14 20:17:55 WARNING: video: Will truncate and start from the beginning
2024/07/14 20:17:55 WARNING: video: YT only retains the livestream 5 days past for seeking, starting from sequence 1054557 (latest is 1140957)
Video Fragments: 9; Audio Fragments: 0; Total Downloaded: 28.62MiB 

Issue: The script truncates a working video file because it thinks its an audio file.

Fix: I believe the fix is simple and the result of a copy-paste issue in the main.go file on line 734: https://github.com/Kethsar/ytarchive/blob/3c425e5e3de24701460c5faf9d72ad524bdb78e0/main.go#L734 Line 734 mistakenly references the AudioItag variable instead of info.Quality.