# Automatic time lapse creator
> ### A Python package for extracting images from a web cam url and converting these images into a timelapse. The process is intended to be automatic, so the only parameters that need to be provided are:
> - the image resourse url/urls pointing to an image *(not video!)*
> - the path on your computer where the images will be stored *(default is os.getcwd())*
> - the location of the city for which the daylight will be calculated *(default is Sofia, Bulgaria)*
### The purpose of the program is to get an archive/history of the weather in any place that has accessible web cam, so people can actually see what the real weather was like in this place and compare it with weather forecast and/or data from a weather station.
> ### Libraries used in the program:
> - Astral (https://astral.readthedocs.io/en/latest/) - to get the
sunrise and sunset time of the day for a specific geolocation
> - OpenCV-Python (https://pypi.org/project/opencv-python/) - to
read/resize the jpeg files and build a time lapse mp4 video
> - Requests - builtin module used to retrieve the image from the url
> - Logging - the builtin python looging tool for creating comprehensive
logs of the program execution
> - Pytest, unittest.mock - testing and mocking objects in isolation
### Installation
The latest release is available for installation via pip:
```pip install automatic-time-lapse-creator```
The latest releases under development are available on the TestPyPi web page:
[TestPyPi/automatic-time-lapse-creator](https://test.pypi.org/project/automatic-time-lapse-creator/#history)
and can be installed via pip:
```pip install -i https://test.pypi.org/simple/ automatic-time-lapse-creator=='the_version_you_want'```
> ### Main flow and automation:
> When the execution of the TimeLapseCreator object starts, it will check if it's daylight at the provided location. Daylight is calculated automatically using the Astral library so there will be few or no images collected during the night. After the collection of images finishes for the day the VideoManager creates a video from the collected images for each of the provided sources and deletes all the images for the day. In case of an interruption of the collection of images during the day (for example: power outage - the program stops and then it's started again), the video will still be created but the daily images won't be deleted. In this case you can inspect them and create a video manually from the pictures that are worth it.
> During the night the program will not collect any images - they will be collected when there is daylight - the smart power of the Astral library ;)
> ### Known issues
> - Images are randomly saved into folders: [#5](https://github.com/kokoeverest/Automatic-time-lapse-creator/issues/5) "Cache doesn't work as expected"
> ### Examples:
> ### A valid scenario for creating a TimeLapseCreator for webcams in Bulgaria:
> ***Note that no location is provided in the examples, so the TimeLapseCreator will be instantiated for the default location: Sofia, Bulgaria.***
```python
from automatic_time_lapse_creator.time_lapse_creator import TimeLapseCreator
from automatic_time_lapse_creator.source import Source
# Valid sources
borovets_source = Source(
"markudjik", "https://media.borovets-bg.com/cams/channel?channel=31"
)
pleven_hut_source = Source(
"plevenhut", "https://meter.ac/gs/nodes/N160/snap.jpg?1705436803718"
)
sources_list: list[Source] = [borovets_source, pleven_hut_source]
# creating a TimeLapseCreator can be done in two ways:
# instantiate the creator directly with the list of Sources
bulgaria_webcams = TimeLapseCreator(sources_list)
# or create a new TimeLapseCreator and add the list of Sources
# with the add_sources method
bulgaria_webcams = TimeLapseCreator()
bulgaria_webcams.add_sources(sources_list)
# if you try to instantiate a new TimeLapseCreator with a single Source, it will raise an InvalidCollectionException
# for example:
pleven_hut_webcam = TimeLapseCreator(pleven_hut_source)
# output:
Traceback...:
...in validate_collection
raise InvalidCollectionException(
src.automatic_time_lapse_creator.common.exceptions.InvalidCollectionException: Only list, tuple or set collections are allowed!
# start the collection of the images with the execute() method
bulgaria_webcams.execute()
```
> An invalid scenario will be:
```python
# Invalid source
sample_source_with_empty_url = Source("fake", "https://empty.url")
invalid_source_list = [sample_source_with_empty_url]
invalid_url_creator = TimeLapseCreator(invalid_source_list)
invalid_url_creator.execute()
```
> Should you have any questions, bug reports or recommendations, feel free to open an issue on
the [Issues page](https://github.com/kokoeverest/Automatic-time-lapse-creator/issues)
Raw data
{
"_id": null,
"home_page": null,
"name": "automatic-time-lapse-creator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Kaloyan Peychev <kokoeverest@gmail.com>",
"keywords": "requests, astral, opencv, opencv-python, timelapse, video, mp4, webcam",
"author": null,
"author_email": "Kaloyan Peychev <kokoeverest@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/96/76/3f0fcc13bbd0c3fe718461c8ea714ca1525a7a657900350ab63417dce706/automatic_time_lapse_creator-1.1.0.tar.gz",
"platform": null,
"description": "# Automatic time lapse creator\n\n> ### A Python package for extracting images from a web cam url and converting these images into a timelapse. The process is intended to be automatic, so the only parameters that need to be provided are:\n> - the image resourse url/urls pointing to an image *(not video!)*\n> - the path on your computer where the images will be stored *(default is os.getcwd())*\n> - the location of the city for which the daylight will be calculated *(default is Sofia, Bulgaria)*\n\n### The purpose of the program is to get an archive/history of the weather in any place that has accessible web cam, so people can actually see what the real weather was like in this place and compare it with weather forecast and/or data from a weather station.\n\n> ### Libraries used in the program:\n> - Astral (https://astral.readthedocs.io/en/latest/) - to get the \nsunrise and sunset time of the day for a specific geolocation\n> - OpenCV-Python (https://pypi.org/project/opencv-python/) - to \nread/resize the jpeg files and build a time lapse mp4 video\n> - Requests - builtin module used to retrieve the image from the url\n> - Logging - the builtin python looging tool for creating comprehensive \nlogs of the program execution\n> - Pytest, unittest.mock - testing and mocking objects in isolation\n\n### Installation\nThe latest release is available for installation via pip:\n```pip install automatic-time-lapse-creator```\n\nThe latest releases under development are available on the TestPyPi web page:\n[TestPyPi/automatic-time-lapse-creator](https://test.pypi.org/project/automatic-time-lapse-creator/#history)\nand can be installed via pip:\n```pip install -i https://test.pypi.org/simple/ automatic-time-lapse-creator=='the_version_you_want'```\n\n> ### Main flow and automation:\n> When the execution of the TimeLapseCreator object starts, it will check if it's daylight at the provided location. Daylight is calculated automatically using the Astral library so there will be few or no images collected during the night. After the collection of images finishes for the day the VideoManager creates a video from the collected images for each of the provided sources and deletes all the images for the day. In case of an interruption of the collection of images during the day (for example: power outage - the program stops and then it's started again), the video will still be created but the daily images won't be deleted. In this case you can inspect them and create a video manually from the pictures that are worth it.\n> During the night the program will not collect any images - they will be collected when there is daylight - the smart power of the Astral library ;)\n\n> ### Known issues\n> - Images are randomly saved into folders: [#5](https://github.com/kokoeverest/Automatic-time-lapse-creator/issues/5) \"Cache doesn't work as expected\"\n\n> ### Examples:\n> ### A valid scenario for creating a TimeLapseCreator for webcams in Bulgaria:\n> ***Note that no location is provided in the examples, so the TimeLapseCreator will be instantiated for the default location: Sofia, Bulgaria.***\n```python\nfrom automatic_time_lapse_creator.time_lapse_creator import TimeLapseCreator\nfrom automatic_time_lapse_creator.source import Source\n\n# Valid sources\nborovets_source = Source(\n \"markudjik\", \"https://media.borovets-bg.com/cams/channel?channel=31\"\n)\npleven_hut_source = Source(\n \"plevenhut\", \"https://meter.ac/gs/nodes/N160/snap.jpg?1705436803718\"\n)\n\nsources_list: list[Source] = [borovets_source, pleven_hut_source]\n\n# creating a TimeLapseCreator can be done in two ways:\n# instantiate the creator directly with the list of Sources\nbulgaria_webcams = TimeLapseCreator(sources_list)\n\n# or create a new TimeLapseCreator and add the list of Sources\n# with the add_sources method\nbulgaria_webcams = TimeLapseCreator()\nbulgaria_webcams.add_sources(sources_list)\n\n# if you try to instantiate a new TimeLapseCreator with a single Source, it will raise an InvalidCollectionException\n# for example:\npleven_hut_webcam = TimeLapseCreator(pleven_hut_source)\n# output:\nTraceback...:\n...in validate_collection\n raise InvalidCollectionException(\nsrc.automatic_time_lapse_creator.common.exceptions.InvalidCollectionException: Only list, tuple or set collections are allowed!\n\n# start the collection of the images with the execute() method\nbulgaria_webcams.execute()\n```\n\n> An invalid scenario will be:\n```python\n# Invalid source\nsample_source_with_empty_url = Source(\"fake\", \"https://empty.url\")\n\ninvalid_source_list = [sample_source_with_empty_url]\n\ninvalid_url_creator = TimeLapseCreator(invalid_source_list)\n\ninvalid_url_creator.execute()\n```\n\n> Should you have any questions, bug reports or recommendations, feel free to open an issue on\n the [Issues page](https://github.com/kokoeverest/Automatic-time-lapse-creator/issues)\n",
"bugtrack_url": null,
"license": null,
"summary": "automatic_time_lapse_creator is a Python program for scraping images from a web cam url and converting them into a timelapse",
"version": "1.1.0",
"project_urls": {
"Issues": "https://github.com/kokoeverest/Automatic-time-lapse-creator/issues",
"Repository": "https://github.com/kokoeverest/Automatic-time-lapse-creator"
},
"split_keywords": [
"requests",
" astral",
" opencv",
" opencv-python",
" timelapse",
" video",
" mp4",
" webcam"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c7fdbd032e1ead6bc5cd5f367a44a055b5a6b4e969fd04e366abbd858cd730cf",
"md5": "cee12a038d6fc2a06f9282f923c303eb",
"sha256": "dd0a2545c81decfc069996dcee57f660de10e62b2bbde0dfd5fd49fca23e75bd"
},
"downloads": -1,
"filename": "automatic_time_lapse_creator-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cee12a038d6fc2a06f9282f923c303eb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 20450,
"upload_time": "2024-12-20T05:44:25",
"upload_time_iso_8601": "2024-12-20T05:44:25.764135Z",
"url": "https://files.pythonhosted.org/packages/c7/fd/bd032e1ead6bc5cd5f367a44a055b5a6b4e969fd04e366abbd858cd730cf/automatic_time_lapse_creator-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "96763f0fcc13bbd0c3fe718461c8ea714ca1525a7a657900350ab63417dce706",
"md5": "43597d47aa225d859f46da9732ac4d0c",
"sha256": "bb7b6f442f4fa053d4d9012a66776042ea79d77bb47c9cdf03855b15a0bcb3d4"
},
"downloads": -1,
"filename": "automatic_time_lapse_creator-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "43597d47aa225d859f46da9732ac4d0c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 26258,
"upload_time": "2024-12-20T05:44:28",
"upload_time_iso_8601": "2024-12-20T05:44:28.428788Z",
"url": "https://files.pythonhosted.org/packages/96/76/3f0fcc13bbd0c3fe718461c8ea714ca1525a7a657900350ab63417dce706/automatic_time_lapse_creator-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-20 05:44:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kokoeverest",
"github_project": "Automatic-time-lapse-creator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "astral",
"specs": [
[
"==",
"3.2"
]
]
},
{
"name": "build",
"specs": [
[
"==",
"1.2.2.post1"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.8.30"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "distlib",
"specs": [
[
"==",
"0.3.9"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.16.1"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "iniconfig",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"2.1.3"
]
]
},
{
"name": "opencv-python",
"specs": [
[
"==",
"4.10.0.84"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.2"
]
]
},
{
"name": "pipenv",
"specs": [
[
"==",
"2024.4.0"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.3.6"
]
]
},
{
"name": "pluggy",
"specs": [
[
"==",
"1.5.0"
]
]
},
{
"name": "pyproject_hooks",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"8.3.3"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"75.5.0"
]
]
},
{
"name": "tzdata",
"specs": [
[
"==",
"2024.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.3"
]
]
},
{
"name": "virtualenv",
"specs": [
[
"==",
"20.27.1"
]
]
}
],
"lcname": "automatic-time-lapse-creator"
}