Skip to main content

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

  1. Clone this repository or download the source files
  2. Navigate to the project directory
  3. 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.mp4
  • PXL_YYYYMMDD_HHMMSSXXX.NIGHT.jpg
  • PXL_YYYYMMDD_HHMMSSXXX.MP.jpg
  • PXL_YYYYMMDD_HHMMSSXXX.MP(N).jpg (where N is a number)
  • PXL_YYYYMMDD_HHMMSSXXX(N).jpg (where N is a number)
  • PXL_YYYYMMDD_HHMMSSXXX.RESTORED.jpg
  • PXL_YYYYMMDD_HHMMSSXXX_exported_0_TIMESTAMP.jpg

Where:

  • YYYY: 4-digit year
  • MM: 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 year
  • MM: 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.mp4
  • PXL_20240815_174155846.NIGHT.jpg
  • PXL_20240815_190034025.MP.jpg
  • PXL_20240815_190407130(1).jpg
  • PXL_20240815_190849820.RESTORED.jpg
  • PXL_20240811_084139455_exported_0_1723365759303.jpg
  • lv_0_20240813134545.mp4

Example

name2date -vv ~/Movies/gphoto

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

name2date-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

name2date-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

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

Hashes for name2date-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5bb20b10217952e991f9452beb677816cb74750861b379ea0b2ca20c7f80a2dd
MD5 aed8e799830d3c4acad3c9a5bbdbeca2
BLAKE2b-256 b7e9a06fbb3b9af81d2efa51bc3e3669c444979dfc7a5337da0a2ab89abb7e4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for name2date-0.1.0.tar.gz:

Publisher: python-publish.yml on kochaika/name2date

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for name2date-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50157e143d3ac184c3885057152df7d2636e57aff28bd307c3bde2032f7f8958
MD5 b36756a0094835f58c6cf39fb19807c5
BLAKE2b-256 fc2b8bbc5bae22eb645885c8003b76fac9500db4e8d88f2cae7a92e3d7064611

See more details on using hashes here.

Provenance

The following attestation bundles were made for name2date-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on kochaika/name2date

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page