summaryrefslogtreecommitdiff
path: root/src/get_music_url.py
blob: d4284d45b50a38151c81736af9314dd916e1e8dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sqlite3
import urllib
from util import SimpleConfigParser
from boto.s3.connection import S3Connection

# remove key metadata
#key = key.copy(key.bucket.name, key.name, metadata={'Content-Type': 'audio/mp4'}, preserve_acl=True)

db = sqlite3.connect('iTunesLibrary.db')
curs = db.cursor()
cfg = SimpleConfigParser('audiocloudweb.cfg', 'audiocloud')
s3 = S3Connection(cfg.get('access_key'), cfg.get('secret_key'))
bucket = s3.get_bucket('mecmusic')



#curs.execute('select location from track where artist = 629 limit 1')
curs.execute('select location from track where track_id = 29510')
track = curs.fetchone()[0][6:]#.encode('utf-8')

key = bucket.get_key(track, validate=True)
key.metadata = {}
print key.generate_url(60 * 10)