0
format numbers

let api := "a7e22d237021e918cbaa602fe168f52b";
let artist := replace(Name, " ", " ");
let album := replace(Title, " ", " ");
let url := "https://ws.audioscrobbler.com/2.0/?method=album.getinfo" + "&artist=" + artist +
"&album=" +
album +
"&api_key=" +
api +
"&format=json";
let response := http("GET", url, {}, {});
let allTracks := "";
let found := false;
for key, value in response.result do
if key = "album" then
found := true;
let header := "Artista: " + value.artist +
"
Álbum: " +
value.name +
"
";
let i := 1;
let tracksList := join(for t in value.tracks.track do
let trackName := text(t.name);
let durationSec := number(t.duration);
let min := floor(durationSec / 60);
let sec := durationSec - min * 60;
let durationText := if durationSec > 0 then
"(" + text(min) + ":" + if sec < 10 then "0" else "" end + text(sec) + ")"
else
"(sin duración)"
end;
let line := number(i) + ". " + trackName + " " + durationText;
i := i + 1;
line
end, "
");
let popularity := "
Popularidad:
Reproducciones: " +
value.playcount +
"
Oyentes: " +
value.listeners;
allTracks := header + tracksList + popularity
end
end;
if not found or allTracks = "" then
allTracks := "No tracks found for this album."
end;
allTracks
There are any way to format the value.playcount and value.listeners ?
7 replies
-
If the data from the api is JSON, then data is (any). Looks like you are in Ninox so can't you use the format() command?
-
Maybe the returned values are text? what If you try: format(number(value.playcount), "0.000#,#")
Content aside
- Status Answered
- 20 hrs agoLast active
- 7Replies
- 39Views
-
3
Following