Skip to content

Commit

Permalink
chore: Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenhilton committed Sep 23, 2023
1 parent 6d05fae commit c35cdea
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# yt-dlp-FixupMtime

A [yt-dlp](https://github.com/yt-dlp/yt-dlp) postprocessor [plugin](https://github.com/yt-dlp/yt-dlp#plugins) which sets the mtime of all files to a given datetime value by key.
A [yt-dlp](https://github.com/yt-dlp/yt-dlp) postprocessor [plugin](https://github.com/yt-dlp/yt-dlp#plugins) that sets the mtime of all files to a given datetime value by key.

This postprocessor does not support all possible files output by yt-dlp, namely `*.dump` files.
Some file types (namely `*.dump` files) that can be optionally output by yt-dlp when downloading are not supported.

NOTE: This postprocessor should not be run before files are downloaded.
NOTE: This postprocessor should not be run before files are downloaded. The default `when` value of `post_process` is recommended.

## Installation

Expand All @@ -21,14 +21,16 @@ See [installing yt-dlp plugins](https://github.com/yt-dlp/yt-dlp#installing-plug
## Usage

```text
--use-postprocessor FixupMtime[:;[mtime_key=<key>][mtime_format=<format>]]
--use-postprocessor FixupMtime[:[mtime_key=<key>];[mtime_format=<format>]]
```

Where `<key>` is the key of your desired datetime within the infojson dictionary and `<format>` is the format of the datetime.
Where `<key>` is the key of your desired datetime within the infojson dictionary and `<format>` is the [format](https://docs.python.org/3.7/library/datetime.html#strftime-and-strptime-behavior) of the datetime.

The default value for `mtime_key` is `mtime`, which will set the mtime of all files (thumbnails, subtitles etc.) to the existing mtime of the video. If `mtime_key` is `mtime` and `--mtime` was passed to yt-dlp at the time of download, the value will be the datetime of the last-modified header.
The default value for the `mtime_key` parameter is `mtime`, which will set the mtime of all files (thumbnails, subtitles etc.) to the existing mtime of the video. If `mtime_key`'s value is `mtime` and the `--mtime` option was passed to yt-dlp at the time of download, the value will be the datetime of the last-modified header.

The default value for `mtime_format` is `%Y%m%d`. The postprocessor will also attempt to guess the format with yt-dlp's internal list of formats.
The default value for the `mtime_format` parameter is `%Y%m%d`. The postprocessor will also attempt to guess the format with yt-dlp's internal list of formats.

Both parameters are optional and can be specified in any order.

## Examples

Expand All @@ -49,3 +51,12 @@ Set the mtime of all files using a custom datetime and format:
```text
--use-postprocessor FixupMtime:mtime_key=meta_date;mtime_format=%Y-%m-%dT%H.%M.%S
```

You can combine multiple invocations, ordered from least to most preferred:

```text
--use-postprocessor FixupMtime:mtime_key=upload_date
--use-postprocessor FixupMtime:mtime_key=release_date
--use-postprocessor FixupMtime:mtime_key=timestamp
--use-postprocessor FixupMtime:mtime_key=release_timestamp
```

0 comments on commit c35cdea

Please sign in to comment.