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

EsupPortail / Esup-Pod / 7842313753

09 Feb 2024 09:55AM UTC coverage: 70.306% (+0.09%) from 70.212%
7842313753

Pull #1048

github

web-flow
Merge 9b5880476 into 55004fdf1
Pull Request #1048: [WIP] Fix dressing Watermark path

9743 of 13858 relevant lines covered (70.31%)

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
"""Esup-Pod import transcription tasks."""
2
from celery import Celery
×
3

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

12
logger = logging.getLogger(__name__)
×
13

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

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

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

29

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

40
    print("Start the import of transcription of the video: %s" % video_id)
×
41
    print("temp_vtt_file: %s" % temp_vtt_file)
×
42
    video_to_encode = Video.objects.get(id=video_id)
×
43
    filename = os.path.basename(temp_vtt_file)
×
44
    media_temp_dir = os.path.join(MEDIA_ROOT, "temp")
×
45
    filepath = os.path.join(media_temp_dir, filename)
×
46
    new_vtt = webvtt.read(filepath)
×
47
    save_vtt_and_notify(video_to_encode, msg, new_vtt)
×
48
    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

© 2026 Coveralls, Inc