-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCollabMoodle.py
61 lines (56 loc) · 2.51 KB
/
CollabMoodle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import datetime
from webService import WebService
import Utilidades as ut
import sys
if __name__ == "__main__":
param = ut.mainMoodle(sys.argv[1:])
webService = WebService()
report = []
if param[2] == 0:
tiempo = ut.semanasAtiempo(12)
else:
tiempo = ut.semanasAtiempo(param[2])
if param[0] != '' and param[1] == '':
print("Moodle Sesions...")
moodlSession = ut.leerUUID(param[0])
for sesion in moodlSession:
nombre_session = webService.get_moodle_sesion_name(sesion)
if nombre_session == None or nombre_session == ' ':
print("Session name not found!")
else:
print(nombre_session)
lista_grabaciones = webService.get_moodle_lista_grabaciones(nombre_session)
if lista_grabaciones is None:
print("There's no recording for: " + nombre_session)
else:
for grabacion in lista_grabaciones:
report.append([grabacion['recording_id'], grabacion['recording_name'],grabacion['duration'],grabacion['storageSize'],grabacion['created']])
ut.downloadrecording(lista_grabaciones,nombre_session,nombre_session)
if len(report) > 0:
print(ut.crearReporteMoodle(report))
else:
print('No recordings was found')
elif param[0] == '' and param[1] != '':
print("Moodle LTI Integration Download:", param[1])
moodle_ids = ut.leerUUID(param[1])
contexto_ids = []
grabaciones_id = []
for moodle_id in moodle_ids:
contexto_id = webService.get_moodle_grabaciones_contexto(moodle_id,tiempo)
if contexto_id == None:
print("sessionID no valido")
else:
contexto_ids.append(contexto_id)
for ctx_id in contexto_ids:
grabacionesIds = webService.get_moodle_grabaciones_id(ctx_id)
grabaciones = ut.listaGrabaciones(grabacionesIds)
if grabaciones is None:
print("There's no recording: " + ctx_id)
else:
for grabacion in grabaciones:
report.append([grabacion['recording_id'], grabacion['recording_name'],grabacion['duration'],grabacion['storageSize'],grabacion['created']])
ut.downloadrecording(grabaciones,ctx_id,ctx_id)
if len(report) > 0:
print(ut.crearReporteMoodle(report))
else:
print('No recordings was found')