]> git.parisson.com Git - teleforma.git/commitdiff
add Conference.stop()
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 4 Apr 2025 10:10:22 +0000 (12:10 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 4 Apr 2025 10:10:22 +0000 (12:10 +0200)
teleforma/models/core.py
teleforma/views/core.py

index 5d4ad5826b97b4b9e2202d197d41d6193c893266..79a86befae310bd03d076ccc171ae4482b6fc2fa 100644 (file)
@@ -57,6 +57,8 @@ import jqchat.models
 from django.core.paginator import InvalidPage, EmptyPage
 from django.template.defaultfilters import slugify
 from sorl.thumbnail import default as sorl_default
+from jsonrpc.proxy import ServiceProxy
+
 
 app_label = 'teleforma'
 
@@ -397,6 +399,25 @@ class Conference(Model):
             self.room, c = Room.objects.get_or_create(name=data['room'],
                                                    organization=organization)
 
+
+    def stop(self):
+        self.date_end = datetime.datetime.now()
+        self.save()
+        for stream in self.livestream.all():
+            stream.delete()
+        for station in self.station.all():
+            station.started = False
+            station.save()
+            station.stop()
+        if 'telecaster' in settings.INSTALLED_APPS:
+            try:
+                url = 'https://' + self.department.domain + '/json/'
+                s = ServiceProxy(url)
+                s.teleforma.stop_conference(self.public_id)
+            except:
+                pass
+
+
     class Meta(MetaCore):
         db_table = app_label + '_' + 'conference'
         verbose_name = _('conference')
index 6c2be4789cb8ad9e6aec34cc269f49dceaa55bbd..55f08831b3c10ec21032964236c1d502e9406260 100644 (file)
@@ -525,21 +525,7 @@ class ConferenceView(CourseAccessMixin, DetailView):
     @jsonrpc_method('teleforma.stop_conference')
     def stop(request, public_id):
         conference = Conference.objects.get(public_id=public_id)
-        conference.date_end = datetime.datetime.now()
-        conference.save()
-        for stream in conference.livestream.all():
-            stream.delete()
-        for station in conference.station.all():
-            station.started = False
-            station.save()
-            station.stop()
-        if 'telecaster' in settings.INSTALLED_APPS:
-            try:
-                url = 'https://' + conference.department.domain + '/json/'
-                s = ServiceProxy(url)
-                s.teleforma.stop_conference(conference.public_id)
-            except:
-                pass
+        conference.stop()
 
     @method_decorator(login_required)
     def dispatch(self, *args, **kwargs):