mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Fix HTML info decoding
This commit is contained in:
parent
8f08b12b69
commit
80f30aa41a
9 changed files with 67 additions and 34 deletions
|
|
@ -84,6 +84,8 @@ dependencies {
|
||||||
implementation 'com.tickaroo.tikxml:core:0.9.0_11-SNAPSHOT'
|
implementation 'com.tickaroo.tikxml:core:0.9.0_11-SNAPSHOT'
|
||||||
annotationProcessor 'com.tickaroo.tikxml:processor:0.9.0_11-SNAPSHOT'
|
annotationProcessor 'com.tickaroo.tikxml:processor:0.9.0_11-SNAPSHOT'
|
||||||
implementation 'com.tickaroo.tikxml:converter-date-rfc3339:0.9.0_11-SNAPSHOT'
|
implementation 'com.tickaroo.tikxml:converter-date-rfc3339:0.9.0_11-SNAPSHOT'
|
||||||
|
implementation 'com.tickaroo.tikxml:converter-htmlescape:0.9.0_11-SNAPSHOT'
|
||||||
|
|
||||||
|
|
||||||
// Database debugger via adb
|
// Database debugger via adb
|
||||||
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
|
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class ArtistHorizontalAdapter extends RecyclerView.Adapter<ArtistHorizont
|
||||||
Artist artist = artists.get(position);
|
Artist artist = artists.get(position);
|
||||||
|
|
||||||
holder.artistName.setText(artist.getName());
|
holder.artistName.setText(artist.getName());
|
||||||
holder.artistInfo.setText("--");
|
holder.artistInfo.setText("Album count: " + String.valueOf(artist.getAlbumCount()));
|
||||||
|
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(context, artist.getPrimary(), artist.getPrimaryBlurHash(), CustomGlideRequest.ARTIST_PIC)
|
.from(context, artist.getPrimary(), artist.getPrimaryBlurHash(), CustomGlideRequest.ARTIST_PIC)
|
||||||
|
|
|
||||||
|
|
@ -17,56 +17,32 @@ import java.util.List;
|
||||||
@Entity(tableName = "artist")
|
@Entity(tableName = "artist")
|
||||||
public class Artist implements Parcelable {
|
public class Artist implements Parcelable {
|
||||||
private static final String TAG = "Artist";
|
private static final String TAG = "Artist";
|
||||||
@Ignore
|
|
||||||
public List<Genre> genres;
|
public List<Genre> genres;
|
||||||
@Ignore
|
|
||||||
public List<Album> albums;
|
public List<Album> albums;
|
||||||
@Ignore
|
|
||||||
public List<Song> songs;
|
public List<Song> songs;
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@PrimaryKey
|
|
||||||
@ColumnInfo(name = "id")
|
|
||||||
public String id;
|
public String id;
|
||||||
|
|
||||||
@ColumnInfo(name = "name")
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
@ColumnInfo(name = "primary")
|
|
||||||
public String primary;
|
public String primary;
|
||||||
|
|
||||||
@ColumnInfo(name = "primary_blurHash")
|
|
||||||
public String primaryBlurHash;
|
public String primaryBlurHash;
|
||||||
|
|
||||||
@ColumnInfo(name = "backdrop")
|
|
||||||
public String backdrop;
|
public String backdrop;
|
||||||
|
|
||||||
@ColumnInfo(name = "backdrop_blurHash")
|
|
||||||
public String backdropBlurHash;
|
public String backdropBlurHash;
|
||||||
|
public int albumCount;
|
||||||
public Artist(@NonNull String id, String name, String primary, String primaryBlurHash, String backdrop, String backdropBlurHash) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.primary = primary;
|
|
||||||
this.primaryBlurHash = primaryBlurHash;
|
|
||||||
this.backdrop = backdrop;
|
|
||||||
this.backdropBlurHash = backdropBlurHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Artist(ArtistID3 artistID3) {
|
public Artist(ArtistID3 artistID3) {
|
||||||
this.id = artistID3.getId();
|
this.id = artistID3.getId();
|
||||||
this.name = artistID3.getName();
|
this.name = artistID3.getName();
|
||||||
this.primary = artistID3.getCoverArtId() != null ? artistID3.getCoverArtId() : artistID3.getId();
|
this.primary = artistID3.getCoverArtId() != null ? artistID3.getCoverArtId() : artistID3.getId();
|
||||||
this.backdrop = artistID3.getCoverArtId();
|
this.backdrop = artistID3.getCoverArtId();
|
||||||
|
this.albumCount = artistID3.getAlbumCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
public Artist(String id, String name) {
|
public Artist(String id, String name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
@ -115,6 +91,14 @@ public class Artist implements Parcelable {
|
||||||
this.backdropBlurHash = backdropBlurHash;
|
this.backdropBlurHash = backdropBlurHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAlbumCount() {
|
||||||
|
return albumCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlbumCount(int albumCount) {
|
||||||
|
this.albumCount = albumCount;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.cappielloantonio.play.subsonic.Subsonic;
|
import com.cappielloantonio.play.subsonic.Subsonic;
|
||||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||||
|
import com.tickaroo.tikxml.TikXml;
|
||||||
|
import com.tickaroo.tikxml.converter.htmlescape.HtmlEscapeStringConverter;
|
||||||
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -23,7 +25,7 @@ public class AlbumSongListClient {
|
||||||
|
|
||||||
this.retrofit = new Retrofit.Builder()
|
this.retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(subsonic.getUrl())
|
.baseUrl(subsonic.getUrl())
|
||||||
.addConverterFactory(TikXmlConverterFactory.create())
|
.addConverterFactory(TikXmlConverterFactory.create(getParser()))
|
||||||
.client(getOkHttpClient())
|
.client(getOkHttpClient())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -65,6 +67,12 @@ public class AlbumSongListClient {
|
||||||
return albumSongListService.getStarred2(subsonic.getParams());
|
return albumSongListService.getStarred2(subsonic.getParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TikXml getParser() {
|
||||||
|
return new TikXml.Builder()
|
||||||
|
.addTypeConverter(String.class, new HtmlEscapeStringConverter()) // HtmlEscapeStringConverter encode / decode html characters. This class ships as optional dependency
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
private OkHttpClient getOkHttpClient() {
|
private OkHttpClient getOkHttpClient() {
|
||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(getHttpLoggingInterceptor())
|
.addInterceptor(getHttpLoggingInterceptor())
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.cappielloantonio.play.subsonic.Subsonic;
|
import com.cappielloantonio.play.subsonic.Subsonic;
|
||||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||||
|
import com.tickaroo.tikxml.TikXml;
|
||||||
|
import com.tickaroo.tikxml.converter.htmlescape.HtmlEscapeStringConverter;
|
||||||
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -23,7 +25,7 @@ public class BrowsingClient {
|
||||||
|
|
||||||
this.retrofit = new Retrofit.Builder()
|
this.retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(subsonic.getUrl())
|
.baseUrl(subsonic.getUrl())
|
||||||
.addConverterFactory(TikXmlConverterFactory.create())
|
.addConverterFactory(TikXmlConverterFactory.create(getParser()))
|
||||||
.client(getOkHttpClient())
|
.client(getOkHttpClient())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -115,6 +117,12 @@ public class BrowsingClient {
|
||||||
return browsingService.getTopSongs(subsonic.getParams(), id, count);
|
return browsingService.getTopSongs(subsonic.getParams(), id, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TikXml getParser() {
|
||||||
|
return new TikXml.Builder()
|
||||||
|
.addTypeConverter(String.class, new HtmlEscapeStringConverter()) // HtmlEscapeStringConverter encode / decode html characters. This class ships as optional dependency
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
private OkHttpClient getOkHttpClient() {
|
private OkHttpClient getOkHttpClient() {
|
||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(getHttpLoggingInterceptor())
|
.addInterceptor(getHttpLoggingInterceptor())
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.cappielloantonio.play.subsonic.Subsonic;
|
import com.cappielloantonio.play.subsonic.Subsonic;
|
||||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||||
|
import com.tickaroo.tikxml.TikXml;
|
||||||
|
import com.tickaroo.tikxml.converter.htmlescape.HtmlEscapeStringConverter;
|
||||||
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -23,7 +25,7 @@ public class MediaRetrievalClient {
|
||||||
|
|
||||||
this.retrofit = new Retrofit.Builder()
|
this.retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(subsonic.getUrl())
|
.baseUrl(subsonic.getUrl())
|
||||||
.addConverterFactory(TikXmlConverterFactory.create())
|
.addConverterFactory(TikXmlConverterFactory.create(getParser()))
|
||||||
.client(getOkHttpClient())
|
.client(getOkHttpClient())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -40,6 +42,12 @@ public class MediaRetrievalClient {
|
||||||
return mediaRetrievalService.download(subsonic.getParams(), id);
|
return mediaRetrievalService.download(subsonic.getParams(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TikXml getParser() {
|
||||||
|
return new TikXml.Builder()
|
||||||
|
.addTypeConverter(String.class, new HtmlEscapeStringConverter()) // HtmlEscapeStringConverter encode / decode html characters. This class ships as optional dependency
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
private OkHttpClient getOkHttpClient() {
|
private OkHttpClient getOkHttpClient() {
|
||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(getHttpLoggingInterceptor())
|
.addInterceptor(getHttpLoggingInterceptor())
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.cappielloantonio.play.subsonic.Subsonic;
|
import com.cappielloantonio.play.subsonic.Subsonic;
|
||||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||||
|
import com.tickaroo.tikxml.TikXml;
|
||||||
|
import com.tickaroo.tikxml.converter.htmlescape.HtmlEscapeStringConverter;
|
||||||
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -23,7 +25,7 @@ public class PlaylistClient {
|
||||||
|
|
||||||
this.retrofit = new Retrofit.Builder()
|
this.retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(subsonic.getUrl())
|
.baseUrl(subsonic.getUrl())
|
||||||
.addConverterFactory(TikXmlConverterFactory.create())
|
.addConverterFactory(TikXmlConverterFactory.create(getParser()))
|
||||||
.client(getOkHttpClient())
|
.client(getOkHttpClient())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -40,6 +42,12 @@ public class PlaylistClient {
|
||||||
return playlistService.getPlaylist(subsonic.getParams(), id);
|
return playlistService.getPlaylist(subsonic.getParams(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TikXml getParser() {
|
||||||
|
return new TikXml.Builder()
|
||||||
|
.addTypeConverter(String.class, new HtmlEscapeStringConverter()) // HtmlEscapeStringConverter encode / decode html characters. This class ships as optional dependency
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
private OkHttpClient getOkHttpClient() {
|
private OkHttpClient getOkHttpClient() {
|
||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(getHttpLoggingInterceptor())
|
.addInterceptor(getHttpLoggingInterceptor())
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.cappielloantonio.play.subsonic.Subsonic;
|
import com.cappielloantonio.play.subsonic.Subsonic;
|
||||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||||
|
import com.tickaroo.tikxml.TikXml;
|
||||||
|
import com.tickaroo.tikxml.converter.htmlescape.HtmlEscapeStringConverter;
|
||||||
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -23,7 +25,7 @@ public class SearchingClient {
|
||||||
|
|
||||||
this.retrofit = new Retrofit.Builder()
|
this.retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(subsonic.getUrl())
|
.baseUrl(subsonic.getUrl())
|
||||||
.addConverterFactory(TikXmlConverterFactory.create())
|
.addConverterFactory(TikXmlConverterFactory.create(getParser()))
|
||||||
.client(getOkHttpClient())
|
.client(getOkHttpClient())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -40,6 +42,12 @@ public class SearchingClient {
|
||||||
return searchingService.search3(subsonic.getParams(), query);
|
return searchingService.search3(subsonic.getParams(), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TikXml getParser() {
|
||||||
|
return new TikXml.Builder()
|
||||||
|
.addTypeConverter(String.class, new HtmlEscapeStringConverter()) // HtmlEscapeStringConverter encode / decode html characters. This class ships as optional dependency
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
private OkHttpClient getOkHttpClient() {
|
private OkHttpClient getOkHttpClient() {
|
||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(getHttpLoggingInterceptor())
|
.addInterceptor(getHttpLoggingInterceptor())
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import android.util.Log;
|
||||||
import com.cappielloantonio.play.subsonic.Subsonic;
|
import com.cappielloantonio.play.subsonic.Subsonic;
|
||||||
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
|
||||||
import com.tickaroo.tikxml.TikXml;
|
import com.tickaroo.tikxml.TikXml;
|
||||||
|
import com.tickaroo.tikxml.converter.htmlescape.HtmlEscapeStringConverter;
|
||||||
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
@ -24,7 +25,7 @@ public class SystemClient {
|
||||||
|
|
||||||
this.retrofit = new Retrofit.Builder()
|
this.retrofit = new Retrofit.Builder()
|
||||||
.baseUrl(subsonic.getUrl())
|
.baseUrl(subsonic.getUrl())
|
||||||
.addConverterFactory(TikXmlConverterFactory.create())
|
.addConverterFactory(TikXmlConverterFactory.create(getParser()))
|
||||||
.client(getOkHttpClient())
|
.client(getOkHttpClient())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
@ -41,6 +42,12 @@ public class SystemClient {
|
||||||
return systemService.getLicense(subsonic.getParams());
|
return systemService.getLicense(subsonic.getParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TikXml getParser() {
|
||||||
|
return new TikXml.Builder()
|
||||||
|
.addTypeConverter(String.class, new HtmlEscapeStringConverter()) // HtmlEscapeStringConverter encode / decode html characters. This class ships as optional dependency
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
private OkHttpClient getOkHttpClient() {
|
private OkHttpClient getOkHttpClient() {
|
||||||
return new OkHttpClient.Builder()
|
return new OkHttpClient.Builder()
|
||||||
.addInterceptor(getHttpLoggingInterceptor())
|
.addInterceptor(getHttpLoggingInterceptor())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue