def GET(self, item_id):
        """
        Once you have an item_id taken from the Sandbox/List, you
        can gain access to that asset with Sandbox/Access.
        You will recieve a URL for the asset which will expire
        in ten minutes.
        """

        asset = sandbox.access(sandbox_name, asset_ids=[item_id])[0]
        return render.info(asset=asset)
    def GET(self, item_id):
        """
        Once you have an item_id taken from the Sandbox/List, you
        can gain access to that asset with Sandbox/Access.
        You will recieve a URL for the asset which will expire
        in ten minutes.
        """

        asset = sandbox.access(sandbox_name, asset_ids=[item_id])[0]
        return render.info(asset=asset)
Beispiel #3
0
import urllib
from pyechonest import config
from pyechonest import sandbox

config.ECHO_NEST_API_KEY = "YLTCU72SODVIC00NB"
config.ECHO_NEST_CONSUMER_KEY = "d0fe2f9558fb209037fc49a4227ac81d"
config.ECHO_NEST_SHARED_SECRET = "9QNMqlVDQWWgMjxJVoej0Q"

# sandbox_name = 'emi_tinie_tempah'
# sandbox_name = "emi_professor_green"

asslist = sandbox.list(sandbox_name, 100)

images = []

for asset in asslist:
    if asset["type"] == "release_image" or asset["type"] == "video_still":
        filename = str(asset["filename"]).partition("/")[2]
        image_asset = sandbox.access(sandbox_name, asset["id"])
        urllib.urlretrieve(image_asset[0]["url"], sandbox_name + "_" + filename)
Beispiel #4
0
                     videos.append(asset)
     
    # if asset['type'] == 'release_image':
    #     filename = str(asset['filename']).partition('/')[2];
    #     image_asset = sandbox.access(sandbox_name, asset['id'])
    #     urllib.urlretrieve(image_asset[0]['url'], sandbox_name + '_' + filename)
            
print 'selecting video'

video = random.choice(videos)
filename = str(video['filename']).partition('/')[2];

print filename

# video_asset = sandbox.access(sandbox_name, video['id'])
video_asset = sandbox.access(sandbox_name, '2dd895f242b8b325053ae5cb853ad1d5')

urllib.urlretrieve(video_asset[0]['url'], sandbox_name + '_' + filename)

print 'encoding audio'

os.system('ffmpeg -i ' + sandbox_name + '_' + filename + ' -vn -acodec libmp3lame -ab 192000 ' + sandbox_name + '_' + filename + '.mp3')

print 'acquiring analysis'

song_analysis   = audio.LocalAudioFile(sandbox_name + '_' + filename + '.mp3')
sections        = song_analysis.analysis.sections
bars            = song_analysis.analysis.bars
beats           = song_analysis.analysis.beats
tempo           = song_analysis.analysis.tempo
# tatums          = song_analysis.analysis.tatums