Tanda logic: pseudocode
jessicaschilling opened this issue · 1 comments
jessicaschilling commented
- Pick a random
trackID
- {note: if tanda is generated as part of a playlist, this track will be supplied by playlist logic to ensure it fits into tanda-order rules: right dance type, OK orquesta/singer}
- Get its
type
,orquesta
,singer
,year
,spotifyID
,prettyTitle
- Get all the other
trackID
s that ...- Have same
type
- Have same
orquesta
- Contain same
singer
(contain, so that if a track only has one singer, it can match multi-singer tracks containing that one singer) - Have
year
value within +-3 on either side - Do not have "cumparsita" in
prettyTitle
- Have same
- Of those, randomly pull 2
trackID
s - If there aren't 2 more, start over
- Output those 3
trackID
s
jessicaschilling commented
CURL for getting the type
, orquesta
, singer
, year
, and spotifyID
for a record matching specified rand
value, in this case 12:
curl "https://api.airtable.com/v0/appnR9FrKCD0OV7Q9/Tracks?maxRecords=1&fields%5B%5D=type&fields%5B%5D=orquesta&fields%5B%5D=singer&fields%5B%5D=year&fields%5B%5D=trackID&view=All%20tracks&filterByFormula=(%7Brand%7D+%3D+'12')" \ -H "Authorization: Bearer API_KEY"
Also see Airtable API encoder and main Airtable API reference.