Update Google Pixel video/photo modification dates based on their filenames
Project description
Name to Date
A Python utility to update video and image file modification dates based on their filenames. This is particularly useful for Google Pixel phone media files, which have filenames like PXL_20240813_051351918.mp4 or PXL_20240815_174155846.NIGHT.jpg containing the date and time when the media was recorded.
Features
- Extracts date and time information from filenames in various formats (see Supported Filename Formats section)
- Updates the "Date Modified" attribute of media files to match the extracted datetime
- The datetime in filenames is assumed to be in UTC and it is for Google Pixel phones.
- Handles multiple file formats (
mp4,mov,avi,mkv,jpg)
Installation
Prerequisites
- Python 3.6 or higher
Installation from PyPI
pip install name2date
Installation from Source
- Clone this repository or download the source files
- Navigate to the project directory
- Install the package
pip install .
Usage
Basic Usage
After installation, you can use the command-line tool:
name2date /path/to/media
Alternatively, you can run the package as a module:
python -m name2date /path/to/media
This will process all supported media files (video and image) in the specified directory, extracting date and time from filenames and updating the "Date Modified" attribute. By default, the datetime is interpreted as UTC.
Verbose Output
The tool supports two levels of verbosity:
name2date /path/to/media -v
This will print information only about skipped files (files that don't match the expected patterns).
name2date /path/to/media -vv
This will print detailed information about all files being processed, including which files are being processed and updated.
Supported Filename Formats
The script is designed to work with various Google Pixel media filenames, which follow these patterns:
PXL Format (with variations)
PXL_YYYYMMDD_HHMMSSXXX.mp4PXL_YYYYMMDD_HHMMSSXXX.NIGHT.jpgPXL_YYYYMMDD_HHMMSSXXX.MP.jpgPXL_YYYYMMDD_HHMMSSXXX.MP(N).jpg(where N is a number)PXL_YYYYMMDD_HHMMSSXXX(N).jpg(where N is a number)PXL_YYYYMMDD_HHMMSSXXX.RESTORED.jpgPXL_YYYYMMDD_HHMMSSXXX_exported_0_TIMESTAMP.jpg
Where:
YYYY: 4-digit yearMM: 2-digit month (01-12)DD: 2-digit day (01-31)HH: 2-digit hour in 24-hour format (00-23)MM: 2-digit minute (00-59)SS: 2-digit second (00-59)XXX: 3-digit millisecond (000-999)
LV Format
lv_0_YYYYMMDDHHMMSS.mp4
Where:
YYYY: 4-digit yearMM: 2-digit month (01-12)DD: 2-digit day (01-31)HH: 2-digit hour in 24-hour format (00-23)MM: 2-digit minute (00-59)SS: 2-digit second (00-59)
Examples of supported filenames:
PXL_20240813_051351918.mp4PXL_20240815_174155846.NIGHT.jpgPXL_20240815_190034025.MP.jpgPXL_20240815_190407130(1).jpgPXL_20240815_190849820.RESTORED.jpgPXL_20240811_084139455_exported_0_1723365759303.jpglv_0_20240813134545.mp4
Example
name2date -vv ~/Movies/gphoto
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file name2date-0.1.0.tar.gz.
File metadata
- Download URL: name2date-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bb20b10217952e991f9452beb677816cb74750861b379ea0b2ca20c7f80a2dd
|
|
| MD5 |
aed8e799830d3c4acad3c9a5bbdbeca2
|
|
| BLAKE2b-256 |
b7e9a06fbb3b9af81d2efa51bc3e3669c444979dfc7a5337da0a2ab89abb7e4e
|
Provenance
The following attestation bundles were made for name2date-0.1.0.tar.gz:
Publisher:
python-publish.yml on kochaika/name2date
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
name2date-0.1.0.tar.gz -
Subject digest:
5bb20b10217952e991f9452beb677816cb74750861b379ea0b2ca20c7f80a2dd - Sigstore transparency entry: 232204966
- Sigstore integration time:
-
Permalink:
kochaika/name2date@def54d6ec48acc6f7201cf9979acae41cba2d4f9 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/kochaika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@def54d6ec48acc6f7201cf9979acae41cba2d4f9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file name2date-0.1.0-py3-none-any.whl.
File metadata
- Download URL: name2date-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50157e143d3ac184c3885057152df7d2636e57aff28bd307c3bde2032f7f8958
|
|
| MD5 |
b36756a0094835f58c6cf39fb19807c5
|
|
| BLAKE2b-256 |
fc2b8bbc5bae22eb645885c8003b76fac9500db4e8d88f2cae7a92e3d7064611
|
Provenance
The following attestation bundles were made for name2date-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on kochaika/name2date
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
name2date-0.1.0-py3-none-any.whl -
Subject digest:
50157e143d3ac184c3885057152df7d2636e57aff28bd307c3bde2032f7f8958 - Sigstore transparency entry: 232204967
- Sigstore integration time:
-
Permalink:
kochaika/name2date@def54d6ec48acc6f7201cf9979acae41cba2d4f9 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/kochaika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@def54d6ec48acc6f7201cf9979acae41cba2d4f9 -
Trigger Event:
release
-
Statement type: