faissaloo / SponSkrub

Strip advertisements from downloaded YouTube videos
GNU General Public License v3.0
178 stars 7 forks source link

Do not touch/Retouch Date Modifieds timestamp after sponskrub "marking the shilling" #25

Closed barkoder closed 3 years ago

barkoder commented 3 years ago

This issue is a copy of one I reported here - https://github.com/yt-dlp/yt-dlp/issues/124
I was asked to open an issue here as well.

Checklist

Verbose log

$ yt-dlp -v https://www.youtube.com/watch?v=Qtml7imdBsU -f 251
[debug] User config: ['--no-cache-dir', '--geo-bypass', '--no-call-home']
[debug] Command-line config: ['-v', 'https://www.youtube.com/watch?v=Qtml7imdBsU', '-f', '251']
[debug] Loading archive file None
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] yt-dlp version 2021.03.01 (zip)
[debug] Python version 3.6.1 (CPython 64bit) - CYGWIN_NT-6.1-2.8.0-0.309-5-3-x86_64-64bit-WindowsPE
[debug] exe versions: ffmpeg 4.3.2-2021-02-20-essentials_build-www.gyan.dev, ffprobe 4.3.2-2021-02-20-essentials_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] Qtml7imdBsU: Downloading webpage
[debug] Sort order given by user:
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[info] Downloading format(s) 251
[download] ASMR Antique Haul (Books, Bottles & Trinkets ) [Qtml7imdBsU].webm has already been downloaded
[SponSkrub] Trying to mark sponsor sections
[debug] sponskrub command line: sponskrub -chapter -- Qtml7imdBsU 'ASMR Antique Haul (Books, Bottles & Trinkets ) [Qtml7imdBsU].webm' 'ASMR Antique Haul (Books, Bottles & Trinkets ) [Qtml7imdBsU].spons.webm'
size=   27396kB time=00:28:10.66 bitrate= 132.7kbits/s speed=4.9e+03x
Downloading video sponsor data
Marking the shilling...
Done!
[SponSkrub] Sponsor sections have been marked

Description

I don't know if I should open this in sponskrub or here.

Steps to reproduce:

1. Run $ yt-dlp --no-sponskrub https://www.youtube.com/watch?v=Qtml7imdBsU -f 251

2. Check timestamps of the downloaded file and remember it.

3. Then Run $ yt-dlp https://www.youtube.com/watch?v=Qtml7imdBsU -f 251

4. Marking the shilling..

5. Check timetamps of the same file after sponskrub has "marked the shilling..."

6. File's timestamps are now set to current system time.

Behavior: Date modified for the file is touched to current system time after marking sponsor sections using sponskrub.

Expected behavior: Date modifed and other file timestamps should be re-touched to whatever it was originally pre-sponskrub.

Other notes/Possible solutions? idk 🤷 - youtube-dl --add-metadata

or

yt-dlp --no-sponskrub --add-metadata

is able to add metadata without changing the data modifieds of the original file. Might want to look at the code that does that.

Thank you :)

faissaloo commented 3 years ago

Nice spot, lemme scribble down some stuff for when I go to implement this.

Lets put this as an optional flag we should probably figure out what options people are using and how often to decide more sensible defaults longer term but probably not enough users for that just yet
https://dlang.org/phobos/std_file.html#setTimes
https://dlang.org/phobos/std_file.html#getTimes
faissaloo commented 3 years ago

This should now be fixed as of 3.7.0