Add time for Album + pipe to convert Ms

This commit is contained in:
2017-05-14 01:23:01 +02:00
parent bf274e08d6
commit 8cb2d91af0
8 changed files with 57 additions and 47 deletions

View File

@@ -23,7 +23,7 @@ export class ElsService {
constructor(private http: Http) { }
getTime(): Promise<number> {
return this.http.post(this.elsUrl + ElsService.ACTION_SEARCH, JSON.stringify({aggs:{sum_time:{sum:{field:"Total Time"}}},"size":0}), {headers: this.headers})
return this.http.post(this.elsUrl + 'song/' + ElsService.ACTION_SEARCH, JSON.stringify({aggs:{sum_time:{sum:{field:"Total Time"}}},"size":0}), {headers: this.headers})
.toPromise()
.then(res => res.json().aggregations.sum_time.value as number)
.catch(this.handleError);
@@ -84,7 +84,7 @@ export class ElsService {
"Play Count": {
"order": "desc"
} } ],
"size": 10
"size": 5
}),
{headers: this.headers})
.map(res => {
@@ -130,18 +130,18 @@ export class ElsService {
return this.http
.post(this.elsUrl + "song" + ElsService.ACTION_SEARCH,
JSON.stringify(
{
"query": {
"bool": {
"should": [
{"match_phrase" : { "Album Artist" : artistName }},
{"match_phrase" : { "Artist" : artistName }}
]
}
},
"size": ElsService.DEFAULT_SIZE,
"from": from
}),
{
"query": {
"bool": {
"should": [
{"match_phrase" : { "Album Artist" : artistName }},
{"match_phrase" : { "Artist" : artistName }}
]
}
},
"size": ElsService.DEFAULT_SIZE,
"from": from
}),
{headers: this.headers})
.map(res => {
return res.json().hits.hits;