#36: Aircox ne reconnait pas les fichiers uploadés #75
@ -74,7 +74,7 @@ class SoundFile:
 | 
				
			|||||||
        Update related sound model and save it.
 | 
					        Update related sound model and save it.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if deleted:
 | 
					        if deleted:
 | 
				
			||||||
            sound = Sound.objects.filter(file=self.path).first()
 | 
					            sound = Sound.objects.path(self.path).first()
 | 
				
			||||||
            if sound:
 | 
					            if sound:
 | 
				
			||||||
                sound.type = sound.TYPE_REMOVED
 | 
					                sound.type = sound.TYPE_REMOVED
 | 
				
			||||||
                sound.check_on_file()
 | 
					                sound.check_on_file()
 | 
				
			||||||
@ -249,7 +249,7 @@ class MonitorHandler(PatternMatchingEventHandler):
 | 
				
			|||||||
        logger.info('sound deleted: %s', event.src_path)
 | 
					        logger.info('sound deleted: %s', event.src_path)
 | 
				
			||||||
        def deleted(event):
 | 
					        def deleted(event):
 | 
				
			||||||
            SoundFile(event.src_path).sync(deleted=True)
 | 
					            SoundFile(event.src_path).sync(deleted=True)
 | 
				
			||||||
        self.pool.submit(deleted, event.src_path)
 | 
					        self.pool.submit(deleted, event)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Command(BaseCommand):
 | 
					class Command(BaseCommand):
 | 
				
			||||||
@ -325,9 +325,9 @@ class Command(BaseCommand):
 | 
				
			|||||||
            excerpts_handler = MonitorHandler(settings.AIRCOX_SOUND_EXCERPTS_SUBDIR, pool)
 | 
					            excerpts_handler = MonitorHandler(settings.AIRCOX_SOUND_EXCERPTS_SUBDIR, pool)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            observer = Observer()
 | 
					            observer = Observer()
 | 
				
			||||||
            observer.schedule(archives_handler, settings.AIRCOX_PROGRAMS_DIR,
 | 
					            observer.schedule(archives_handler, settings.AIRCOX_PROGRAMS_DIR_ABS,
 | 
				
			||||||
                              recursive=True)
 | 
					                              recursive=True)
 | 
				
			||||||
            observer.schedule(excerpts_handler, settings.AIRCOX_PROGRAMS_DIR,
 | 
					            observer.schedule(excerpts_handler, settings.AIRCOX_PROGRAMS_DIR_ABS,
 | 
				
			||||||
                              recursive=True)
 | 
					                              recursive=True)
 | 
				
			||||||
            observer.start()
 | 
					            observer.start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -98,8 +98,8 @@ class Program(Page):
 | 
				
			|||||||
        Return a Program from the given path. We assume the path has been
 | 
					        Return a Program from the given path. We assume the path has been
 | 
				
			||||||
        given in a previous time by this model (Program.path getter).
 | 
					        given in a previous time by this model (Program.path getter).
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if path.startswith(settings.AIRCOX_PROGRAMS_DIR):
 | 
					        if path.startswith(settings.AIRCOX_PROGRAMS_DIR_ABS):
 | 
				
			||||||
            path = path.replace(settings.AIRCOX_PROGRAMS_DIR + '/', '')
 | 
					            path = path.replace(settings.AIRCOX_PROGRAMS_DIR_ABS, '')
 | 
				
			||||||
        while path[0] == '/':
 | 
					        while path[0] == '/':
 | 
				
			||||||
            path = path[1:]
 | 
					            path = path[1:]
 | 
				
			||||||
        path = path[:path.index('/')]
 | 
					        path = path[:path.index('/')]
 | 
				
			||||||
 | 
				
			|||||||
@ -86,7 +86,9 @@ ensure('AIRCOX_DEFAULT_USER_GROUPS', {
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Directory for the programs data
 | 
					# Directory for the programs data
 | 
				
			||||||
ensure('AIRCOX_PROGRAMS_DIR', os.path.join(settings.MEDIA_ROOT, 'programs'))
 | 
					ensure('AIRCOX_PROGRAMS_DIR', 'programs')
 | 
				
			||||||
 | 
					ensure('AIRCOX_PROGRAMS_DIR_ABS', os.path.join(settings.MEDIA_ROOT,
 | 
				
			||||||
 | 
					                                               AIRCOX_PROGRAMS_DIR))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
########################################################################
 | 
					########################################################################
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user