<s> import random <EOL> import struct <EOL> import wave <EOL> import soundcloud <EOL> import os , re , urllib <EOL> from sneakers . modules import Channel <EOL> class Soundcloudchannel ( Channel ) : <EOL> description = """<STR_LIT>""" <EOL> requiredParams = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:username>' : '<STR_LIT>' , <EOL> '<STR_LIT:password>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:username>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> } <EOL> maxLength = <NUM_LIT> * <NUM_LIT> * <NUM_LIT> <EOL> maxHourly = <NUM_LIT> <EOL> def send ( self , data ) : <EOL> params = self . params [ '<STR_LIT>' ] <EOL> client = soundcloud . Client ( <EOL> client_id = params [ '<STR_LIT>' ] , <EOL> client_secret = params [ '<STR_LIT>' ] , <EOL> username = params [ '<STR_LIT:username>' ] , <EOL> password = params [ '<STR_LIT:password>' ] <EOL> ) <EOL> frames = [ ] <EOL> for i in data : <EOL> frames . append ( i ) <EOL> frames . append ( '<STR_LIT:U+002C>' ) <EOL> wf = wave . open ( '<STR_LIT>' , '<STR_LIT:wb>' ) <EOL> wf . setnchannels ( <NUM_LIT:1> ) <EOL> wf . setframerate ( <NUM_LIT> ) <EOL> wf . setsampwidth ( <NUM_LIT:2> ) <EOL> wf . writeframes ( b'<STR_LIT>' . join ( frames ) ) <EOL> wf . close ( ) <EOL> track = client . post ( '<STR_LIT>' , track = { <EOL> '<STR_LIT:title>' : params [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : open ( '<STR_LIT>' , '<STR_LIT:rb>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:true>' } ) <EOL> os . remove ( '<STR_LIT>' ) <EOL> return <EOL> def receive ( self ) : <EOL> params = self . params [ '<STR_LIT>' ] <EOL> urllib . urlretrieve ( "<STR_LIT>" + params [ '<STR_LIT:username>' ] + "<STR_LIT:/>" + params [ '<STR_LIT>' ] + "<STR_LIT>" , '<STR_LIT>' ) <EOL> wf = wave . open ( '<STR_LIT>' , '<STR_LIT:r>' ) <EOL> data = wf . readframes ( wf . getnframes ( ) ) <EOL> return [ data ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> print ( receive ( { '<STR_LIT:username>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } ) ) </s>
