(typesense) Main dashboard

Lot of duplicate to have a simple improvment
This commit is contained in:
2023-09-21 01:57:26 +02:00
parent 1ff074aac3
commit b789c925c4
14 changed files with 1534 additions and 167 deletions

View File

@@ -1,11 +1,13 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { ElsService } from '../els-service/els.service';
import { Song } from './../model/song'; import { Song } from './../model/song';
import { Album } from './../model/album'; import { Album } from './../model/album';
import { SongTableComponent } from '../song-table/song-table.component'; import { SongTableComponent } from '../song-table/song-table.component';
import { TsService } from '../ts-service/ts.service';
import { TsAlbumService } from '../ts-service/ts-album.service';
@Component({ @Component({
selector: 'app-album', selector: 'app-album',
templateUrl: './album.component.html', templateUrl: './album.component.html',
@@ -25,7 +27,7 @@ export class AlbumComponent implements OnInit {
lockLoadData = false; lockLoadData = false;
constructor( constructor(
private elsService: ElsService, private tsAlbumService: TsAlbumService,
private route: ActivatedRoute private route: ActivatedRoute
) { } ) { }
@@ -35,7 +37,7 @@ export class AlbumComponent implements OnInit {
this.loadSongs(); this.loadSongs();
this.elsService.getAlbum(this.albumName).subscribe(data => this.album = data); this.tsAlbumService.getAlbum(this.albumName).subscribe(data => this.album = data);
} }
loadSongs(): void { loadSongs(): void {
@@ -49,9 +51,9 @@ export class AlbumComponent implements OnInit {
} }
this.lockLoadData = true; this.lockLoadData = true;
this.elsService.getAlbumSongs(this.albumName, this.songs.length, this.sortFilter).subscribe( this.tsAlbumService.getAlbumSongs(this.albumName, this.songs.length, this.sortFilter).subscribe(
data => { data => {
this.moreDataAvailable = data.length === ElsService.DEFAULT_SIZE; this.moreDataAvailable = data.length === TsService.DEFAULT_SIZE;
// Erase song array with result for first load, then add elements one by one // Erase song array with result for first load, then add elements one by one
// instead use concat => concat will sort table at each load, very consuming! and not user friendly // instead use concat => concat will sort table at each load, very consuming! and not user friendly

View File

@@ -1,27 +1,28 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { ElsAlbumService } from '../els-service/els-album.service';
import { Album } from '../model/album'; import { Album } from "../model/album";
import { Utils } from '../utils'; import { Utils } from "../utils";
import { TsAlbumService } from "../ts-service/ts-album.service";
enum query_edit_type { enum query_edit_type {
exclude = 'must_not', exclude = "must_not",
select = 'must' select = "must",
} }
@Component({ @Component({
selector: 'app-albums', selector: "app-albums",
templateUrl: './albums.component.html', templateUrl: "./albums.component.html",
styleUrls: ['./albums.component.css'] styleUrls: ["./albums.component.css"],
}) })
export class AlbumsComponent implements OnInit { export class AlbumsComponent implements OnInit {
numberToArray = Utils.numberToArray; numberToArray = Utils.numberToArray; // For star representation
albums: Album[] = []; albums: Album[] = [];
filterQuery = Object.assign({}, ElsAlbumService.GET_ALBUMS_DEFAULT_QUERY); filterParams = TsAlbumService.GET_ALBUMS_DEFAULT_PARAMS();
queryEdited = false; queryEdited = false; // Show reset button if true
constructor(private elsService : ElsAlbumService) { } constructor(private tsService: TsAlbumService) {}
ngOnInit(): void { ngOnInit(): void {
this.loadData(); this.loadData();
@@ -30,42 +31,47 @@ export class AlbumsComponent implements OnInit {
private editQuery(field: string, value: Album, type: query_edit_type): void { private editQuery(field: string, value: Album, type: query_edit_type): void {
// TODO Move this method to a service // TODO Move this method to a service
if (value[field] instanceof Array) { if (value[field] instanceof Array) {
value[field] = value[field][0] value[field] = value[field][0];
} }
// If firt edit, add needed fields in ELS Query if (type == query_edit_type.exclude) {
if (!this.filterQuery['query']) { // Filter can be cumulated
this.filterQuery['query']['bool'][type].push({ 'must': [] }) // TODO Specific treatment for array? https://typesense.org/docs/0.25.1/api/search.html#filter-parameters
this.filterQuery['query']['bool'][type].push({ 'must_not': [] }) this.filterParams = this.filterParams.append(
"filter_by",
field + ":!=`" + value[field] + "`"
);
} }
if (type == query_edit_type.select) {
this.filterQuery['query']['bool'][type].push({ this.filterParams = this.filterParams
'match_phrase': { .delete("q")
[field]: value[field] .append("q", value[field])
} .delete("query_by")
}) .append("query_by", field);
}
this.queryEdited = true; this.queryEdited = true;
} }
exlude(field: string, value: Album): void { exlude(field: string, value: Album): void {
this.editQuery(field, value, query_edit_type.exclude) this.editQuery(field, value, query_edit_type.exclude);
this.loadData() this.loadData();
} }
select(field: string, value: Album): void { select(field: string, value: Album): void {
this.editQuery(field, value, query_edit_type.select) this.editQuery(field, value, query_edit_type.select);
this.loadData() this.loadData();
} }
resetQuery(): void { resetQuery(): void {
this.filterQuery = Object.assign({}, ElsAlbumService.GET_ALBUMS_DEFAULT_QUERY); this.filterParams = TsAlbumService.GET_ALBUMS_DEFAULT_PARAMS();
this.loadData(); this.loadData();
} }
loadData(): void { loadData(): void {
// console.log(JSON.stringify(this.filterQuery)) console.log(this.filterParams.toString());
this.elsService.getAlbums(this.filterQuery).subscribe(data => this.albums = data); this.tsService
.getAlbums(this.filterParams)
.subscribe((data) => (this.albums = data));
} }
} }

View File

@@ -11,8 +11,9 @@ import { GenreComponent } from './genre/genre.component';
import { SongTableComponent } from './song-table/song-table.component'; import { SongTableComponent } from './song-table/song-table.component';
import { TopPlayedComponent } from './top-played/top-played.component'; import { TopPlayedComponent } from './top-played/top-played.component';
import { ElsService } from './els-service/els.service'; import { TsService } from './ts-service/ts.service';
import { ElsAlbumService } from './els-service/els-album.service'; import { TsAlbumService } from './ts-service/ts-album.service';
import { TsArtistService } from './ts-service/ts-artist.service';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
@@ -25,7 +26,6 @@ import { AlbumsComponent } from './albums/albums.component';
import { ToSortComponent } from './to-sort/to-sort.component'; import { ToSortComponent } from './to-sort/to-sort.component';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import { ElsArtistService } from './els-service/els-artist.service';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -52,9 +52,9 @@ import { ElsArtistService } from './els-service/els-artist.service';
ToSortComponent ToSortComponent
], ],
providers: [ providers: [
ElsService, TsService,
ElsAlbumService, TsAlbumService,
ElsArtistService TsArtistService
], ],
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
}) })

View File

@@ -4,8 +4,9 @@ import { ActivatedRoute, Params } from '@angular/router';
import { Song } from './../model/song'; import { Song } from './../model/song';
import { Artist } from './../model/artist'; import { Artist } from './../model/artist';
import { SongTableComponent } from '../song-table/song-table.component'; import { SongTableComponent } from '../song-table/song-table.component';
import { ElsArtistService } from '../els-service/els-artist.service';
import { ElsService } from '../els-service/els.service'; import { TsService } from '../ts-service/ts.service';
import { TsArtistService } from '../ts-service/ts-artist.service';
@Component({ @Component({
selector: 'app-artist', selector: 'app-artist',
@@ -28,7 +29,7 @@ export class ArtistComponent implements OnInit {
toSortFilter: boolean = false; // Show only song to sort toSortFilter: boolean = false; // Show only song to sort
constructor( constructor(
private elsService: ElsArtistService, private elsService: TsArtistService,
private route: ActivatedRoute, private route: ActivatedRoute,
) { } ) { }
@@ -63,7 +64,7 @@ export class ArtistComponent implements OnInit {
this.lockLoadData = true; this.lockLoadData = true;
this.elsService.getArtistSongs(this.artistName, this.songs.length, this.toSortFilter).subscribe( this.elsService.getArtistSongs(this.artistName, this.songs.length, this.toSortFilter).subscribe(
data => { data => {
this.moreDataAvailable = data.length === ElsService.DEFAULT_SIZE; this.moreDataAvailable = data.length === TsService.DEFAULT_SIZE;
console.log(data.length) console.log(data.length)
console.log(this.moreDataAvailable) console.log(this.moreDataAvailable)

View File

@@ -82,7 +82,7 @@
<span *ngIf="r.type == 'artist'" class="glyphicon glyphicon-user"></span> <span *ngIf="r.type == 'artist'" class="glyphicon glyphicon-user"></span>
<span *ngIf="r.type == 'album'" class="glyphicon glyphicon-cd"></span> <span *ngIf="r.type == 'album'" class="glyphicon glyphicon-cd"></span>
&nbsp; <ngb-highlight [result]="r.name" [term]="t"></ngb-highlight> &nbsp; <ngb-highlight [result]="r.name" [term]="t"></ngb-highlight>
</ng-template> </ng-template>
<form class="navbar-form"> <form class="navbar-form">
@@ -112,9 +112,9 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let album of lastAddedAlbums"> <tr *ngFor="let album of lastAddedAlbums">
<td><a [routerLink]="['/album', album.key]">{{album.key}}</a></td> <td><a [routerLink]="['/album/', album.group_key[0]]">{{album.group_key[0]}}</a></td>
<td>{{album.doc_count}}</td> <td>{{album.found}}</td>
<td><a [routerLink]="['/artist', albumArtists[album.key]]">{{albumArtists[album.key]}}</a></td> <td><a [routerLink]="['/artist', albumArtists[album.group_key[0]]]">{{albumArtists[album.group_key[0]]}}</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -156,8 +156,8 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let genre of topGenres"> <tr *ngFor="let genre of topGenres">
<td><a [routerLink]="['/genre', genre.key]">{{genre.key}}</a></td> <td><a [routerLink]="['/genre', genre.value]">{{genre.value}}</a></td>
<td>{{genre.doc_count}}</td> <td>{{genre.count}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -173,8 +173,8 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let genre of bottomGenres"> <tr *ngFor="let genre of bottomGenres">
<td><a [routerLink]="['/genre', genre.key]">{{genre.key}}</a></td> <td><a [routerLink]="['/genre', genre.value]">{{genre.value}}</a></td>
<td>{{genre.doc_count}}</td> <td>{{genre.count}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -8,6 +8,8 @@ import { Suggested } from '../model/suggested';
import {Observable, of, OperatorFunction} from 'rxjs'; import {Observable, of, OperatorFunction} from 'rxjs';
import {catchError, debounceTime, distinctUntilChanged, map, tap, switchMap} from 'rxjs/operators'; import {catchError, debounceTime, distinctUntilChanged, map, tap, switchMap} from 'rxjs/operators';
import { TsService } from '../ts-service/ts.service';
import { TsBucket } from '../model/tsBucket';
@Component({ @Component({
selector: 'app-dashboard', selector: 'app-dashboard',
@@ -24,48 +26,42 @@ export class DashboardComponent implements OnInit {
albumArtistCount = 0; albumArtistCount = 0;
topGenres: Bucket[] = []; topGenres: TsBucket[] = [];
bottomGenres: Bucket[] = []; bottomGenres: TsBucket[] = [];
mostPlayedSongs: Song[] = []; mostPlayedSongs: Song[] = [];
lastAddedAlbums: Bucket[] = []; lastAddedAlbums: TsBucket[] = [];
albumArtists = []; albumArtists = [];
searchTerm = '' searchTerm = ''
suggested : Suggested[] = [] suggested : Suggested[] = []
constructor(private elsService: ElsService, private route: Router) { } constructor(private tsService: TsService, private route: Router) { }
ngOnInit(): void { ngOnInit(): void {
this.elsService.getTime().then(result => { this.tsService.getTime().then(result => {
this.totalTime = result; this.totalTime = result;
}); });
this.elsService.getSize().then(result => this.totalSize = result); this.tsService.getSize().then(result => this.totalSize = result);
this.elsService.getCountSong(ElsService.SONG_INDEX_NAME) this.tsService.getCountSong(ElsService.SONG_INDEX_NAME)
.then(result => this.trackCountSong = result); .then(result => this.trackCountSong = result);
// TODO: Unused information
// this.elsService.getCountSong(ElsService.ARTIST_INDEX_NAME)
// .then(result => this.trackCountArtist = result);
// this.elsService.getCountSong(ElsService.ALBUM_INDEX_NAME)
// .then(result => this.trackCountAlbum = result);
this.elsService.getCountNeverListenSong() this.tsService.getCountNeverListenSong()
.then(result => this.neverListenSong = result); .then(result => this.neverListenSong = result);
this.elsService.getMostPlayedTrack().subscribe( this.tsService.getMostPlayedTrack().subscribe(
data => this.mostPlayedSongs = data data => this.mostPlayedSongs = data
); );
this.elsService.getGenres().subscribe(data => this.topGenres = data); this.tsService.getGenres().subscribe(data => this.topGenres = data);
this.elsService.getGenres('asc').subscribe(data => this.bottomGenres = data); this.tsService.getGenres('asc').subscribe(data => this.bottomGenres = data);
// this.elsService.getGenreCount().subscribe(data => console.log(data)); this.tsService.getGenreCount().subscribe(data => console.log(data));
const lastAddedAlbumsTemp: Bucket[] = []; const lastAddedAlbumsTemp: TsBucket[] = [];
const BreakException = {}; this.tsService.getLastAddedAlbums(6).subscribe(buckets => {
this.elsService.getLastAddedAlbums(6).subscribe(buckets => {
buckets.forEach(bucket => { buckets.forEach(bucket => {
// console.log(bucket); // console.log(bucket);
@@ -74,8 +70,8 @@ export class DashboardComponent implements OnInit {
} else { } else {
let found = false; let found = false;
lastAddedAlbumsTemp.forEach(element => { lastAddedAlbumsTemp.forEach(element => {
if (element.key === bucket.key) { if (element.group_key === bucket.group_key) {
element.doc_count += bucket.doc_count; element.found += bucket.found;
found = true; found = true;
} }
}); });
@@ -84,24 +80,22 @@ export class DashboardComponent implements OnInit {
} }
} }
}); });
// console.log("alors");
// console.log(lastAddedAlbumsTemp);
this.lastAddedAlbums = lastAddedAlbumsTemp; this.lastAddedAlbums = lastAddedAlbumsTemp;
this.lastAddedAlbums.forEach(bucket => this.getArtistName(bucket)); this.lastAddedAlbums.forEach(bucket => this.getArtistName(bucket));
}); });
} }
private getArtistName(albumBucket: Bucket) { private getArtistName(albumBucket: TsBucket) {
// For each bucket.key (album name), search artist. // For each bucket.key (album name), search artist.
// Use track count to compare // Use track count to compare
this.elsService.getArtistFromAlbumName(albumBucket.key).subscribe(albums => { this.tsService.getArtistFromAlbumName(albumBucket.group_key[0]).subscribe(albums => {
// Identification of the good album // Identification of the good album
let goodAlbum; let goodAlbum;
if (albums.length > 1) { if (albums.length > 1) {
// More than one result for an album name: search good by track count // More than one result for an album name: search good by track count
albums.forEach(album => { albums.forEach(album => {
if (album['Track Count'] === albumBucket.doc_count) { if (album['Track Count'] === albumBucket.found) {
goodAlbum = album; goodAlbum = album;
} }
}); });
@@ -132,7 +126,7 @@ export class DashboardComponent implements OnInit {
distinctUntilChanged(), distinctUntilChanged(),
tap(() => this.searching = true), tap(() => this.searching = true),
switchMap(term => switchMap(term =>
this.elsService.getSuggest(term).pipe( this.tsService.getSuggest(term).pipe(
tap(() => this.searchFailed = false), tap(() => this.searchFailed = false),
catchError(() => { catchError(() => {
this.searchFailed = true; this.searchFailed = true;

View File

@@ -1,7 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { ElsService } from '../els-service/els.service'; import { TsService } from '../ts-service/ts.service';
import { SongTableComponent } from '../song-table/song-table.component'; import { SongTableComponent } from '../song-table/song-table.component';
import { Song } from '../model/song'; import { Song } from '../model/song';
@@ -17,7 +17,7 @@ export class GenreComponent implements OnInit {
songs: Array<Song> = []; songs: Array<Song> = [];
constructor( constructor(
private elsService: ElsService, private tsService: TsService,
private route: ActivatedRoute private route: ActivatedRoute
) { } ) { }
@@ -29,7 +29,7 @@ export class GenreComponent implements OnInit {
} }
loadSongs(): any { loadSongs(): any {
this.elsService.getGenreSongs(this.genreName, this.songs.length).subscribe( this.tsService.getGenreSongs(this.genreName, this.songs.length).subscribe(
data => { data => {
// this.moreDataAvailable = data.length === ElsService.DEFAULT_SIZE; // this.moreDataAvailable = data.length === ElsService.DEFAULT_SIZE;

View File

@@ -0,0 +1,6 @@
export class TsBucket {
value: string;
count: number;
group_key: string[];
found: number;
}

View File

@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ElsService } from '../els-service/els.service'; import { TsService } from '../ts-service/ts.service';
import { Album } from '../model/album'; import { Album } from '../model/album';
import { Artist } from '../model/artist'; import { Artist } from '../model/artist';
@@ -15,10 +15,10 @@ export class TopPlayedComponent implements OnInit {
mostPlayedArtistsNaive: Artist[] = []; mostPlayedArtistsNaive: Artist[] = [];
mostPlayedArtists: Artist[] = []; mostPlayedArtists: Artist[] = [];
constructor(private elsService: ElsService) { } constructor(private tsService: TsService) { }
ngOnInit() { ngOnInit() {
this.elsService.getMostPlayedAlbumNaive() this.tsService.getMostPlayedAlbumNaive()
.then(result => { .then(result => {
result.forEach(album => { result.forEach(album => {
if (album.Artist.length <= 10) { if (album.Artist.length <= 10) {
@@ -29,29 +29,29 @@ export class TopPlayedComponent implements OnInit {
this.mostPlayedAlbumsNaive.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10); this.mostPlayedAlbumsNaive.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10);
}); });
this.elsService.getMostPlayedAlbum().subscribe(result => { // this.elsService.getMostPlayedAlbum().subscribe(result => {
this.mostPlayedAlbums = result; // this.mostPlayedAlbums = result;
this.mostPlayedAlbums.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10); // this.mostPlayedAlbums.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10);
// TODO Load more! (Use a ) // // TODO Load more! (Use a )
}); // });
this.elsService.getMostPlayedArtistNaive() this.tsService.getMostPlayedArtistNaive()
.then(result => { .then(result => {
this.mostPlayedArtistsNaive = result; this.mostPlayedArtistsNaive = result;
this.mostPlayedArtistsNaive.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10); this.mostPlayedArtistsNaive.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10);
}); });
this.elsService.getMostPlayedArtist().subscribe(result => { // this.tsService.getMostPlayedArtist().subscribe(result => {
result.forEach(artist => { // result.forEach(artist => {
if (artist['Track Count'] > 10) { // if (artist['Track Count'] > 10) {
this.mostPlayedArtists.push(artist); // this.mostPlayedArtists.push(artist);
} // }
}); // });
this.mostPlayedArtists.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10); // this.mostPlayedArtists.sort((a: any, b: any) => this.sortByAveragePlay(a, b)).splice(10);
}); // });
} }
sortByAveragePlay(a: any, b: any) { sortByAveragePlay(a: any, b: any) {

View File

@@ -0,0 +1,101 @@
import { HttpClient, HttpParams } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { catchError, map } from "rxjs/operators";
import { TsService } from "./ts.service";
import { Album } from "../model/album";
import { Song } from "../model/song";
@Injectable()
export class TsAlbumService extends TsService {
constructor(protected http: HttpClient) {
super(http);
}
getAlbum(albumName: string): Observable<Album> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", albumName);
queryParams = queryParams.append("query_by", "Name");
console.log("coucou");
return this.http
.get(
this.tsUrl +
TsService.ALBUM_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToOneTypedResult<Album>(res, albumName)),
catchError((error) =>
this.handleError(error, "getAlbum(" + albumName + ")")
)
);
}
getAlbumSongs(
albumName: string,
from: number = 0,
toSortFilter = false
): Observable<Song[]> {
// TODO Move in els-album service
console.info(
"getAlbumSongs- Album name: " + albumName + " - from: " + from
);
let queryParams = new HttpParams();
queryParams = queryParams.append("q", albumName);
queryParams = queryParams.append("query_by", "Album");
queryParams = queryParams.append("per_page", TsService.DEFAULT_SIZE);
queryParams = queryParams.append("offset", from);
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToSongs(res)),
catchError((error) =>
this.handleError(
error,
"getAlbumSongs(" + albumName + "," + from + ")"
)
)
);
}
public static GET_ALBUMS_DEFAULT_PARAMS(): HttpParams {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append(
"sort_by",
"Play Count:desc,Avg Bit Rate:desc"
);
queryParams = queryParams.append("filter_by", "Min Bit Rate:<128");
queryParams = queryParams.append("per_page", "100");
return queryParams;
}
getAlbums(queryParams: HttpParams): Observable<Album[]> {
return this.http
.get<any>(
this.tsUrl +
TsService.ALBUM_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToAlbums(res)),
catchError((error) => this.handleError(error, "getAlbums"))
);
}
}

View File

@@ -0,0 +1,140 @@
import { HttpClient, HttpParams } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { catchError, map } from "rxjs/operators";
import { TsService } from "./ts.service";
import { Artist } from "../model/artist";
import { Song } from "../model/song";
@Injectable()
export class TsArtistService extends TsService {
constructor(protected http: HttpClient) {
super(http);
}
private getQuerySongsWithArtistName(
artistName: string,
sortFilter: boolean = false,
size: number = 0,
from: number = 0
) {
let query = {
query: {
bool: {
should: [
{ match_phrase: { "Album Artist": artistName } },
{ match_phrase: { Artist: artistName } },
],
must_not: [],
},
},
};
if (sortFilter) {
console.log("ElsArtistService- TO SORT filter enabled");
query = this.addSortFilterToQuery(query);
}
if (size) {
query["size"] = size;
}
if (from) {
query["from"] = from;
}
return query;
}
public getArtist(artistName: string): Observable<Artist> {
console.log("getArtist");
let queryParams = new HttpParams();
queryParams = queryParams.append("q", artistName);
queryParams = queryParams.append("query_by", "Name");
return this.http
.get<any>(
this.tsUrl +
TsService.ARTIST_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToOneTypedResult<Artist>(res, artistName)),
catchError((error) =>
this.handleError(error, "getArtist(" + artistName + ")")
)
);
}
public getArtistSongs(
artistName: string,
from: number = 0,
sortFilter = false
): Observable<Song[]> {
console.info(
"getArtistSongs- Artist name: " + artistName + " - from: " + from
);
let query = this.getQuerySongsWithArtistName(
artistName,
sortFilter,
TsService.DEFAULT_SIZE,
from
);
let queryParams = new HttpParams();
queryParams = queryParams.append("q", artistName);
queryParams = queryParams.append("query_by", "Artist,Album Artist");
queryParams = queryParams.append("per_page", TsService.DEFAULT_SIZE);
queryParams = queryParams.append("offset", from);
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToSongs(res)),
catchError((error) =>
this.handleError(
error,
"getArtistSongs(" + artistName + "," + from + ")"
)
)
);
}
public getCountArtistSong(
artistName: string,
sortFilter = false
): Observable<number> {
console.log("artistname: " + artistName);
const query = this.getQuerySongsWithArtistName(artistName, sortFilter);
let queryParams = new HttpParams();
queryParams = queryParams.append("q", artistName);
queryParams = queryParams.append("query_by", "Artist"); // QUESTION ArtistName?
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => res.found as number),
catchError((error) =>
this.handleError(error, "getCountArtistSong" + artistName + ")")
)
);
}
}

View File

@@ -0,0 +1,169 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { TsService } from './ts.service';
import { Album } from '../model/album';
@Injectable({
providedIn: 'root'
})
export class TsSortService extends TsService {
constructor(protected http: HttpClient) {
super(http);
}
getTime(): Promise<number> {
return this.http
.post<any>(this.tsUrl + TsService.SONG_INDEX_NAME + TsService.ACTION_SEARCH,
JSON.stringify({
query: {
bool: {
must_not: [
{
term: {
"Location.tree": "/F:/Musique"
}
}
]
}
},
aggs: {
sum_time: {
sum: { field: 'Total Time'}
}
},
'size': 0
}), {headers: this.headers})
.toPromise()
.then(res => res.aggregations.sum_time.value as number)
.catch(error => this.handleError(error, 'getTime()'));
}
getSize(): Promise<number> {
return this.http
.post<any>(this.tsUrl + TsService.SONG_INDEX_NAME + TsService.ACTION_SEARCH,
JSON.stringify({
query: {
bool: {
must_not: [
{
term: {
"Location.tree": "/F:/Musique"
}
}
]
}
},
aggs: {
sum_time: {
sum: { field: 'Size' }
}
},
'size': 0
}), {headers: this.headers})
.toPromise()
.then(res => res.aggregations.sum_time.value as number)
.catch(error => this.handleError(error, 'getSize()'));
}
getCountSong(): Promise<number> {
return this.http
.post<any>(this.tsUrl + TsService.SONG_INDEX_NAME + TsService.ACTION_COUNT,
JSON.stringify({
query: {
bool: {
must_not: [
{
term: {
"Location.tree": "/F:/Musique"
}
}
]
}
}
}), {headers: this.headers})
.toPromise()
.then(res => res.count as number)
.catch(error => this.handleError(error, 'getCountSong()'));
}
getCountNeverListenSong(): Promise<number> {
return this.http
.post<any>(this.tsUrl + TsService.SONG_INDEX_NAME + TsService.ACTION_COUNT,
JSON.stringify({
'query': {
'bool': {
'must_not': [
{
'exists': { 'field': 'Play Count'}
}, {
term: {
"Location.tree": "/F:/Musique"
} }
]
}
}
}), {headers: this.headers})
.toPromise()
.then(res => res.count as number)
.catch(error => this.handleError(error, 'getCountNeverListenSong()'));
}
getNbAlbums(): Promise<number> {
return this.http
.post<any>(this.tsUrl + TsService.ALBUM_INDEX_NAME + TsService.ACTION_SEARCH,
JSON.stringify({
'query': {
'bool': {
'must_not': [
{
term: {
"Location.tree": "/F:/Musique"
}
}
]
}
},
size: 0,
"aggs": {
"album_count": {
"cardinality": {
"field": "Album.raw"
}
}
}
}), {headers: this.headers})
.toPromise()
.then(res => res.aggregations.album_count.value as number )
.catch(error => this.handleError(error, 'getNbAlbums()'));
}
getAlbums(): Observable<Album[]> {
return this.http
.post(this.tsUrl + TsService.ALBUM_INDEX_NAME + TsService.ACTION_SEARCH,
JSON.stringify({
query: {
bool: {
must_not: [
{
term: {
"Location.tree": "/F:/Musique"
}
}
]
}
},
'size': 550,
"sort": [
{ "Play Count": "desc"}
]
}), {headers: this.headers})
.pipe(
map(res => this.responseToAlbums(res)),
catchError(error => this.handleError(error, 'getAlbums'))
);
}
}

View File

@@ -0,0 +1,458 @@
import { HttpClient, HttpHeaders, HttpParams } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { catchError, map } from "rxjs/operators";
import { Album } from "../model/album";
import { Artist } from "../model/artist";
import { Song } from "../model/song";
import { Suggested } from "../model/suggested";
import { TsBucket } from "../model/tsBucket";
@Injectable()
export class TsService {
public static readonly DEFAULT_SIZE: number = 20;
public static readonly SONG_INDEX_NAME = "/songs";
public static readonly ARTIST_INDEX_NAME = "/artists";
public static readonly ALBUM_INDEX_NAME = "/albums";
public static readonly SUGGEST_INDEX_NAME = "/suggest";
protected static readonly ACTION_SEARCH = "/search";
protected static readonly ACTION_COUNT = "/_count";
protected tsUrl = "http://localhost:8108/collections";
protected headers = new HttpHeaders({
"Content-Type": "application/json",
"X-TYPESENSE-API-KEY": "toto",
});
protected defaultLocation = "/F:/Musique"; // TODO Use conf
constructor(protected http: HttpClient) {}
getTime(): Promise<number> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append("limit", "0");
queryParams = queryParams.append(
"facet_by",
"Total Time(Range:[0,99999999999999999])"
);
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.toPromise()
.then((res) => res.facet_counts[0].stats.sum as number)
.catch((error) => this.handleError(error, "getTime()"));
}
getSize(): Promise<number> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append("limit", "0");
queryParams = queryParams.append(
"facet_by",
"Size(Range:[0,99999999999999999])"
);
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.toPromise()
.then((res) => res.facet_counts[0].stats.sum as number)
.catch((error) => this.handleError(error, "getSize()"));
}
getCountSong(index: string): Promise<number> {
return this.http
.get<any>(this.tsUrl + TsService.SONG_INDEX_NAME, {
headers: this.headers,
})
.toPromise()
.then((res) => res.num_documents as number)
.catch((error) => this.handleError(error, "getCountSong(" + index + ")"));
}
getCountNeverListenSong(): Promise<number> {
// TODO Impossible sans valeur par defaut dans Play Count
return new Promise((resolve) => {
resolve(0);
});
}
getMostPlayedTrack(): Observable<Song[]> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append("sort_by", "Play Count:desc");
queryParams = queryParams.append("limit", 5);
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToSongs(res)),
catchError((error) => this.handleError(error, "getMostPlayedTrack()"))
);
}
getMostPlayedArtist(): Observable<Artist[]> {
return this.http
.post(
this.tsUrl + TsService.ARTIST_INDEX_NAME + TsService.ACTION_SEARCH,
JSON.stringify({
sort: [
{
_script: {
type: "number",
script: {
inline: "doc['Play Count'].value / doc['Track Count'].value",
},
order: "desc",
},
},
],
size: 100,
}),
{ headers: this.headers }
)
.pipe(
map((res) => this.responseToArtists(res)),
catchError((error) => this.handleError(error, "getMostPlayedArtist()"))
);
}
/**
* A basic get of albums ordered by 'Play Count' field.
*/
getMostPlayedAlbumNaive(): Promise<Album[]> {
return this.http
.get(
this.tsUrl +
TsService.ALBUM_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH +
"?sort_by=Play%20Count%3Adesc,Track%20Count%3Adesc&limit=20&q=*",
{ headers: this.headers }
)
.toPromise()
.then((res) => this.responseToAlbums(res))
.catch((error) => this.handleError(error, "getMostPlayedAlbumNaive"));
// TODO Excluse 'Divers' + compilation
}
getMostPlayedArtistNaive(): Promise<Artist[]> {
return this.http
.get(
this.tsUrl +
TsService.ARTIST_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH +
"?sort_by=Play%20Count%3Adesc&limit=20&q=*",
{ headers: this.headers }
)
.toPromise()
.then((res) => this.responseToAlbums(res))
.catch((error) => this.handleError(error, "getMostPlayedArtistNaive"));
// TODO Excluse 'Divers' + compilation
}
getGenreSongs(genreName: string, from: number = 0): Observable<Song[]> {
console.info(
"getGenreSongs- Genre name: " + genreName + " - from: " + from
);
let queryParams = new HttpParams();
queryParams = queryParams.append("q", genreName);
queryParams = queryParams.append("query_by", "Genre");
queryParams = queryParams.append("per_page", TsService.DEFAULT_SIZE);
queryParams = queryParams.append("offset", from);
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseToSongs(res)),
catchError((error) =>
this.handleError(
error,
"getGenreSongs(" + genreName + "," + from + ")"
)
)
);
}
getGenres(ordering: string = "desc"): Observable<TsBucket[]> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append("facet_by", "Genre");
queryParams = queryParams.append("max_facet_values", "5");
queryParams = queryParams.append("limit", "0");
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseAggregationToBucket(res)),
catchError((error) =>
this.handleError(error, "getGenres(" + ordering + ")")
)
);
}
getGenreCount(ordering: string = "desc"): Observable<number> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append("facet_by", "Genre");
queryParams = queryParams.append("max_facet_values", "0");
queryParams = queryParams.append("limit", "0");
return this.http
.get<any>(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => res.facet_counts[0].stats.total_values as number),
catchError((error) =>
this.handleError(error, "getGenres(" + ordering + ")")
)
);
}
getLastAddedAlbums(month: number): Observable<TsBucket[]> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", "*");
queryParams = queryParams.append("sort_by", "Track ID:desc");
queryParams = queryParams.append("group_by", "Album");
// TODO Deal with mounth?
return this.http
.get(
this.tsUrl +
TsService.SONG_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => this.responseSubAggregationToBucket(res)),
catchError((error) =>
this.handleError(error, "getLastAddedAlbums(" + month + ")")
)
);
}
getArtistFromAlbumName(albumname: string): Observable<Album[]> {
let queryParams = new HttpParams();
queryParams = queryParams.append("q", albumname);
queryParams = queryParams.append("query_by", "Name");
return this.http
.get<any>(
this.tsUrl +
TsService.ALBUM_INDEX_NAME +
"/documents" +
TsService.ACTION_SEARCH,
{ headers: this.headers, params: queryParams }
)
.pipe(
map((res) => res.hits),
map((hits: Array<any>) => {
const result: Array<Album> = [];
hits.forEach((hit) => {
result.push(hit.document);
});
return result;
}),
catchError((error) =>
this.handleError(error, "getArtistFromAlbumName(" + albumname + ")")
)
);
}
getSuggest(text: string): Observable<Suggested[]> {
console.log("search sugget: " + text);
return this.http
.post<any>(
this.tsUrl + TsService.SUGGEST_INDEX_NAME + TsService.ACTION_SEARCH,
JSON.stringify({
_source: ["album", "artist"],
suggest: {
"album-suggest": {
prefix: text,
completion: {
field: "album_suggest",
},
},
"artist-suggest": {
prefix: text,
completion: {
field: "artist_suggest",
},
},
},
}),
{ headers: this.headers }
)
.pipe(
map((res) =>
this.responseSuggesterToSuggested(
res,
"album-suggest",
"artist-suggest"
)
),
catchError((error) =>
this.handleError(error, "getSuggest(" + text + ")")
)
);
}
/** Process a result to return just one result.
* Used to get an album or an artist.
* Take a name to put in console output if no result or more than one result.
*
* @param res Response to process
* @param name The searched name - for console output
*/
protected responseToOneTypedResult<T>(res: any, name: string): T {
const hits = res.hits;
if (hits.length < 1) {
console.info('No result found for name: "' + name);
return undefined;
}
if (hits.length > 1) {
// TODO Cumul results (for album)
console.error(
'More than one result for name: "' +
name +
'". Found (' +
hits.length +
"), return the first."
);
}
return hits[0].document;
}
/** Process a response to a array of songs.
*
* @param res Response to process
*/
protected responseToSongs(res: any): Song[] {
const result: Array<Song> = [];
res.hits.forEach((hit) => {
result.push(hit.document);
});
return result;
}
/** Process a response to a array of songs.
*
* @param res Response to process
*/
private responseToArtists(res: any): Artist[] {
const result: Array<Artist> = [];
res.hits.hits.forEach((hit) => {
result.push(hit._source);
});
return result;
}
/** Process an aggregation response to an array of Bucket.
*
* @param res Response to process
* @param name Name of aggregation
*/
protected responseAggregationToBucket(res: any): TsBucket[] {
const result: Array<TsBucket> = [];
res.facet_counts[0].counts.forEach((bucket) => {
result.push(bucket);
});
return result;
}
private responseSubAggregationToBucket(res: any): TsBucket[] {
const result: Array<TsBucket> = [];
res.grouped_hits.forEach((tmp) => {
result.push(tmp);
});
return result;
}
protected responseSuggesterToSuggested(
res: any,
...suggestName: string[]
): Suggested[] {
const result: Array<Suggested> = [];
suggestName.forEach((sname) => {
res["suggest"][sname][0]["options"].forEach((option) => {
let suggest = new Suggested();
// TODO If more than one key, raise exception
suggest.type = String(Object.keys(option["_source"]));
suggest.name = option["_source"][suggest.type];
result.push(suggest);
});
});
return result;
}
protected handleError(error: any, origin: string): Promise<any> {
console.error("An error occurred!");
console.error("Origin function: ", origin);
console.error("An error occurred!", error); // for demo purposes only
console.error(error); // for demo purposes only
return Promise.reject(error.message || error);
}
protected addSortFilterToQuery(query) {
query.query.bool.must_not.push({
term: {
"Location.tree": this.defaultLocation,
},
});
return query;
}
/** Process a response to a array of songs.
*
* @param res Response to process
*/
protected responseToAlbums(res: any): Album[] {
const result: Array<Album> = [];
res.hits.forEach((hit) => {
result.push(hit.document);
});
return result;
}
}

View File

@@ -1,66 +1,556 @@
{ {
"settings": { "name": "songs",
"analysis": { "token_separators": [":", "/", "."],
"analyzer": { "fields": [
"custom_path_tree": { "tokenizer": "custom_hierarchy" }, {
"custom_path_tree_reversed": { "tokenizer": "custom_hierarchy_reversed" } "facet": false,
}, "index": true,
"tokenizer": { "infix": false,
"custom_hierarchy": { "locale": "",
"type": "path_hierarchy", "name": "Album",
"delimiter": "/", "optional": true,
"skip": 3 "sort": false,
}, "type": "string"
"custom_hierarchy_reversed": { },
"type": "path_hierarchy", {
"delimiter": "/", "facet": false,
"reverse": "true" "index": true,
} "infix": false,
} "locale": "",
} "name": "Album Rating",
}, "optional": true,
"mappings" : { "sort": true,
"properties": { "type": "int64"
"Artist": { },
"type": "text", {
"fields": { "facet": false,
"raw": {"type": "keyword"} "index": true,
} "infix": false,
}, "locale": "",
"Album Artist": { "name": "Album Rating Computed",
"type": "text", "optional": true,
"fields": { "sort": true,
"raw": {"type": "keyword"} "type": "bool"
} },
}, {
"Album": { "facet": false,
"type": "text", "index": true,
"fields": { "infix": false,
"raw": {"type": "keyword"} "locale": "",
} "name": "Artist",
}, "optional": true,
"Bit Rate": { "sort": false,
"type": "integer" "type": "string"
}, },
"Genre": { {
"type": "keyword" "facet": false,
}, "index": true,
"Kind": { "infix": false,
"type": "keyword" "locale": "",
}, "name": "Artwork Count",
"Location": { "optional": true,
"type": "text", "sort": true,
"fields": { "type": "int64"
"tree": { },
"type": "text", {
"analyzer": "custom_path_tree" "facet": false,
}, "index": true,
"tree_reversed": { "infix": false,
"type": "text", "locale": "",
"analyzer": "custom_path_tree_reversed" "name": "Bit Rate",
} "optional": true,
} "sort": true,
} "type": "int64"
} },
} {
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Date Added",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Date Modified",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "File Folder Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "Genre",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Kind",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Library Folder Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Location",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Name",
"optional": false,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Persistent ID",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Play Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Play Date",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Play Date UTC",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Rating",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Rating Computed",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Sample Rate",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "Size",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Skip Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Skip Date",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "Total Time",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Track ID",
"optional": false,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Track Number",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Track Type",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Year",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Composer",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Disabled",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Disc Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Disc Number",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Album Artist",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Sort Name",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Sort Album",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Comments",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Sort Artist",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Sort Composer",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Loved",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Volume Adjustment",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Compilation",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Part Of Gapless Album",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Track Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Sort Album Artist",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Album Loved",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "BPM",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Grouping",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Series",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Purchased",
"optional": true,
"sort": true,
"type": "bool"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "Release Date",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Movement Count",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Movement Name",
"optional": true,
"sort": false,
"type": "string"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Movement Number",
"optional": true,
"sort": true,
"type": "int64"
},
{
"facet": false,
"index": false,
"infix": false,
"locale": "",
"name": "Work",
"optional": true,
"sort": false,
"type": "string"
}
]
} }