management/sounds_monitor: re-enable sounds scan
This commit is contained in:
		@ -1,5 +1,4 @@
 | 
				
			|||||||
#! /usr/bin/env python3
 | 
					#! /usr/bin/env python3
 | 
				
			||||||
# TODO: SoundMonitor class
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
"""Monitor sound files; For each program, check for:
 | 
					"""Monitor sound files; For each program, check for:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -62,10 +61,8 @@ class Command(BaseCommand):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def handle(self, *args, **options):
 | 
					    def handle(self, *args, **options):
 | 
				
			||||||
        SoundMonitor()
 | 
					        monitor = SoundMonitor()
 | 
				
			||||||
        if options.get("scan"):
 | 
					        if options.get("scan"):
 | 
				
			||||||
            self.scan()
 | 
					            monitor.scan()
 | 
				
			||||||
        # if options.get('quality_check'):
 | 
					 | 
				
			||||||
        #    self.check_quality(check=(not options.get('scan')))
 | 
					 | 
				
			||||||
        if options.get("monitor"):
 | 
					        if options.get("monitor"):
 | 
				
			||||||
            self.monitor()
 | 
					            monitor.monitor()
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								aircox/tests/management/test_sounds_monitor.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								aircox/tests/management/test_sounds_monitor.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					import pytest
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from django.core.management import call_command
 | 
				
			||||||
 | 
					from django.conf import settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					wav = b"RIFF$\x00\x00\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x02\x00D\xac\x00\x00\x10\xb1\x02\x00\x04\x00\x10\x00data\x00\x00\x00\x00"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@pytest.mark.django_db
 | 
				
			||||||
 | 
					def test_adding_a_sound(programs, fs):
 | 
				
			||||||
 | 
					    p0 = programs[0]
 | 
				
			||||||
 | 
					    assert len(p0.sound_set.all()) == 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    s0 = os.path.join(settings.PROJECT_ROOT, "static/media/%s/archives/sound.wav" % p0.path)
 | 
				
			||||||
 | 
					    fs.create_file(s0, contents=wav)
 | 
				
			||||||
 | 
					    call_command("sounds_monitor", "-s")
 | 
				
			||||||
 | 
					    assert len(p0.sound_set.all()) == 1
 | 
				
			||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
pytest~=7.2
 | 
					pytest~=7.2
 | 
				
			||||||
pytest-django~=4.5
 | 
					pytest-django~=4.5
 | 
				
			||||||
model_bakery~=1.10
 | 
					model_bakery~=1.10
 | 
				
			||||||
 | 
					pyfakefs~=5.2
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user