https://github.com/joerick/django-timecode
🎬 A python class for a timecode and accompanying django field
https://github.com/joerick/django-timecode
Last synced: 7 months ago
JSON representation
🎬 A python class for a timecode and accompanying django field
- Host: GitHub
- URL: https://github.com/joerick/django-timecode
- Owner: joerick
- License: bsd-3-clause
- Created: 2013-07-22T11:50:44.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-05T10:33:22.000Z (almost 11 years ago)
- Last Synced: 2025-05-12T23:33:22.700Z (8 months ago)
- Language: Python
- Homepage:
- Size: 174 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# django-timecode
A python class to store and manipulate timecodes with accompanying Django field.
## Examples
Timecodes can be created using a string representation
>>> from timecode import Timecode
>>> start = Timecode('09:59:50:00', fps=25)
>>> end = Timecode('10:06:05:12', fps=25)
They will print themselves
>>> start
Timecode('09:59:50:00', fps=25)
>>> str(start)
'09:59:50:00'
They can add and subtract
>>> delta = end - start
>>> delta
Timecode('00:06:15:12', fps=25)
Or you can get at the exact frames using the `total_frames` attribute
>>> delta.total_frames
9387
## In a Django model
### `models.py`
from timecode.fields import TimecodeField
from django.db import models
class TestModel(models.Model):
timecode = TimecodeField()
You can then store the timecode objects in the database.