• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EsupPortail / Esup-Pod / 6377635546

02 Oct 2023 08:21AM UTC coverage: 70.396% (-1.6%) from 71.99%
6377635546

push

github

web-flow
Merge pull request #900 from EsupPortail/develop

[DONE] #3.4.0

1509 of 1509 new or added lines in 58 files covered. (100.0%)

9288 of 13194 relevant lines covered (70.4%)

0.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pod/video_encode_transcript/importing_transcript_tasks.py
1
from celery import Celery
×
2

3
try:
×
4
    from ..custom import settings_local
×
5
except ImportError:
×
6
    from .. import settings as settings_local
×
7
import logging
×
8
import os
×
9
import webvtt
×
10

11
logger = logging.getLogger(__name__)
×
12

13
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pod.settings")
×
14

15
ENCODING_TRANSCODING_CELERY_BROKER_URL = getattr(
×
16
    settings_local, "ENCODING_TRANSCODING_CELERY_BROKER_URL", ""
17
)
18

19
importing_transcript_app = Celery(
×
20
    "importing_transcript_tasks", broker=ENCODING_TRANSCODING_CELERY_BROKER_URL
21
)
22
importing_transcript_app.conf.task_routes = {
×
23
    "pod.video_encode_transcript.importing_transcript_tasks.*": {
24
        "queue": "importing_transcript"
25
    }
26
}
27

28

29
# celery \
30
# -A pod.video_encode_transcript.importing_transcript_tasks worker \
31
# -l INFO -Q importing_transcript
32
@importing_transcript_app.task
×
33
def start_importing_transcript_task(video_id, msg, temp_vtt_file):
×
34
    """Start the import of transcription of the video."""
35
    from pod.video.models import Video
×
36
    from .transcript import save_vtt_and_notify
×
37
    from ..main.settings import MEDIA_ROOT
×
38

39
    print("Start the import of transcription of the video: %s" % video_id)
×
40
    print("temp_vtt_file: %s" % temp_vtt_file)
×
41
    video_to_encode = Video.objects.get(id=video_id)
×
42
    filename = os.path.basename(temp_vtt_file)
×
43
    media_temp_dir = os.path.join(MEDIA_ROOT, "temp")
×
44
    filepath = os.path.join(media_temp_dir, filename)
×
45
    new_vtt = webvtt.read(filepath)
×
46
    save_vtt_and_notify(video_to_encode, msg, new_vtt)
×
47
    os.remove(filepath)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc