<commit_before>#!/usr/bin/env python
# encoding: utf=8

"""
audition.py

Created by <NAME> with mentorship of Rosuav.
"""
from __future__ import print_function
import echonest.remix.audio as audio
from mixer import LocalAudioStream
import echonest.remix.audio as audio
import logging
from action import Crossfade as cf
from action import Playback as pb
from action import render
from Queue import Queue
import os

log = logging.getLogger(__name__)

LOUDNESS_THRESH = -8

def audition(files, xfade=0, otrim=0, itrim=0, user_name="transition"):
    filenames = []
    for file in files:
        filename = 'audio/' + str(file[0])
        filenames.append(filename)
    two_tracks = make_LAFs(filenames)
    transition = managed_transition(two_tracks[1], two_tracks[2], xfade=12, otrim=otrim, itrim=itrim)
    log.warning("What we have here is a list and it looks like %r", transition)
    render(transition, 'transition.mp3')

def make_LAFs(files):
    """

    """
    q = file_queue(files)
    localaudiofiles = {}
    number = 1
    while not q.empty():
        file = q.get()
        localaudiofiles[number] = LocalAudioStream(file)
        number += 1
        
    return localaudiofiles
        
def file_queue(files):
    """
    Get list of files, add them to a queue and return the queue.
    """
    q = Queue() 
    
    for f in files:
        q.put(f)
    <commit_msg>Encode file names UTF-8, and also convert the loop to a list comp<commit_after>#!/usr/bin/env python
# encoding: utf=8

"""
audition.py

Created by <NAME> with mentorship of Rosuav.
"""
from __future__ import print_function
import echonest.remix.audio as audio
from mixer import LocalAudioStream
import echonest.remix.audio as audio
import logging
from action import Crossfade as cf
from action import Playback as pb
from action import render
from Queue import Queue
import os

log = logging.getLogger(__name__)

LOUDNESS_THRESH = -8

def audition(files, xfade=0, otrim=0, itrim=0, user_name="transition"):
    filenames = ['audio/' + file[0].encode("UTF-8") for file in files]
    two_tracks = make_LAFs(filenames)
    transition = managed_transition(two_tracks[1], two_tracks[2], xfade=12, otrim=otrim, itrim=itrim)
    log.warning("What we have here is a list and it looks like %r", transition)
    render(transition, 'transition.mp3')

def make_LAFs(files):
    """

    """
    q = file_queue(files)
    localaudiofiles = {}
    number = 1
    while not q.empty():
        file = q.get()
        localaudiofiles[number] = LocalAudioStream(file)
        number += 1
        
    return localaudiofiles
        
def file_queue(files):
    """
    Get list of files, add them to a queue and return the queue.
    """
    q = Queue() 
    
    for f in files:
        q.put(f)
    
{'fraction_non_alphanumeric': 0.10105034407823252, 'fraction_numerical': 0.010141253169141615, 'mean_word_length': 3.229709035222052, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7343503', 'n_tokens_mistral': 916, 'n_tokens_neox': 884, 'n_words': 278}