Esempio n. 1
0
def thread_func(album, tracks_start, queue, FOLDER, ARTIST, ALBUM, FILE_TYPE,
                TRK_TIMESKIP, FFMPEG_MODE):
    while not queue.empty():
        song_tuple = queue.get()
        split_song(album, tracks_start, song_tuple[0], song_tuple[1], FOLDER,
                   ARTIST, ALBUM, BITRATE, FILE_TYPE, TRK_TIMESKIP_F,
                   TRK_TIMESKIP_R, FFMPEG_MODE)
Esempio n. 2
0
def thread_func(album, tracks_start, queue, FOLDER, ARTIST, ALBUM):
    while not queue.empty():
        song_tuple = queue.get()
        split_song(album, tracks_start, song_tuple[0], song_tuple[1], FOLDER, ARTIST, ALBUM, BITRATE)
Esempio n. 3
0
    album = None
    print("Loading audio file")
    album = AudioSegment.from_file(FILENAME, 'mp3')
    print("Audio file loaded")

    tracks_start.append(len(album))  # we need this for the last track/split

    print("Starting to split")
    if THREADED and NUM_THREADS > 1:
        # Create our queue of indexes and track titles
        queue = Queue()
        for index, track in enumerate(tracks_titles):
            queue.put((index, track))
        # initialize/start threads
        threads = []
        for i in range(NUM_THREADS):
            new_thread = Thread(target=thread_func, args=(album, tracks_start, queue, FOLDER, ARTIST, ALBUM))
            new_thread.start()
            threads.append(new_thread)
        # wait for them to finish
        for thread in threads:
            thread.join()
    # Non threaded execution
    else:
        tracks_titles.append("END")
        for i, track in enumerate(tracks_titles):
            if i != len(tracks_titles)-1:
                split_song(album, tracks_start, i, track, FOLDER, ARTIST, ALBUM, BITRATE)
    print("All Done")
Esempio n. 4
0
        # we need this for the last track/split
        tracks_start.append(len(album))

    print("Starting to split")
    if THREADED and NUM_THREADS > 1:
        # Create our queue of indexes and track titles
        queue = Queue()
        for index, track in enumerate(tracks_titles):
            queue.put((index, track))
        # initialize/start threads
        threads = []
        for i in range(NUM_THREADS):
            new_thread = Thread(target=thread_func,
                                args=(album, tracks_start, queue, FOLDER,
                                      ARTIST, ALBUM, FILE_TYPE, TRK_TIMESKIP_F,
                                      TRK_TIMESKIP_R, FFMPEG_MODE))
            new_thread.start()
            threads.append(new_thread)
        # wait for them to finish
        for thread in threads:
            thread.join()
    # Non threaded execution
    else:
        tracks_titles.append("END")
        for i, track in enumerate(tracks_titles):
            if i != len(tracks_titles) - 1:
                split_song(album, tracks_start, i, track, FOLDER, ARTIST,
                           ALBUM, BITRATE, FILE_TYPE, TRK_TIMESKIP_F,
                           TRK_TIMESKIP_R, FFMPEG_MODE)
    print("All Done")