new_track_data Namespace Reference

Functions

def url_call (url)
 
def get_trackid_from_text_search (title, artistname='')
 
def get_preview_from_trackid (trackid)
 
def download_file (file_url, file_name)
 

Variables

 ECHO_NEST_API_KEY
 
string DIGITAL7_API_KEY = '7dbpa63h3y3d'
 
string API_KEY = "bd1cb09de31188b43aa46f39b8e40614"
 
string API_SECRET = "d2537b0ce8bc859a6068833c5e2a72a7"
 
string username = "QMYading"
 
 password_hash = pylast.md5("123456")
 
 network
 
list tag_classification = ["wake me up"]
 
 track = network.track
 
 tags = network.search_for_tag(tags_name)
 
 tags_search = tags.get_next_page()
 
string tag_file_name = tags_name+"_tags_results.txt"
 
 tag_data = open(tag_file_name, 'wb')
 
 tag_object = network.get_tag(each_letter)
 
 tracks_results = tag_object.get_top_tracks()
 
string track_file_name = str(each_letter)+"_results.txt"
 
 tag_track_file = open(track_file_name,'wb')
 
string artist_file_name = str(each_letter)+"_artist.txt"
 
string title_file_name = str(each_letter)+"_title.txt"
 
 newdata = open(track_file_name)
 
 artist_data = open(artist_file_name,'wb')
 
 title_data = open(title_file_name,'wb')
 
 artist
 
 title = title.strip()
 
 tracktitle
 
 trackid
 
 audio_url = get_preview_from_trackid(trackid)
 
string file_name = tracktitle+u'.wav'
 
string path_name = './'
 
 mp3 = download_file(audio_url, path_name)
 
string parent_path = '../'
 

Function Documentation

def new_track_data.download_file (   file_url,
  file_name 
)

Definition at line 117 of file new_track_data.py.

def new_track_data.get_preview_from_trackid (   trackid)
***This method is from get_preview_url.py by Thierry Bertin-Mahieux***
Ask for the preview to a particular track, get the XML answer
After calling the API with a given track id,
we get an XML response that looks like:

<response status="ok" version="1.2" xsi:noNamespaceSchemaLocation="http://api.7digital.com/1.2/static/7digitalAPI.xsd">
  <url>
    http://previews.7digital.com/clips/34/6804688.clip.mp3
  </url>
</response>

We parse it for the URL that we return, or '' if a problem

Definition at line 90 of file new_track_data.py.

def new_track_data.get_trackid_from_text_search (   title,
  artistname = '' 
)
***This method is from get_preview_url.py by Thierry Bertin-Mahieux***
Search for an artist + title using 7digital search API
Return None if there is a problem, or tuple (title,trackid)

Definition at line 65 of file new_track_data.py.

def new_track_data.url_call (   url)
***This method is from get_preview_url.py by Thierry Bertin-Mahieux***
Do a simple request to the 7digital API
We assume we don't do intense querying, this function is not robust
Return the answer as na xml document

Definition at line 53 of file new_track_data.py.

Referenced by get_preview_from_trackid(), and get_trackid_from_text_search().

Variable Documentation

string new_track_data.API_KEY = "bd1cb09de31188b43aa46f39b8e40614"

Definition at line 44 of file new_track_data.py.

string new_track_data.API_SECRET = "d2537b0ce8bc859a6068833c5e2a72a7"

Definition at line 45 of file new_track_data.py.

new_track_data.artist

Definition at line 221 of file new_track_data.py.

new_track_data.artist_data = open(artist_file_name,'wb')

Definition at line 214 of file new_track_data.py.

string new_track_data.artist_file_name = str(each_letter)+"_artist.txt"

Definition at line 208 of file new_track_data.py.

new_track_data.audio_url = get_preview_from_trackid(trackid)

Definition at line 236 of file new_track_data.py.

string new_track_data.DIGITAL7_API_KEY = '7dbpa63h3y3d'

Definition at line 41 of file new_track_data.py.

new_track_data.ECHO_NEST_API_KEY

Definition at line 38 of file new_track_data.py.

new_track_data.file_name = tracktitle+u'.wav'

Definition at line 240 of file new_track_data.py.

new_track_data.mp3 = download_file(audio_url, path_name)

Definition at line 248 of file new_track_data.py.

new_track_data.network
Initial value:
1 = pylast.LastFMNetwork(api_key = API_KEY, api_secret =
2  API_SECRET, username = username, password_hash = password_hash)

Definition at line 50 of file new_track_data.py.

new_track_data.newdata = open(track_file_name)

Definition at line 213 of file new_track_data.py.

Referenced by concatenate_packet(), and ff_asf_parse_packet().

string new_track_data.parent_path = '../'

Definition at line 258 of file new_track_data.py.

new_track_data.password_hash = pylast.md5("123456")

Definition at line 49 of file new_track_data.py.

string new_track_data.path_name = './'

Definition at line 247 of file new_track_data.py.

list new_track_data.tag_classification = ["wake me up"]

Definition at line 153 of file new_track_data.py.

new_track_data.tag_data = open(tag_file_name, 'wb')

Definition at line 180 of file new_track_data.py.

string new_track_data.tag_file_name = tags_name+"_tags_results.txt"

Definition at line 173 of file new_track_data.py.

new_track_data.tag_object = network.get_tag(each_letter)

Definition at line 194 of file new_track_data.py.

new_track_data.tag_track_file = open(track_file_name,'wb')

Definition at line 198 of file new_track_data.py.

new_track_data.tags_search = tags.get_next_page()

Definition at line 172 of file new_track_data.py.

new_track_data.title = title.strip()

Definition at line 221 of file new_track_data.py.

new_track_data.title_data = open(title_file_name,'wb')

Definition at line 215 of file new_track_data.py.

string new_track_data.title_file_name = str(each_letter)+"_title.txt"

Definition at line 209 of file new_track_data.py.

new_track_data.track = network.track

Definition at line 166 of file new_track_data.py.

string new_track_data.track_file_name = str(each_letter)+"_results.txt"

Definition at line 197 of file new_track_data.py.

new_track_data.trackid

Definition at line 232 of file new_track_data.py.

new_track_data.tracks_results = tag_object.get_top_tracks()

Definition at line 195 of file new_track_data.py.

new_track_data.tracktitle

Definition at line 232 of file new_track_data.py.

string new_track_data.username = "QMYading"

Definition at line 48 of file new_track_data.py.