mirror of
https://github.com/Dineshkarthik/telegram_media_downloader.git
synced 2025-03-01 16:43:02 +08:00
commit
b5c23d40d7
4 changed files with 83 additions and 4 deletions
77
.circleci/config.yml
Normal file
77
.circleci/config.yml
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-3.5:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python:3.6.7
|
||||||
|
environment:
|
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||||
|
LOG_DIR: ${CIRCLE_ARTIFACTS}/testresults/
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Get setuptools
|
||||||
|
shell: /bin/bash
|
||||||
|
command: sudo pip install --upgrade pip setuptools codecov
|
||||||
|
- run:
|
||||||
|
name: Run test
|
||||||
|
shell: /bin/bash
|
||||||
|
command: |
|
||||||
|
sudo make -e test
|
||||||
|
codecov
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-artifacts
|
||||||
|
|
||||||
|
test-3.6:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python:3.6.5
|
||||||
|
environment:
|
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||||
|
LOG_DIR: ${CIRCLE_ARTIFACTS}/testresults/
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Get setuptools
|
||||||
|
shell: /bin/bash
|
||||||
|
command: sudo pip install --upgrade pip setuptools codecov
|
||||||
|
- run:
|
||||||
|
name: Run test
|
||||||
|
shell: /bin/bash
|
||||||
|
command: |
|
||||||
|
sudo make -e test
|
||||||
|
codecov
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-artifacts
|
||||||
|
|
||||||
|
test-3.7:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python:3.7.3
|
||||||
|
environment:
|
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||||
|
LOG_DIR: ${CIRCLE_ARTIFACTS}/testresults/
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Get setuptools
|
||||||
|
shell: /bin/bash
|
||||||
|
command: sudo pip install --upgrade pip setuptools codecov
|
||||||
|
- run:
|
||||||
|
name: Run test
|
||||||
|
shell: /bin/bash
|
||||||
|
command: |
|
||||||
|
sudo make -e test
|
||||||
|
codecov
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-artifacts
|
||||||
|
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
tests:
|
||||||
|
jobs:
|
||||||
|
- test-3.5
|
||||||
|
- test-3.6
|
||||||
|
- test-3.7
|
|
@ -2,7 +2,9 @@
|
||||||
<h1 align="center">Telegram Media Downloader</h1>
|
<h1 align="center">Telegram Media Downloader</h1>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://github.com/Dineshkarthik/Whatsapp-analyzer/blob/master/LICENSE"><img alt="License: MIT" src="https://black.readthedocs.io/en/stable/_static/license.svg"></a>
|
<a href="https://circleci.com/gh/Dineshkarthik/telegram_media_downloader/tree/master"><img alt="Build Status" src="https://circleci.com/gh/Dineshkarthik/telegram_media_downloader.svg?style=svg"></a>
|
||||||
|
<a href="https://codecov.io/gh/Dineshkarthik/telegram_media_downloader"><img alt="Coverage Status" src="https://codecov.io/gh/Dineshkarthik/telegram_media_downloader/branch/master/graph/badge.svg"></a>
|
||||||
|
<a href="https://github.com/Dineshkarthik/telegram_media_downloader/blob/master/LICENSE"><img alt="License: MIT" src="https://black.readthedocs.io/en/stable/_static/license.svg"></a>
|
||||||
<a href="https://github.com/python/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
<a href="https://github.com/python/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ def _get_media_meta(media_obj: object, _type: str) -> Tuple[str, str]:
|
||||||
THIS_DIR,
|
THIS_DIR,
|
||||||
_type,
|
_type,
|
||||||
"voice_{}.{}".format(
|
"voice_{}.{}".format(
|
||||||
dt.fromtimestamp(media_obj.date).isoformat(), file_format
|
dt.utcfromtimestamp(media_obj.date).isoformat(), file_format
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
elif _type == "photo":
|
elif _type == "photo":
|
||||||
|
|
|
@ -85,7 +85,7 @@ class MockClient:
|
||||||
|
|
||||||
def download_media(self, *args, **kwargs):
|
def download_media(self, *args, **kwargs):
|
||||||
assert "AwADBQADbwAD2oTRVeHe5eXRFftfAg", args[0]
|
assert "AwADBQADbwAD2oTRVeHe5eXRFftfAg", args[0]
|
||||||
assert "/root/project/voice/voice_2019-07-25T16:53:50.ogg", kwargs[
|
assert "/root/project/voice/voice_2019-07-25T14:53:50.ogg", kwargs[
|
||||||
"file_name"
|
"file_name"
|
||||||
]
|
]
|
||||||
return kwargs["file_name"]
|
return kwargs["file_name"]
|
||||||
|
@ -108,7 +108,7 @@ class MediaDownloaderTestCase(unittest.TestCase):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
(
|
(
|
||||||
"AwADBQADbwAD2oTRVeHe5eXRFftfAg",
|
"AwADBQADbwAD2oTRVeHe5eXRFftfAg",
|
||||||
"/root/project/voice/voice_2019-07-25T16:53:50.ogg",
|
"/root/project/voice/voice_2019-07-25T14:53:50.ogg",
|
||||||
),
|
),
|
||||||
result,
|
result,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue