Esempio n. 1
0
def extract_syllables(database_name, spect_dir, format):
    database = get_or_error(Database, dict(name__iexact=database_name))
    segments = Segment.objects.filter(audio_file__database=database)

    extractor = extractors[format]

    audio_file_dict = {}
    for seg in segments:
        af = seg.audio_file
        if af in audio_file_dict:
            info = audio_file_dict[af]
        else:
            info = []
            audio_file_dict[af] = info
        info.append((seg.id, seg.start_time_ms, seg.end_time_ms))

    bar = Bar('Exporting segments ...', max=len(segments))

    for af, info in audio_file_dict.items():
        wav_file_path = wav_path(af)
        fs = af.fs

        for sid, start, end in info:
            spect_name = '{}.{}'.format(sid, format)
            spect_path = os.path.join(spect_dir, spect_name)

            if not os.path.isfile(spect_path):
                extractor(wav_file_path, fs, start, end, spect_path)

            bar.next()
    bar.finish()
Esempio n. 2
0
    def exited(self, status):
        # Log last output
        for line in self.readlines():
            pass

        # Display exit code
        if status is not None:
            log_func = self.warning
            info = []
            if WCOREDUMP(status):
                info.append("core.%s dumped!" % self._pid)
                log_func = self.error
            if WIFSIGNALED(status):
                signal = WTERMSIG(status)
                signal = SIGNAME.get(signal, signal)
                info.append("signal %s" % signal)
            if WIFEXITED(status):
                info.append("exitcode=%s" % WEXITSTATUS(status))
            if info:
                log_func("Exit (%s)" % ", ".join(info))
            else:
                log_func("Exit")
        else:
            self.error("Process exited (ECHILD error)")

        # Delete process
        self.process = None
        self._pid = None
Esempio n. 3
0
def GetProjectData(ProjectID):
    with open(
            os.path.join("ProjectContainer", ProjectID, "Data",
                         "mapdata.json"), 'r') as File:
        Data = json.load(File)
        BoothList = []
        info = []
        for obj in Data["object"]:
            print(obj)
            try:
                if obj["src"] == "/static/Icons/toilet.png":
                    print("Toilet", obj)
                elif obj["src"] == "/static/Icons/pin.png":
                    BoothList.append(obj["title"])
                    info.append(obj["dis"])
                    print("Pin", BoothList)
                elif obj["src"] == "/static/Icons/info.png":
                    print("Info", obj)
            except:
                continue
        print(len(BoothList), BoothList, info)
        return len(BoothList), BoothList, info