- Removed middle layer of abstraction for subsonic classes

- Used kotlin for classes
This commit is contained in:
antonio 2023-03-06 21:59:10 +01:00
parent 917c0839de
commit ca15f51c85
168 changed files with 2026 additions and 6588 deletions

View file

@ -1,9 +1,8 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" /> <option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,okhttp3.Interceptor.Chain,proceed" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool> </inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false"> <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" /> <option name="processCode" value="true" />

View file

@ -9,13 +9,14 @@ import androidx.preference.PreferenceManager;
import com.cappielloantonio.play.helper.ThemeHelper; import com.cappielloantonio.play.helper.ThemeHelper;
import com.cappielloantonio.play.subsonic.Subsonic; import com.cappielloantonio.play.subsonic.Subsonic;
import com.cappielloantonio.play.subsonic.SubsonicPreferences; import com.cappielloantonio.play.subsonic.SubsonicPreferences;
import com.cappielloantonio.play.util.PreferenceUtil; import com.cappielloantonio.play.util.Constants;
import com.cappielloantonio.play.util.Preferences;
import com.google.android.material.color.DynamicColors; import com.google.android.material.color.DynamicColors;
public class App extends Application { public class App extends Application {
private static final String TAG = "App";
private static App instance; private static App instance;
private static Subsonic subsonic; private static Subsonic subsonic;
private static SharedPreferences preferences;
@Override @Override
public void onCreate() { public void onCreate() {
@ -23,8 +24,10 @@ public class App extends Application {
DynamicColors.applyToActivitiesIfAvailable(this); DynamicColors.applyToActivitiesIfAvailable(this);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String themePref = sharedPreferences.getString(PreferenceUtil.THEME, ThemeHelper.DEFAULT_MODE); String themePref = sharedPreferences.getString(Preferences.THEME, ThemeHelper.DEFAULT_MODE);
ThemeHelper.applyTheme(themePref); ThemeHelper.applyTheme(themePref);
preferences = getSharedPreferences(Constants.SHARED_PREF_KEY, Context.MODE_PRIVATE);
} }
public static App getInstance() { public static App getInstance() {
@ -41,13 +44,21 @@ public class App extends Application {
return subsonic; return subsonic;
} }
public SharedPreferences getPreferences() {
if (preferences == null) {
preferences = getSharedPreferences(Constants.SHARED_PREF_KEY, Context.MODE_PRIVATE);
}
return preferences;
}
private static Subsonic getSubsonicClient(Context context) { private static Subsonic getSubsonicClient(Context context) {
String server = PreferenceUtil.getInstance(context).getServer(); String server = Preferences.getServer();
String username = PreferenceUtil.getInstance(context).getUser(); String username = Preferences.getUser();
String password = PreferenceUtil.getInstance(context).getPassword(); String password = Preferences.getPassword();
String token = PreferenceUtil.getInstance(context).getToken(); String token = Preferences.getToken();
String salt = PreferenceUtil.getInstance(context).getSalt(); String salt = Preferences.getSalt();
boolean isLowSecurity = PreferenceUtil.getInstance(context).isLowScurity(); boolean isLowSecurity = Preferences.isLowScurity();
SubsonicPreferences preferences = new SubsonicPreferences(); SubsonicPreferences preferences = new SubsonicPreferences();
preferences.setServerUrl(server); preferences.setServerUrl(server);
@ -55,9 +66,12 @@ public class App extends Application {
preferences.setAuthentication(password, token, salt, isLowSecurity); preferences.setAuthentication(password, token, salt, isLowSecurity);
if (preferences.getAuthentication() != null) { if (preferences.getAuthentication() != null) {
if (preferences.getAuthentication().getPassword() != null) PreferenceUtil.getInstance(context).setPassword(preferences.getAuthentication().getPassword()); if (preferences.getAuthentication().getPassword() != null)
if (preferences.getAuthentication().getToken() != null) PreferenceUtil.getInstance(context).setToken(preferences.getAuthentication().getToken()); Preferences.setPassword(preferences.getAuthentication().getPassword());
if (preferences.getAuthentication().getSalt() != null) PreferenceUtil.getInstance(context).setSalt(preferences.getAuthentication().getSalt()); if (preferences.getAuthentication().getToken() != null)
Preferences.setToken(preferences.getAuthentication().getToken());
if (preferences.getAuthentication().getSalt() != null)
Preferences.setSalt(preferences.getAuthentication().getSalt());
} }
return new Subsonic(context, preferences); return new Subsonic(context, preferences);

View file

@ -16,10 +16,9 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Album; import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -27,7 +26,7 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Album> albums; private List<AlbumID3> albums;
public AlbumAdapter(Context context, ClickCallback click) { public AlbumAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -44,13 +43,13 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Album album = albums.get(position); AlbumID3 album = albums.get(position);
holder.textAlbumName.setText(MusicUtil.getReadableString(album.getTitle())); holder.textAlbumName.setText(MusicUtil.getReadableString(album.getName()));
holder.textArtistName.setText(MusicUtil.getReadableString(album.getArtistName())); holder.textArtistName.setText(MusicUtil.getReadableString(album.getArtist()));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, album.getPrimary(), CustomGlideRequest.ALBUM_PIC, null) .from(context, album.getCoverArtId(), CustomGlideRequest.ALBUM_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(holder.cover); .into(holder.cover);
@ -61,11 +60,11 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
return albums.size(); return albums.size();
} }
public Album getItem(int position) { public AlbumID3 getItem(int position) {
return albums.get(position); return albums.get(position);
} }
public void setItems(List<Album> albums) { public void setItems(List<AlbumID3> albums) {
this.albums = albums; this.albums = albums;
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -16,7 +16,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Album; import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -26,7 +26,7 @@ public class AlbumArtistPageOrSimilarAdapter extends RecyclerView.Adapter<AlbumA
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Album> albums; private List<AlbumID3> albums;
public AlbumArtistPageOrSimilarAdapter(Context context, ClickCallback click) { public AlbumArtistPageOrSimilarAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -43,13 +43,13 @@ public class AlbumArtistPageOrSimilarAdapter extends RecyclerView.Adapter<AlbumA
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Album album = albums.get(position); AlbumID3 album = albums.get(position);
holder.textAlbumName.setText(MusicUtil.getReadableString(album.getTitle())); holder.textAlbumName.setText(MusicUtil.getReadableString(album.getName()));
holder.textArtistName.setText(MusicUtil.getReadableString(album.getArtistName())); holder.textArtistName.setText(MusicUtil.getReadableString(album.getArtist()));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, album.getPrimary(), CustomGlideRequest.ALBUM_PIC, null) .from(context, album.getCoverArtId(), CustomGlideRequest.ALBUM_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(holder.cover); .into(holder.cover);
@ -60,11 +60,11 @@ public class AlbumArtistPageOrSimilarAdapter extends RecyclerView.Adapter<AlbumA
return albums.size(); return albums.size();
} }
public Album getItem(int position) { public AlbumID3 getItem(int position) {
return albums.get(position); return albums.get(position);
} }
public void setItems(List<Album> albums) { public void setItems(List<AlbumID3> albums) {
this.albums = albums; this.albums = albums;
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -19,6 +19,7 @@ import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Album; import com.cappielloantonio.play.model.Album;
import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -32,15 +33,15 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
private final Filter filtering = new Filter() { private final Filter filtering = new Filter() {
@Override @Override
protected FilterResults performFiltering(CharSequence constraint) { protected FilterResults performFiltering(CharSequence constraint) {
List<Album> filteredList = new ArrayList<>(); List<AlbumID3> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) { if (constraint == null || constraint.length() == 0) {
filteredList.addAll(albumsFull); filteredList.addAll(albumsFull);
} else { } else {
String filterPattern = constraint.toString().toLowerCase().trim(); String filterPattern = constraint.toString().toLowerCase().trim();
for (Album item : albumsFull) { for (AlbumID3 item : albumsFull) {
if (item.getTitle().toLowerCase().contains(filterPattern)) { if (item.getName().toLowerCase().contains(filterPattern)) {
filteredList.add(item); filteredList.add(item);
} }
} }
@ -60,8 +61,8 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
} }
}; };
private List<Album> albums; private List<AlbumID3> albums;
private List<Album> albumsFull; private List<AlbumID3> albumsFull;
public AlbumCatalogueAdapter(Context context, ClickCallback click) { public AlbumCatalogueAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -78,13 +79,13 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Album album = albums.get(position); AlbumID3 album = albums.get(position);
holder.textAlbumName.setText(MusicUtil.getReadableString(album.getTitle())); holder.textAlbumName.setText(MusicUtil.getReadableString(album.getName()));
holder.textArtistName.setText(MusicUtil.getReadableString(album.getArtistName())); holder.textArtistName.setText(MusicUtil.getReadableString(album.getArtist()));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, album.getPrimary(), CustomGlideRequest.ALBUM_PIC, null) .from(context, album.getCoverArtId(), CustomGlideRequest.ALBUM_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(holder.cover); .into(holder.cover);
@ -95,11 +96,11 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
return albums.size(); return albums.size();
} }
public Album getItem(int position) { public AlbumID3 getItem(int position) {
return albums.get(position); return albums.get(position);
} }
public void setItems(List<Album> albums) { public void setItems(List<AlbumID3> albums) {
this.albums = albums; this.albums = albums;
this.albumsFull = new ArrayList<>(albums); this.albumsFull = new ArrayList<>(albums);
notifyDataSetChanged(); notifyDataSetChanged();
@ -160,13 +161,13 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
public void sort(String order) { public void sort(String order) {
switch (order) { switch (order) {
case Album.ORDER_BY_NAME: case Album.ORDER_BY_NAME:
albums.sort(Comparator.comparing(Album::getTitle)); albums.sort(Comparator.comparing(AlbumID3::getName));
break; break;
case Album.ORDER_BY_ARTIST: case Album.ORDER_BY_ARTIST:
albums.sort(Comparator.comparing(Album::getArtistName)); albums.sort(Comparator.comparing(AlbumID3::getArtist));
break; break;
case Album.ORDER_BY_YEAR: case Album.ORDER_BY_YEAR:
albums.sort(Comparator.comparing(Album::getYear)); albums.sort(Comparator.comparing(AlbumID3::getYear));
break; break;
case Album.ORDER_BY_RANDOM: case Album.ORDER_BY_RANDOM:
Collections.shuffle(albums); Collections.shuffle(albums);

View file

@ -16,7 +16,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Album; import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -27,7 +27,7 @@ public class AlbumHorizontalAdapter extends RecyclerView.Adapter<AlbumHorizontal
private final ClickCallback click; private final ClickCallback click;
private final boolean isOffline; private final boolean isOffline;
private List<Album> albums; private List<AlbumID3> albums;
public AlbumHorizontalAdapter(Context context, ClickCallback click, boolean isOffline) { public AlbumHorizontalAdapter(Context context, ClickCallback click, boolean isOffline) {
this.context = context; this.context = context;
@ -45,13 +45,13 @@ public class AlbumHorizontalAdapter extends RecyclerView.Adapter<AlbumHorizontal
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Album album = albums.get(position); AlbumID3 album = albums.get(position);
holder.albumTitle.setText(MusicUtil.getReadableString(album.getTitle())); holder.albumTitle.setText(MusicUtil.getReadableString(album.getName()));
holder.albumArtist.setText(MusicUtil.getReadableString(album.getArtistName())); holder.albumArtist.setText(MusicUtil.getReadableString(album.getArtist()));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, album.getPrimary(), CustomGlideRequest.ALBUM_PIC, null) .from(context, album.getCoverArtId(), CustomGlideRequest.ALBUM_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(holder.cover); .into(holder.cover);
@ -62,12 +62,12 @@ public class AlbumHorizontalAdapter extends RecyclerView.Adapter<AlbumHorizontal
return albums.size(); return albums.size();
} }
public void setItems(List<Album> albums) { public void setItems(List<AlbumID3> albums) {
this.albums = albums; this.albums = albums;
notifyDataSetChanged(); notifyDataSetChanged();
} }
public Album getItem(int id) { public AlbumID3 getItem(int id) {
return albums.get(id); return albums.get(id);
} }

View file

@ -9,28 +9,19 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.session.MediaBrowser;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Artist; import com.cappielloantonio.play.subsonic.models.ArtistID3;
import com.cappielloantonio.play.repository.ArtistRepository;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
@UnstableApi @UnstableApi
public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder> { public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder> {
@ -39,7 +30,7 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
private final boolean mix; private final boolean mix;
private final boolean bestOf; private final boolean bestOf;
private List<Artist> artists; private List<ArtistID3> artists;
public ArtistAdapter(Context context, ClickCallback click, Boolean mix, Boolean bestOf) { public ArtistAdapter(Context context, ClickCallback click, Boolean mix, Boolean bestOf) {
this.context = context; this.context = context;
@ -58,7 +49,7 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Artist artist = artists.get(position); ArtistID3 artist = artists.get(position);
holder.textArtistName.setText(MusicUtil.getReadableString(artist.getName())); holder.textArtistName.setText(MusicUtil.getReadableString(artist.getName()));
@ -70,11 +61,11 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
return artists.size(); return artists.size();
} }
public Artist getItem(int position) { public ArtistID3 getItem(int position) {
return artists.get(position); return artists.get(position);
} }
public void setItems(List<Artist> artists) { public void setItems(List<ArtistID3> artists) {
this.artists = artists; this.artists = artists;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@ -89,9 +80,9 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
return position; return position;
} }
private void setArtistCover(Artist artist, ImageView cover) { private void setArtistCover(ArtistID3 artist, ImageView cover) {
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, artist.getPrimary(), CustomGlideRequest.ARTIST_PIC, null) .from(context, artist.getCoverArtId(), CustomGlideRequest.ARTIST_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(cover); .into(cover);

View file

@ -11,18 +11,15 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Artist; import com.cappielloantonio.play.model.Artist;
import com.cappielloantonio.play.repository.ArtistRepository; import com.cappielloantonio.play.subsonic.models.ArtistID3;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -37,14 +34,14 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
private final Filter filtering = new Filter() { private final Filter filtering = new Filter() {
@Override @Override
protected FilterResults performFiltering(CharSequence constraint) { protected FilterResults performFiltering(CharSequence constraint) {
List<Artist> filteredList = new ArrayList<>(); List<ArtistID3> filteredList = new ArrayList<>();
if (constraint == null || constraint.length() == 0) { if (constraint == null || constraint.length() == 0) {
filteredList.addAll(artistFull); filteredList.addAll(artistFull);
} else { } else {
String filterPattern = constraint.toString().toLowerCase().trim(); String filterPattern = constraint.toString().toLowerCase().trim();
for (Artist item : artistFull) { for (ArtistID3 item : artistFull) {
if (item.getName().toLowerCase().contains(filterPattern)) { if (item.getName().toLowerCase().contains(filterPattern)) {
filteredList.add(item); filteredList.add(item);
} }
@ -65,8 +62,8 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
} }
}; };
private List<Artist> artists; private List<ArtistID3> artists;
private List<Artist> artistFull; private List<ArtistID3> artistFull;
public ArtistCatalogueAdapter(Context context, ClickCallback click) { public ArtistCatalogueAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -83,7 +80,7 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Artist artist = artists.get(position); ArtistID3 artist = artists.get(position);
holder.textArtistName.setText(MusicUtil.getReadableString(artist.getName())); holder.textArtistName.setText(MusicUtil.getReadableString(artist.getName()));
@ -95,11 +92,11 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
return artists.size(); return artists.size();
} }
public Artist getItem(int position) { public ArtistID3 getItem(int position) {
return artists.get(position); return artists.get(position);
} }
public void setItems(List<Artist> artists) { public void setItems(List<ArtistID3> artists) {
this.artists = artists; this.artists = artists;
this.artistFull = new ArrayList<>(artists); this.artistFull = new ArrayList<>(artists);
notifyDataSetChanged(); notifyDataSetChanged();
@ -120,9 +117,9 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
return filtering; return filtering;
} }
private void setArtistCover(Artist artist, ImageView cover) { private void setArtistCover(ArtistID3 artist, ImageView cover) {
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, artist.getPrimary(), CustomGlideRequest.ARTIST_PIC, null) .from(context, artist.getCoverArtId(), CustomGlideRequest.ARTIST_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(cover); .into(cover);
@ -164,7 +161,7 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
public void sort(String order) { public void sort(String order) {
switch (order) { switch (order) {
case Artist.ORDER_BY_NAME: case Artist.ORDER_BY_NAME:
artists.sort(Comparator.comparing(Artist::getName)); artists.sort(Comparator.comparing(ArtistID3::getName));
break; break;
case Artist.ORDER_BY_RANDOM: case Artist.ORDER_BY_RANDOM:
Collections.shuffle(artists); Collections.shuffle(artists);

View file

@ -9,18 +9,14 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Artist; import com.cappielloantonio.play.subsonic.models.ArtistID3;
import com.cappielloantonio.play.repository.ArtistRepository;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -30,7 +26,7 @@ public class ArtistHorizontalAdapter extends RecyclerView.Adapter<ArtistHorizont
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Artist> artists; private List<ArtistID3> artists;
public ArtistHorizontalAdapter(Context context, ClickCallback click) { public ArtistHorizontalAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -47,7 +43,7 @@ public class ArtistHorizontalAdapter extends RecyclerView.Adapter<ArtistHorizont
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Artist artist = artists.get(position); ArtistID3 artist = artists.get(position);
holder.artistName.setText(MusicUtil.getReadableString(artist.getName())); holder.artistName.setText(MusicUtil.getReadableString(artist.getName()));
@ -65,12 +61,12 @@ public class ArtistHorizontalAdapter extends RecyclerView.Adapter<ArtistHorizont
return artists.size(); return artists.size();
} }
public void setItems(List<Artist> artists) { public void setItems(List<ArtistID3> artists) {
this.artists = artists; this.artists = artists;
notifyDataSetChanged(); notifyDataSetChanged();
} }
public Artist getItem(int id) { public ArtistID3 getItem(int id) {
return artists.get(id); return artists.get(id);
} }
@ -84,9 +80,9 @@ public class ArtistHorizontalAdapter extends RecyclerView.Adapter<ArtistHorizont
return position; return position;
} }
private void setArtistCover(Artist artist, ImageView cover) { private void setArtistCover(ArtistID3 artist, ImageView cover) {
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, artist.getPrimary(), CustomGlideRequest.ARTIST_PIC, null) .from(context, artist.getCoverArtId(), CustomGlideRequest.ARTIST_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(cover); .into(cover);

View file

@ -9,23 +9,17 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.navigation.Navigation; import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Artist; import com.cappielloantonio.play.subsonic.models.SimilarArtistID3;
import com.cappielloantonio.play.repository.ArtistRepository;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -33,7 +27,7 @@ public class ArtistSimilarAdapter extends RecyclerView.Adapter<ArtistSimilarAdap
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Artist> artists; private List<SimilarArtistID3> artists;
public ArtistSimilarAdapter(Context context, ClickCallback click) { public ArtistSimilarAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -50,7 +44,7 @@ public class ArtistSimilarAdapter extends RecyclerView.Adapter<ArtistSimilarAdap
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Artist artist = artists.get(position); SimilarArtistID3 artist = artists.get(position);
holder.textArtistName.setText(MusicUtil.getReadableString(artist.getName())); holder.textArtistName.setText(MusicUtil.getReadableString(artist.getName()));
@ -62,11 +56,11 @@ public class ArtistSimilarAdapter extends RecyclerView.Adapter<ArtistSimilarAdap
return artists.size(); return artists.size();
} }
public Artist getItem(int position) { public SimilarArtistID3 getItem(int position) {
return artists.get(position); return artists.get(position);
} }
public void setItems(List<Artist> artists) { public void setItems(List<SimilarArtistID3> artists) {
this.artists = artists; this.artists = artists;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@ -81,9 +75,9 @@ public class ArtistSimilarAdapter extends RecyclerView.Adapter<ArtistSimilarAdap
return position; return position;
} }
private void setArtistCover(Artist artist, ImageView cover) { private void setArtistCover(SimilarArtistID3 artist, ImageView cover) {
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, artist.getPrimary(), CustomGlideRequest.ARTIST_PIC, null) .from(context, artist.getCoverArtId(), CustomGlideRequest.ARTIST_PIC, null)
.build() .build()
.transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS)) .transform(new CenterCrop(), new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
.into(cover); .into(cover);

View file

@ -15,7 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -25,7 +25,7 @@ public class DiscoverSongAdapter extends RecyclerView.Adapter<DiscoverSongAdapte
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Media> songs; private List<Child> songs;
public DiscoverSongAdapter(Context context, ClickCallback click) { public DiscoverSongAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -42,10 +42,10 @@ public class DiscoverSongAdapter extends RecyclerView.Adapter<DiscoverSongAdapte
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Media song = songs.get(position); Child song = songs.get(position);
holder.textTitle.setText(MusicUtil.getReadableString(song.getTitle())); holder.textTitle.setText(MusicUtil.getReadableString(song.getTitle()));
holder.textAlbum.setText(MusicUtil.getReadableString(song.getAlbumName())); holder.textAlbum.setText(MusicUtil.getReadableString(song.getAlbum()));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null) .from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null)
@ -64,7 +64,7 @@ public class DiscoverSongAdapter extends RecyclerView.Adapter<DiscoverSongAdapte
return songs.size(); return songs.size();
} }
public void setItems(List<Media> songs) { public void setItems(List<Child> songs) {
this.songs = songs; this.songs = songs;
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -12,8 +12,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Genre;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.subsonic.models.Genre;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -42,7 +42,7 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Genre genre = genres.get(position); Genre genre = genres.get(position);
holder.textGenre.setText(MusicUtil.getReadableString(genre.getName())); holder.textGenre.setText(MusicUtil.getReadableString(genre.getGenre()));
} }
@Override @Override

View file

@ -14,9 +14,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Genre;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.ui.activity.MainActivity; import com.cappielloantonio.play.subsonic.models.Genre;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -39,7 +38,7 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
String filterPattern = constraint.toString().toLowerCase().trim(); String filterPattern = constraint.toString().toLowerCase().trim();
for (Genre item : genresFull) { for (Genre item : genresFull) {
if (item.getName().toLowerCase().contains(filterPattern)) { if (item.getGenre().toLowerCase().contains(filterPattern)) {
filteredList.add(item); filteredList.add(item);
} }
} }
@ -79,7 +78,7 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Genre genre = genres.get(position); Genre genre = genres.get(position);
holder.textGenre.setText(MusicUtil.getReadableString(genre.getName())); holder.textGenre.setText(MusicUtil.getReadableString(genre.getGenre()));
} }
@Override @Override
@ -122,10 +121,10 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
public void sort(String order) { public void sort(String order) {
switch (order) { switch (order) {
case Genre.ORDER_BY_NAME: case com.cappielloantonio.play.model.Genre.ORDER_BY_NAME:
genres.sort(Comparator.comparing(Genre::getName)); genres.sort(Comparator.comparing(Genre::getGenre));
break; break;
case Genre.ORDER_BY_RANDOM: case com.cappielloantonio.play.model.Genre.ORDER_BY_RANDOM:
Collections.shuffle(genres); Collections.shuffle(genres);
break; break;
} }

View file

@ -17,8 +17,8 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.service.MediaManager; import com.cappielloantonio.play.service.MediaManager;
import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -31,7 +31,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
private final ClickCallback click; private final ClickCallback click;
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture; private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
private List<Media> songs; private List<Child> songs;
public PlayerSongQueueAdapter(Context context, ClickCallback click) { public PlayerSongQueueAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -48,10 +48,10 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Media song = songs.get(position); Child song = songs.get(position);
holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle())); holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle()));
holder.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtistName()), MusicUtil.getReadableDurationString(song.getDuration(), false))); holder.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtist()), MusicUtil.getReadableDurationString(song.getDuration(), false)));
CustomGlideRequest.Builder CustomGlideRequest.Builder
.from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null) .from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null)
@ -69,11 +69,11 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
return songs.size(); return songs.size();
} }
public List<Media> getItems() { public List<Child> getItems() {
return this.songs; return this.songs;
} }
public void setItems(List<Media> songs) { public void setItems(List<Child> songs) {
this.songs = songs; this.songs = songs;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@ -82,7 +82,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
this.mediaBrowserListenableFuture = mediaBrowserListenableFuture; this.mediaBrowserListenableFuture = mediaBrowserListenableFuture;
} }
public Media getItem(int id) { public Child getItem(int id) {
return songs.get(id); return songs.get(id);
} }

View file

@ -12,12 +12,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Playlist; import com.cappielloantonio.play.subsonic.models.Playlist;
import com.cappielloantonio.play.ui.dialog.PlaylistChooserDialog;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import com.cappielloantonio.play.viewmodel.PlaylistChooserViewModel;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -27,7 +24,7 @@ public class PlaylistDialogHorizontalAdapter extends RecyclerView.Adapter<Playli
private List<Playlist> playlists; private List<Playlist> playlists;
public PlaylistDialogHorizontalAdapter(Context context,ClickCallback click) { public PlaylistDialogHorizontalAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
this.click = click; this.click = click;
this.playlists = Collections.emptyList(); this.playlists = Collections.emptyList();

View file

@ -14,7 +14,7 @@ import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -23,7 +23,7 @@ import java.util.List;
public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<PlaylistDialogSongHorizontalAdapter.ViewHolder> { public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<PlaylistDialogSongHorizontalAdapter.ViewHolder> {
private final Context context; private final Context context;
private List<Media> songs; private List<Child> songs;
public PlaylistDialogSongHorizontalAdapter(Context context) { public PlaylistDialogSongHorizontalAdapter(Context context) {
this.context = context; this.context = context;
@ -39,10 +39,10 @@ public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<Pl
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Media song = songs.get(position); Child song = songs.get(position);
holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle())); holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle()));
holder.songArtist.setText(MusicUtil.getReadableString(song.getArtistName())); holder.songArtist.setText(MusicUtil.getReadableString(song.getArtist()));
holder.songDuration.setText(MusicUtil.getReadableDurationString(song.getDuration(), false)); holder.songDuration.setText(MusicUtil.getReadableDurationString(song.getDuration(), false));
CustomGlideRequest.Builder CustomGlideRequest.Builder
@ -57,16 +57,16 @@ public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<Pl
return songs.size(); return songs.size();
} }
public List<Media> getItems() { public List<Child> getItems() {
return this.songs; return this.songs;
} }
public void setItems(List<Media> songs) { public void setItems(List<Child> songs) {
this.songs = songs; this.songs = songs;
notifyDataSetChanged(); notifyDataSetChanged();
} }
public Media getItem(int id) { public Child getItem(int id) {
return songs.get(id); return songs.get(id);
} }

View file

@ -14,7 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Playlist; import com.cappielloantonio.play.subsonic.models.Playlist;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -139,10 +139,10 @@ public class PlaylistHorizontalAdapter extends RecyclerView.Adapter<PlaylistHori
public void sort(String order) { public void sort(String order) {
switch (order) { switch (order) {
case Playlist.ORDER_BY_NAME: case com.cappielloantonio.play.model.Playlist.ORDER_BY_NAME:
playlists.sort(Comparator.comparing(Playlist::getName)); playlists.sort(Comparator.comparing(Playlist::getName));
break; break;
case Playlist.ORDER_BY_RANDOM: case com.cappielloantonio.play.model.Playlist.ORDER_BY_RANDOM:
Collections.shuffle(playlists); Collections.shuffle(playlists);
break; break;
} }

View file

@ -17,7 +17,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.PodcastEpisode;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -28,7 +28,7 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Media> podcastEpisodes; private List<PodcastEpisode> podcastEpisodes;
public PodcastEpisodeAdapter(Context context, ClickCallback click) { public PodcastEpisodeAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -45,11 +45,11 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Media podcastEpisode = podcastEpisodes.get(position); PodcastEpisode podcastEpisode = podcastEpisodes.get(position);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM d"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM d");
holder.textTitle.setText(MusicUtil.getReadableString(podcastEpisode.getTitle())); holder.textTitle.setText(MusicUtil.getReadableString(podcastEpisode.getTitle()));
holder.textSubtitle.setText(MusicUtil.getReadableString(podcastEpisode.getArtistName())); holder.textSubtitle.setText(MusicUtil.getReadableString(podcastEpisode.getArtist()));
holder.textReleaseAndDuration.setText(context.getString(R.string.podcast_release_date_duration_formatter, simpleDateFormat.format(podcastEpisode.getPublishDate()), MusicUtil.getReadablePodcastDurationString(podcastEpisode.getDuration()))); holder.textReleaseAndDuration.setText(context.getString(R.string.podcast_release_date_duration_formatter, simpleDateFormat.format(podcastEpisode.getPublishDate()), MusicUtil.getReadablePodcastDurationString(podcastEpisode.getDuration())));
holder.textDescription.setText(MusicUtil.getReadableString(podcastEpisode.getDescription())); holder.textDescription.setText(MusicUtil.getReadableString(podcastEpisode.getDescription()));
@ -65,7 +65,7 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
return podcastEpisodes.size(); return podcastEpisodes.size();
} }
public void setItems(List<Media> podcastEpisodes) { public void setItems(List<PodcastEpisode> podcastEpisodes) {
this.podcastEpisodes = podcastEpisodes; this.podcastEpisodes = podcastEpisodes;
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -16,8 +16,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import java.util.Collections; import java.util.Collections;
@ -27,7 +26,7 @@ public class SimilarTrackAdapter extends RecyclerView.Adapter<SimilarTrackAdapte
private final Context context; private final Context context;
private final ClickCallback click; private final ClickCallback click;
private List<Media> songs; private List<Child> songs;
public SimilarTrackAdapter(Context context, ClickCallback click) { public SimilarTrackAdapter(Context context, ClickCallback click) {
this.context = context; this.context = context;
@ -44,7 +43,7 @@ public class SimilarTrackAdapter extends RecyclerView.Adapter<SimilarTrackAdapte
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Media song = songs.get(position); Child song = songs.get(position);
holder.textTitle.setText(MusicUtil.getReadableString(song.getTitle())); holder.textTitle.setText(MusicUtil.getReadableString(song.getTitle()));
@ -60,11 +59,11 @@ public class SimilarTrackAdapter extends RecyclerView.Adapter<SimilarTrackAdapte
return songs.size(); return songs.size();
} }
public Media getItem(int position) { public Child getItem(int position) {
return songs.get(position); return songs.get(position);
} }
public void setItems(List<Media> songs) { public void setItems(List<Child> songs) {
this.songs = songs; this.songs = songs;
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -10,8 +10,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.session.MediaBrowser;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CenterCrop;
@ -19,13 +17,8 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest; import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback; import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.service.MediaManager;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.util.DownloadUtil;
import com.cappielloantonio.play.util.MappingUtil;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -37,7 +30,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
private final ClickCallback click; private final ClickCallback click;
private final boolean isCoverVisible; private final boolean isCoverVisible;
private List<Media> songs; private List<Child> songs;
public SongHorizontalAdapter(Context context, ClickCallback click, boolean isCoverVisible) { public SongHorizontalAdapter(Context context, ClickCallback click, boolean isCoverVisible) {
this.context = context; this.context = context;
@ -55,17 +48,18 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(ViewHolder holder, int position) {
Media song = songs.get(position); Child song = songs.get(position);
holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle())); holder.songTitle.setText(MusicUtil.getReadableString(song.getTitle()));
holder.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtistName()), MusicUtil.getReadableDurationString(song.getDuration(), false))); holder.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtist()), MusicUtil.getReadableDurationString(song.getDuration(), false)));
holder.trackNumber.setText(String.valueOf(song.getTrackNumber())); holder.trackNumber.setText(String.valueOf(song.getTrack()));
if (DownloadUtil.getDownloadTracker(context).isDownloaded(MappingUtil.mapMediaItem(context, song, false))) { // TODO
/* if (DownloadUtil.getDownloadTracker(context).isDownloaded(MappingUtil.mapMediaItem(context, song, false))) {
holder.downloadIndicator.setVisibility(View.VISIBLE); holder.downloadIndicator.setVisibility(View.VISIBLE);
} else { } else {
holder.downloadIndicator.setVisibility(View.GONE); holder.downloadIndicator.setVisibility(View.GONE);
} } */
if (isCoverVisible) CustomGlideRequest.Builder if (isCoverVisible) CustomGlideRequest.Builder
.from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null) .from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null)
@ -87,12 +81,12 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
return songs.size(); return songs.size();
} }
public void setItems(List<Media> songs) { public void setItems(List<Child> songs) {
this.songs = songs; this.songs = songs;
notifyDataSetChanged(); notifyDataSetChanged();
} }
public Media getItem(int id) { public Child getItem(int id) {
return songs.get(id); return songs.get(id);
} }

View file

@ -1,13 +1,13 @@
package com.cappielloantonio.play.database; package com.cappielloantonio.play.database;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import androidx.room.AutoMigration;
import androidx.room.Database; import androidx.room.Database;
import androidx.room.Room; import androidx.room.Room;
import androidx.room.RoomDatabase; import androidx.room.RoomDatabase;
import androidx.room.TypeConverters;
import com.cappielloantonio.play.database.converter.DateConverters;
import com.cappielloantonio.play.database.dao.ChronologyDao; import com.cappielloantonio.play.database.dao.ChronologyDao;
import com.cappielloantonio.play.database.dao.DownloadDao; import com.cappielloantonio.play.database.dao.DownloadDao;
import com.cappielloantonio.play.database.dao.PlaylistDao; import com.cappielloantonio.play.database.dao.PlaylistDao;
@ -16,17 +16,17 @@ import com.cappielloantonio.play.database.dao.RecentSearchDao;
import com.cappielloantonio.play.database.dao.ServerDao; import com.cappielloantonio.play.database.dao.ServerDao;
import com.cappielloantonio.play.model.Chronology; import com.cappielloantonio.play.model.Chronology;
import com.cappielloantonio.play.model.Download; import com.cappielloantonio.play.model.Download;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Queue; import com.cappielloantonio.play.model.Queue;
import com.cappielloantonio.play.model.RecentSearch; import com.cappielloantonio.play.model.RecentSearch;
import com.cappielloantonio.play.model.Server; import com.cappielloantonio.play.model.Server;
import com.cappielloantonio.play.subsonic.models.Playlist;
@SuppressLint("RestrictedApi")
@Database( @Database(
version = 46, version = 48,
entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Playlist.class, Chronology.class} entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Playlist.class, Chronology.class}
// autoMigrations = {@AutoMigration(from = 43, to = 44)} // autoMigrations = {@AutoMigration(from = 43, to = 44)}
) )
@TypeConverters({DateConverters.class})
public abstract class AppDatabase extends RoomDatabase { public abstract class AppDatabase extends RoomDatabase {
private final static String DB_NAME = "play_db"; private final static String DB_NAME = "play_db";
private static AppDatabase instance; private static AppDatabase instance;

View file

@ -0,0 +1,16 @@
package com.cappielloantonio.play.database.converter
import androidx.room.TypeConverter
import java.util.*
class DateConverters {
@TypeConverter
fun fromTimestamp(value: Long?): Date? {
return value?.let { Date(it) }
}
@TypeConverter
fun dateToTimestamp(date: Date?): Long? {
return date?.time
}
}

View file

@ -15,28 +15,28 @@ public interface DownloadDao {
@Query("SELECT * FROM download WHERE server=:server") @Query("SELECT * FROM download WHERE server=:server")
LiveData<List<Download>> getAll(String server); LiveData<List<Download>> getAll(String server);
@Query("SELECT * FROM download WHERE server=:server AND playlistId IS NULL GROUP BY artistName LIMIT :size") @Query("SELECT * FROM download WHERE server=:server AND playlist_id IS NULL GROUP BY artist LIMIT :size")
LiveData<List<Download>> getSampleArtist(int size, String server); LiveData<List<Download>> getSampleArtist(int size, String server);
@Query("SELECT * FROM download WHERE server=:server AND playlistId IS NULL GROUP BY albumName LIMIT :size") @Query("SELECT * FROM download WHERE server=:server AND playlist_id IS NULL GROUP BY album LIMIT :size")
LiveData<List<Download>> getSampleAlbum(int size, String server); LiveData<List<Download>> getSampleAlbum(int size, String server);
@Query("SELECT * FROM download WHERE server=:server AND playlistId IS NOT NULL GROUP BY playlistId LIMIT :size") @Query("SELECT * FROM download WHERE server=:server AND playlist_id IS NOT NULL GROUP BY playlist_id LIMIT :size")
LiveData<List<Download>> getSamplePlaylist(int size, String server); LiveData<List<Download>> getSamplePlaylist(int size, String server);
@Query("SELECT * FROM download WHERE server=:server LIMIT :size") @Query("SELECT * FROM download WHERE server=:server LIMIT :size")
LiveData<List<Download>> getSample(int size, String server); LiveData<List<Download>> getSample(int size, String server);
@Query("SELECT * FROM download WHERE server=:server AND artistId=:artistId") @Query("SELECT * FROM download WHERE server=:server AND artist=:artistId")
LiveData<List<Download>> getAllFromArtist(String server, String artistId); LiveData<List<Download>> getAllFromArtist(String server, String artistId);
@Query("SELECT * FROM download WHERE server=:server AND albumId=:albumId ORDER BY trackNumber ASC") @Query("SELECT * FROM download WHERE server=:server AND album=:albumId ORDER BY track ASC")
LiveData<List<Download>> getAllFromAlbum(String server, String albumId); LiveData<List<Download>> getAllFromAlbum(String server, String albumId);
@Query("SELECT * FROM download WHERE server=:server AND playlistId=:playlistId") @Query("SELECT * FROM download WHERE server=:server AND playlist_id=:playlistId")
LiveData<List<Download>> getAllFromPlaylist(String server, String playlistId); LiveData<List<Download>> getAllFromPlaylist(String server, String playlistId);
@Query("SELECT * FROM download WHERE server=:server AND playlistId IS NOT NULL GROUP BY playlistId") @Query("SELECT * FROM download WHERE server=:server AND playlist_id IS NOT NULL GROUP BY playlist_id")
LiveData<List<Download>> getAllPlaylists(String server); LiveData<List<Download>> getAllPlaylists(String server);
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
@ -45,7 +45,7 @@ public interface DownloadDao {
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
void insertAll(List<Download> downloads); void insertAll(List<Download> downloads);
@Query("DELETE FROM download WHERE mediaId = :mediaId") @Query("DELETE FROM download WHERE media_id = :mediaId")
void delete(String mediaId); void delete(String mediaId);
@Query("DELETE FROM download WHERE server=:server") @Query("DELETE FROM download WHERE server=:server")

View file

@ -7,14 +7,17 @@ import androidx.room.Insert;
import androidx.room.OnConflictStrategy; import androidx.room.OnConflictStrategy;
import androidx.room.Query; import androidx.room.Query;
import com.cappielloantonio.play.model.Playlist; import com.cappielloantonio.play.subsonic.models.Playlist;
import java.util.List; import java.util.List;
@Dao @Dao
public interface PlaylistDao { public interface PlaylistDao {
@Query("SELECT * FROM playlist WHERE server=:serverId") // @Query("SELECT * FROM playlist WHERE server=:serverId")
LiveData<List<Playlist>> getAll(String serverId); // LiveData<List<Playlist>> getAll(String serverId);
@Query("SELECT * FROM playlist")
LiveData<List<Playlist>> getAll();
@Insert(onConflict = OnConflictStrategy.REPLACE) @Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(Playlist playlist); void insert(Playlist playlist);

View file

@ -10,7 +10,7 @@ import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory; import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
import com.bumptech.glide.module.AppGlideModule; import com.bumptech.glide.module.AppGlideModule;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.cappielloantonio.play.util.PreferenceUtil; import com.cappielloantonio.play.util.Preferences;
import java.io.File; import java.io.File;
@ -19,7 +19,7 @@ public class CustomGlideModule extends AppGlideModule {
@Override @Override
public void applyOptions(@NonNull Context context, GlideBuilder builder) { public void applyOptions(@NonNull Context context, GlideBuilder builder) {
File file = new File(context.getCacheDir() + "glide"); File file = new File(context.getCacheDir() + "glide");
int size = PreferenceUtil.getInstance(context).getImageCacheSize(); int size = Preferences.getImageCacheSize();
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size)); builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565)); builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));

View file

@ -15,7 +15,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.signature.ObjectKey; import com.bumptech.glide.signature.ObjectKey;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.util.MusicUtil; import com.cappielloantonio.play.util.MusicUtil;
import com.cappielloantonio.play.util.PreferenceUtil; import com.cappielloantonio.play.util.Preferences;
import java.util.Map; import java.util.Map;
@ -71,12 +71,12 @@ public class CustomGlideRequest {
private Builder(Context context, String item, String category, String custom) { private Builder(Context context, String item, String category, String custom) {
this.requestManager = Glide.with(context); this.requestManager = Glide.with(context);
if (PreferenceUtil.getInstance(context).isDataSavingMode()) { if (Preferences.isDataSavingMode()) {
this.item = MusicUtil.getDefaultPicPerCategory(category); this.item = MusicUtil.getDefaultPicPerCategory(category);
} else if (custom != null && !PreferenceUtil.getInstance(context).isDataSavingMode()) { } else if (custom != null && !Preferences.isDataSavingMode()) {
this.item = custom; this.item = custom;
} else if (item != null && !PreferenceUtil.getInstance(context).isDataSavingMode()) { } else if (item != null && !Preferences.isDataSavingMode()) {
this.item = createUrl(item, PreferenceUtil.getInstance(context).getImageSize()); this.item = createUrl(item, Preferences.getImageSize());
} else { } else {
this.item = MusicUtil.getDefaultPicPerCategory(category); this.item = MusicUtil.getDefaultPicPerCategory(category);
} }

View file

@ -2,62 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.AlbumID3
import com.cappielloantonio.play.subsonic.models.AlbumWithSongsID3
import com.cappielloantonio.play.util.MappingUtil
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import java.util.*
@Keep @Keep
@Parcelize @Parcelize
class Album( class Album : Parcelable {
var id: String,
val title: String,
val year: Int? = 0,
val artistId: String,
val artistName: String,
val primary: String,
var starred: Boolean?,
val songs: List<Media>?,
val created: Date?
) : Parcelable {
constructor(albumID3: AlbumID3) : this(
albumID3.id,
albumID3.name,
albumID3.year ?: 0,
albumID3.artistId,
albumID3.artist,
albumID3.coverArtId,
albumID3.starred != null,
null,
albumID3.created
)
constructor(albumWithSongsID3: AlbumWithSongsID3) : this(
albumWithSongsID3.id,
albumWithSongsID3.name,
albumWithSongsID3.year ?: 0,
albumWithSongsID3.artistId,
albumWithSongsID3.artist,
albumWithSongsID3.coverArtId,
albumWithSongsID3.starred != null,
MappingUtil.mapSong(albumWithSongsID3.songs),
albumWithSongsID3.created
)
constructor(download: Download) : this(
download.albumId,
download.albumName,
0,
download.artistId,
download.artistName,
download.primary,
null,
null,
null
)
companion object { companion object {
const val RECENTLY_PLAYED = "RECENTLY_PLAYED" const val RECENTLY_PLAYED = "RECENTLY_PLAYED"
const val MOST_PLAYED = "MOST_PLAYED" const val MOST_PLAYED = "MOST_PLAYED"

View file

@ -2,98 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.ArtistID3
import com.cappielloantonio.play.subsonic.models.ArtistInfo2
import com.cappielloantonio.play.subsonic.models.ArtistWithAlbumsID3
import com.cappielloantonio.play.subsonic.models.SimilarArtistID3
import com.cappielloantonio.play.util.MappingUtil
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Keep @Keep
@Parcelize @Parcelize
class Artist( class Artist : Parcelable {
val id: String?,
val name: String?,
val primary: String?,
val albumCount: Int?,
var starred: Boolean?,
val bio: String?,
val imageUrl: String?,
val lastfm: String?,
val albums: List<Album>?,
val similarArtists: List<Artist>?,
) : Parcelable {
constructor(artistID3: ArtistID3) : this(
artistID3.id,
artistID3.name,
artistID3.coverArtId,
artistID3.albumCount,
artistID3.starred != null,
null,
null,
null,
null,
null
)
constructor(artistWithAlbumsID3: ArtistWithAlbumsID3) : this(
artistWithAlbumsID3.id,
artistWithAlbumsID3.name,
artistWithAlbumsID3.coverArtId,
artistWithAlbumsID3.albumCount,
artistWithAlbumsID3.starred != null,
null,
null,
null,
MappingUtil.mapAlbum(artistWithAlbumsID3.albums),
null
)
constructor(similarArtistID3: SimilarArtistID3) : this(
similarArtistID3.id,
similarArtistID3.name,
similarArtistID3.coverArtId,
similarArtistID3.albumCount,
null,
null,
null,
null,
null,
null
)
constructor(artistInfo2: ArtistInfo2) : this(
null,
null,
null,
null,
null,
artistInfo2.biography,
artistInfo2.largeImageUrl,
artistInfo2.lastFmUrl,
null,
MappingUtil.mapSimilarArtist(artistInfo2.similarArtists)
)
constructor(id: String, name: String) : this(
id,
name,
null,
null,
null,
null,
null,
null,
null,
null
)
constructor(download: Download) : this(
download.artistId,
download.artistName
)
companion object { companion object {
const val DOWNLOADED = "DOWNLOADED" const val DOWNLOADED = "DOWNLOADED"
const val STARRED = "STARRED" const val STARRED = "STARRED"

View file

@ -1,55 +1,19 @@
package com.cappielloantonio.play.model package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.cappielloantonio.play.subsonic.models.Child
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Keep @Keep
@Parcelize @Parcelize
@Entity(tableName = "chronology") @Entity(tableName = "chronology")
data class Chronology( class Chronology(@PrimaryKey override val id: String) : Child(id) {
@ColumnInfo(name = "id")
val trackId: String,
@ColumnInfo(name = "title")
val title: String,
@ColumnInfo(name = "albumId")
val albumId: String,
@ColumnInfo(name = "albumName")
val albumName: String,
@ColumnInfo(name = "artistId")
val artistId: String,
@ColumnInfo(name = "artistName")
val artistName: String,
@ColumnInfo(name = "cover_art_id")
val coverArtId: String,
@ColumnInfo(name = "duration")
val duration: Long,
@ColumnInfo(name = "container")
val container: String,
@ColumnInfo(name = "bitrate")
val bitrate: Int,
@ColumnInfo(name = "extension")
val extension: String,
@ColumnInfo(name = "server")
val server: String,
) : Parcelable {
@PrimaryKey(autoGenerate = true)
var uuid: Int = 0
@ColumnInfo(name = "timestamp") @ColumnInfo(name = "timestamp")
var timestamp: Long = System.currentTimeMillis() var timestamp: Long = System.currentTimeMillis()
@ColumnInfo(name = "server")
var server: String? = null
} }

View file

@ -1,89 +1,22 @@
package com.cappielloantonio.play.model package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.cappielloantonio.play.App import com.cappielloantonio.play.subsonic.models.Child
import com.cappielloantonio.play.util.MusicUtil
import com.cappielloantonio.play.util.PreferenceUtil
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import java.util.*
@Keep @Keep
@Parcelize @Parcelize
@Entity(tableName = "download") @Entity(tableName = "download")
class Download( class Download(@PrimaryKey override val id: String) : Child(id) {
@PrimaryKey @ColumnInfo(name = "id") @ColumnInfo(name = "media_id")
var id: String, var mediaID: String? = null
@ColumnInfo(name = "mediaId") @ColumnInfo
val mediaID: String, var server: String? = null
@ColumnInfo(name = "title") @ColumnInfo(name = "playlist_id")
val title: String, var playlistId: String? = null
@ColumnInfo(name = "albumId")
val albumId: String,
@ColumnInfo(name = "albumName")
val albumName: String,
@ColumnInfo(name = "artistId")
val artistId: String,
@ColumnInfo(name = "artistName")
val artistName: String,
@ColumnInfo(name = "trackNumber")
val trackNumber: Int = 0,
@ColumnInfo(name = "primary")
val primary: String,
@ColumnInfo(name = "duration")
val duration: Long = 0,
@ColumnInfo(name = "server")
val server: String,
@ColumnInfo(name = "playlistId")
val playlistId: String? = null,
@ColumnInfo(name = "playlistName")
val playlistName: String? = null,
@ColumnInfo(name = "container")
val container: String,
@ColumnInfo(name = "bitrate")
val bitrate: Int = 0,
@ColumnInfo(name = "extension")
val extension: String,
@ColumnInfo(name = "type")
val type: String,
) : Parcelable {
constructor(media: Media, playlistId: String?, playlistName: String?) : this(
UUID.randomUUID().toString(),
media.id!!,
media.title!!,
media.albumId!!,
media.albumName!!,
media.artistId!!,
MusicUtil.normalizedArtistName(media.artistName),
media.trackNumber!!,
media.coverArtId!!,
media.duration!!,
PreferenceUtil.getInstance(App.getInstance()).serverId,
playlistId,
playlistName,
media.container!!,
media.bitrate,
media.extension!!,
media.type!!
)
} }

View file

@ -2,25 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.Genre
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Keep @Keep
@Parcelize @Parcelize
class Genre( class Genre : Parcelable {
val id: String,
val name: String,
val songCount: Int = 0,
val albumCount: Int = 0
) : Parcelable {
constructor(genre: Genre) : this(
genre.genre,
genre.genre,
genre.songCount,
genre.albumCount
)
companion object { companion object {
const val ORDER_BY_NAME = "ORDER_BY_NAME" const val ORDER_BY_NAME = "ORDER_BY_NAME"
const val ORDER_BY_RANDOM = "ORDER_BY_RANDOM" const val ORDER_BY_RANDOM = "ORDER_BY_RANDOM"

View file

@ -2,192 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.Child
import com.cappielloantonio.play.subsonic.models.PodcastEpisode
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Keep @Keep
@Parcelize @Parcelize
class Media( class Media : Parcelable {
val id: String?,
val title: String?,
val channelId: String?,
val streamId: String?,
val albumId: String?,
val albumName: String?,
val artistId: String?,
val artistName: String?,
val coverArtId: String?,
val trackNumber: Int?,
val discNumber: Int?,
val year: Int?,
val duration: Long?,
val description: String?,
val status: String?,
var starred: Boolean?,
val path: String?,
val size: Long?,
val container: String?,
val bitrate: Int,
val extension: String?,
val added: Long?,
val type: String?,
val playCount: Int?,
val lastPlay: Long?,
val rating: Int?,
val publishDate: Long?
) : Parcelable {
constructor(child: Child) : this(
child.id,
child.title,
null,
null,
child.albumId,
child.album,
child.artistId,
child.artist,
child.coverArtId,
child.track,
child.discNumber,
child.year,
child.duration.toLong(),
null,
null,
child.starred != null,
child.path,
child.size,
child.contentType,
child.bitRate,
child.suffix,
child.created.time,
child.type,
0,
0,
child.userRating,
0
)
constructor(podcastEpisode: PodcastEpisode) : this(
podcastEpisode.id,
podcastEpisode.title,
podcastEpisode.channelId,
podcastEpisode.streamId,
null,
podcastEpisode.album,
null,
podcastEpisode.artist,
podcastEpisode.coverArtId,
podcastEpisode.track,
null,
podcastEpisode.year,
podcastEpisode.duration.toLong(),
podcastEpisode.description,
podcastEpisode.status,
podcastEpisode.starred != null,
null,
null,
podcastEpisode.contentType,
podcastEpisode.bitRate,
podcastEpisode.suffix,
podcastEpisode.created.time,
podcastEpisode.type,
null,
null,
podcastEpisode.userRating,
podcastEpisode.publishDate.time
)
constructor(queue: Queue) : this(
queue.id,
queue.title,
queue.channelId,
queue.streamId,
queue.albumId,
queue.albumName,
queue.artistId,
queue.artistName,
queue.coverArtId,
null,
null,
null,
queue.duration,
null,
null,
null,
null,
null,
queue.container,
queue.bitrate,
queue.extension,
null,
queue.type,
null,
null,
null,
queue.publishingDate
)
constructor(download: Download) : this(
download.mediaID,
download.title,
null,
null,
download.albumId,
download.albumName,
download.artistId,
download.artistName,
download.primary,
download.trackNumber,
null,
null,
download.duration,
null,
null,
null,
null,
null,
download.container,
download.bitrate,
download.extension,
null,
download.type,
null,
null,
null,
null
)
constructor(item: Chronology) : this(
item.trackId,
item.title,
null,
null,
item.albumId,
item.albumName,
item.artistId,
item.artistName,
item.coverArtId,
null,
null,
null,
item.duration,
null,
null,
null,
null,
null,
item.container,
item.bitrate,
item.extension,
null,
MEDIA_TYPE_MUSIC,
null,
null,
null,
null
)
companion object { companion object {
const val MEDIA_TYPE_MUSIC = "music" const val MEDIA_TYPE_MUSIC = "music"
const val MEDIA_TYPE_PODCAST = "podcast" const val MEDIA_TYPE_PODCAST = "podcast"

View file

@ -2,45 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import com.cappielloantonio.play.subsonic.models.Playlist
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Keep @Keep
@Parcelize @Parcelize
@Entity(tableName = "playlist") class Playlist : Parcelable {
class Playlist(
@PrimaryKey
@ColumnInfo(name = "id")
var id: String,
@ColumnInfo(name = "playlist_name")
var name: String,
@ColumnInfo(name = "primary")
var primary: String? = null,
@ColumnInfo(name = "song_count")
var songCount: Int = 0,
@ColumnInfo(name = "playlist_duration")
var duration: Long = 0,
@ColumnInfo(name = "server")
var server: String? = null,
) : Parcelable {
constructor(playlist: Playlist) : this(
playlist.id,
playlist.name,
playlist.coverArtId,
playlist.songCount,
playlist.duration.toLong()
)
companion object { companion object {
const val ALL = "ALL" const val ALL = "ALL"
const val DOWNLOADED = "DOWNLOADED" const val DOWNLOADED = "DOWNLOADED"

View file

@ -1,34 +0,0 @@
package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.PodcastChannel
import com.cappielloantonio.play.util.MappingUtil
import kotlinx.android.parcel.Parcelize
@Keep
@Parcelize
class PodcastChannel(
var id: String,
var url: String,
var title: String,
var description: String,
var coverArtId: String,
var originalImageUrl: String,
var status: String,
var errorMessage: String,
var episodes: List<Media>,
) : Parcelable {
constructor(podcastChannel: PodcastChannel) : this(
podcastChannel.id,
podcastChannel.url,
podcastChannel.title,
podcastChannel.description,
podcastChannel.coverArtId,
podcastChannel.originalImageUrl,
podcastChannel.status,
podcastChannel.errorMessage,
MappingUtil.mapPodcastEpisode(podcastChannel.episodes)
)
}

View file

@ -1,68 +1,26 @@
package com.cappielloantonio.play.model package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep import androidx.annotation.Keep
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.cappielloantonio.play.subsonic.models.Child
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@Keep @Keep
@Parcelize @Parcelize
@Entity(tableName = "queue") @Entity(tableName = "queue")
data class Queue( class Queue(override val id: String) : Child(id) {
@PrimaryKey @PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "track_order") @ColumnInfo(name = "track_order")
val trackOrder: Int, var trackOrder: Int = 0
@ColumnInfo(name = "id")
val id: String?,
@ColumnInfo(name = "title")
val title: String?,
@ColumnInfo(name = "albumId")
val albumId: String?,
@ColumnInfo(name = "albumName")
val albumName: String?,
@ColumnInfo(name = "artistId")
val artistId: String?,
@ColumnInfo(name = "artistName")
val artistName: String?,
@ColumnInfo(name = "cover_art_id")
val coverArtId: String?,
@ColumnInfo(name = "duration")
val duration: Long,
@ColumnInfo(name = "last_play", defaultValue = "0") @ColumnInfo(name = "last_play", defaultValue = "0")
val lastPlay: Long, var lastPlay: Long = 0
@ColumnInfo(name = "playing_changed", defaultValue = "0") @ColumnInfo(name = "playing_changed", defaultValue = "0")
val playingChanged: Long, var playingChanged: Long = 0
@ColumnInfo(name = "stream_id") @ColumnInfo(name = "stream_id")
val streamId: String?, var streamId: String? = null
}
@ColumnInfo(name = "channel_id")
val channelId: String?,
@ColumnInfo(name = "publishing_date", defaultValue = "0")
val publishingDate: Long,
@ColumnInfo(name = "container")
val container: String?,
@ColumnInfo(name = "bitrate")
val bitrate: Int,
@ColumnInfo(name = "extension")
val extension: String?,
@ColumnInfo(name = "media_type")
val type: String?
) : Parcelable

View file

@ -8,10 +8,9 @@ import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.interfaces.DecadesCallback; import com.cappielloantonio.play.interfaces.DecadesCallback;
import com.cappielloantonio.play.interfaces.MediaCallback; import com.cappielloantonio.play.interfaces.MediaCallback;
import com.cappielloantonio.play.model.Album; import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -32,8 +31,8 @@ public class AlbumRepository {
this.application = application; this.application = application;
} }
public MutableLiveData<List<Album>> getAlbums(String type, int size, Integer fromYear, Integer toYear) { public MutableLiveData<List<AlbumID3>> getAlbums(String type, int size, Integer fromYear, Integer toYear) {
MutableLiveData<List<Album>> listLiveAlbums = new MutableLiveData<>(); MutableLiveData<List<AlbumID3>> listLiveAlbums = new MutableLiveData<>(new ArrayList<>());
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getAlbumSongListClient() .getAlbumSongListClient()
@ -41,13 +40,9 @@ public class AlbumRepository {
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Album> albums = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getAlbumList2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getAlbumList2() != null) {
albums.addAll(MappingUtil.mapAlbum(response.body().getAlbumList2().getAlbums())); listLiveAlbums.setValue(response.body().getAlbumList2().getAlbums());
} }
listLiveAlbums.setValue(albums);
} }
@Override @Override
@ -59,8 +54,8 @@ public class AlbumRepository {
return listLiveAlbums; return listLiveAlbums;
} }
public MutableLiveData<List<Album>> getStarredAlbums(boolean random, int size) { public MutableLiveData<List<AlbumID3>> getStarredAlbums(boolean random, int size) {
MutableLiveData<List<Album>> starredAlbums = new MutableLiveData<>(); MutableLiveData<List<AlbumID3>> starredAlbums = new MutableLiveData<>(new ArrayList<>());
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getAlbumSongListClient() .getAlbumSongListClient()
@ -69,13 +64,13 @@ public class AlbumRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getStarred2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getStarred2() != null) {
List<Album> albums = new ArrayList<>(MappingUtil.mapAlbum(response.body().getStarred2().getAlbums())); List<AlbumID3> albums = response.body().getStarred2().getAlbums();
if (!random) { if (random) {
starredAlbums.setValue(albums);
} else {
Collections.shuffle(albums); Collections.shuffle(albums);
starredAlbums.setValue(albums.subList(0, Math.min(size, albums.size()))); starredAlbums.setValue(albums.subList(0, Math.min(size, albums.size())));
} else {
starredAlbums.setValue(albums);
} }
} }
} }
@ -140,8 +135,8 @@ public class AlbumRepository {
}); });
} }
public MutableLiveData<List<Media>> getAlbumTracks(String id) { public MutableLiveData<List<Child>> getAlbumTracks(String id) {
MutableLiveData<List<Media>> albumTracks = new MutableLiveData<>(); MutableLiveData<List<Child>> albumTracks = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -149,10 +144,10 @@ public class AlbumRepository {
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Media> tracks = new ArrayList<>(); List<Child> tracks = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getAlbum() != null) { if (response.isSuccessful() && response.body() != null && response.body().getAlbum() != null) {
tracks.addAll(MappingUtil.mapSong(response.body().getAlbum().getSongs())); tracks.addAll(response.body().getAlbum().getSongs());
} }
albumTracks.setValue(tracks); albumTracks.setValue(tracks);
@ -167,8 +162,8 @@ public class AlbumRepository {
return albumTracks; return albumTracks;
} }
public MutableLiveData<List<Album>> getArtistAlbums(String id) { public MutableLiveData<List<AlbumID3>> getArtistAlbums(String id) {
MutableLiveData<List<Album>> artistsAlbum = new MutableLiveData<>(); MutableLiveData<List<AlbumID3>> artistsAlbum = new MutableLiveData<>(new ArrayList<>());
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -176,14 +171,11 @@ public class AlbumRepository {
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Album> albums = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) { if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) {
albums.addAll(MappingUtil.mapAlbum(response.body().getArtist().getAlbums())); List<AlbumID3> albums = response.body().getArtist().getAlbums();
albums.sort(Comparator.comparing(Album::getYear)); albums.sort(Comparator.comparing(AlbumID3::getYear));
artistsAlbum.setValue(albums);
} }
artistsAlbum.setValue(albums);
} }
@Override @Override
@ -195,8 +187,8 @@ public class AlbumRepository {
return artistsAlbum; return artistsAlbum;
} }
public MutableLiveData<Album> getAlbum(String id) { public MutableLiveData<AlbumID3> getAlbum(String id) {
MutableLiveData<Album> album = new MutableLiveData<>(); MutableLiveData<AlbumID3> album = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -205,7 +197,7 @@ public class AlbumRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getAlbum() != null) { if (response.isSuccessful() && response.body() != null && response.body().getAlbum() != null) {
album.setValue(MappingUtil.mapAlbum(response.body().getAlbum())); album.setValue(response.body().getAlbum());
} }
} }
@ -218,17 +210,17 @@ public class AlbumRepository {
return album; return album;
} }
public void getInstantMix(Album album, int count, MediaCallback callback) { public void getInstantMix(AlbumID3 album, int count, MediaCallback callback) {
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
.getSimilarSongs2(album.getId(), count) .getSimilarSongs2(album.getId(), count)
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Media> songs = new ArrayList<>(); List<Child> songs = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getSimilarSongs2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getSimilarSongs2() != null) {
songs.addAll(MappingUtil.mapSong(response.body().getSimilarSongs2().getSongs())); songs.addAll(response.body().getSimilarSongs2().getSongs());
} }
callback.onLoadMedia(songs); callback.onLoadMedia(songs);

View file

@ -3,18 +3,16 @@ package com.cappielloantonio.play.repository;
import android.app.Application; import android.app.Application;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.interfaces.MediaCallback; import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.model.Album; import com.cappielloantonio.play.subsonic.models.ArtistID3;
import com.cappielloantonio.play.model.Artist; import com.cappielloantonio.play.subsonic.models.ArtistInfo2;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.subsonic.models.IndexID3; import com.cappielloantonio.play.subsonic.models.IndexID3;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -31,8 +29,8 @@ public class ArtistRepository {
this.application = application; this.application = application;
} }
public MutableLiveData<List<Artist>> getStarredArtists(boolean random, int size) { public MutableLiveData<List<ArtistID3>> getStarredArtists(boolean random, int size) {
MutableLiveData<List<Artist>> starredArtists = new MutableLiveData<>(); MutableLiveData<List<ArtistID3>> starredArtists = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getAlbumSongListClient() .getAlbumSongListClient()
@ -41,7 +39,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getStarred2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getStarred2() != null) {
List<Artist> artists = new ArrayList<>(MappingUtil.mapArtist(response.body().getStarred2().getArtists())); List<ArtistID3> artists = response.body().getStarred2().getArtists();
if (!random) { if (!random) {
getArtistInfo(artists, starredArtists); getArtistInfo(artists, starredArtists);
@ -61,8 +59,8 @@ public class ArtistRepository {
return starredArtists; return starredArtists;
} }
public MutableLiveData<List<Artist>> getArtists(boolean random, int size) { public MutableLiveData<List<ArtistID3>> getArtists(boolean random, int size) {
MutableLiveData<List<Artist>> listLiveArtists = new MutableLiveData<>(); MutableLiveData<List<ArtistID3>> listLiveArtists = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -71,10 +69,10 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
List<Artist> artists = new ArrayList<>(); List<ArtistID3> artists = new ArrayList<>();
for (IndexID3 index : response.body().getArtists().getIndices()) { for (IndexID3 index : response.body().getArtists().getIndices()) {
artists.addAll(MappingUtil.mapArtist(index.getArtists())); artists.addAll(index.getArtists());
} }
if (random) { if (random) {
@ -97,12 +95,12 @@ public class ArtistRepository {
/* /*
* Metodo che mi restituisce le informazioni essenzionali dell'artista (cover, numero di album...) * Metodo che mi restituisce le informazioni essenzionali dell'artista (cover, numero di album...)
*/ */
public void getArtistInfo(List<Artist> artists, MutableLiveData<List<Artist>> list) { public void getArtistInfo(List<ArtistID3> artists, MutableLiveData<List<ArtistID3>> list) {
List<Artist> liveArtists = list.getValue(); List<ArtistID3> liveArtists = list.getValue();
if (liveArtists == null) liveArtists = new ArrayList<>(); if (liveArtists == null) liveArtists = new ArrayList<>();
list.setValue(liveArtists); list.setValue(liveArtists);
for (Artist artist : artists) { for (ArtistID3 artist : artists) {
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
.getArtist(artist.getId()) .getArtist(artist.getId())
@ -110,7 +108,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) { if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) {
addToMutableLiveData(list, MappingUtil.mapArtistWithAlbum(response.body().getArtist())); addToMutableLiveData(list, response.body().getArtist());
} }
} }
@ -122,8 +120,8 @@ public class ArtistRepository {
} }
} }
public MutableLiveData<Artist> getArtistInfo(String id) { public MutableLiveData<ArtistID3> getArtistInfo(String id) {
MutableLiveData<Artist> artist = new MutableLiveData<>(); MutableLiveData<ArtistID3> artist = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -132,7 +130,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) { if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) {
artist.setValue(MappingUtil.mapArtistWithAlbum(response.body().getArtist())); artist.setValue(response.body().getArtist());
} }
} }
@ -148,8 +146,8 @@ public class ArtistRepository {
/* /*
* Metodo che mi restituisce le informazioni complete dell'artista (bio, immagini prese da last.fm, artisti simili...) * Metodo che mi restituisce le informazioni complete dell'artista (bio, immagini prese da last.fm, artisti simili...)
*/ */
public MutableLiveData<Artist> getArtistFullInfo(String id) { public MutableLiveData<ArtistInfo2> getArtistFullInfo(String id) {
MutableLiveData<Artist> artistFullInfo = new MutableLiveData<>(); MutableLiveData<ArtistInfo2> artistFullInfo = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -158,7 +156,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getArtistInfo2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getArtistInfo2() != null) {
artistFullInfo.setValue(MappingUtil.mapArtist(response.body().getArtistInfo2())); artistFullInfo.setValue(response.body().getArtistInfo2());
} }
} }
@ -222,8 +220,8 @@ public class ArtistRepository {
}); });
} }
public MutableLiveData<Artist> getArtist(String id) { public MutableLiveData<ArtistID3> getArtist(String id) {
MutableLiveData<Artist> artist = new MutableLiveData<>(); MutableLiveData<ArtistID3> artist = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -232,7 +230,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) { if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null) {
artist.setValue(MappingUtil.mapArtist(response.body().getArtist())); artist.setValue(response.body().getArtist());
} }
} }
@ -245,8 +243,8 @@ public class ArtistRepository {
return artist; return artist;
} }
public MutableLiveData<ArrayList<Media>> getInstantMix(Artist artist, int count) { public MutableLiveData<List<Child>> getInstantMix(ArtistID3 artist, int count) {
MutableLiveData<ArrayList<Media>> instantMix = new MutableLiveData<>(); MutableLiveData<List<Child>> instantMix = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -255,7 +253,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getSimilarSongs2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getSimilarSongs2() != null) {
instantMix.setValue(MappingUtil.mapSong(response.body().getSimilarSongs2().getSongs())); instantMix.setValue(response.body().getSimilarSongs2().getSongs());
} }
} }
@ -268,8 +266,8 @@ public class ArtistRepository {
return instantMix; return instantMix;
} }
public MutableLiveData<ArrayList<Media>> getArtistRandomSong(LifecycleOwner owner, Artist artist, int count) { public MutableLiveData<ArrayList<Child>> getArtistRandomSong(LifecycleOwner owner, ArtistID3 artist, int count) {
MutableLiveData<ArrayList<Media>> randomSongs = new MutableLiveData<>(); MutableLiveData<ArrayList<Child>> randomSongs = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -278,14 +276,14 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null && response.body().getArtist().getAlbums() != null) { if (response.isSuccessful() && response.body() != null && response.body().getArtist() != null && response.body().getArtist().getAlbums() != null) {
List<Album> albums = new ArrayList<>(MappingUtil.mapAlbum(response.body().getArtist().getAlbums())); List<AlbumID3> albums = response.body().getArtist().getAlbums();
if (albums.size() > 0) { if (albums.size() > 0) {
AlbumRepository albumRepository = new AlbumRepository(App.getInstance()); AlbumRepository albumRepository = new AlbumRepository(App.getInstance());
for (int index = 0; index < albums.size(); index++) { for (int index = 0; index < albums.size(); index++) {
albumRepository.getAlbumTracks(albums.get(index).getId()).observe(owner, songs -> { albumRepository.getAlbumTracks(albums.get(index).getId()).observe(owner, songs -> {
ArrayList<Media> liveSongs = randomSongs.getValue(); ArrayList<Child> liveSongs = randomSongs.getValue();
if (liveSongs == null) liveSongs = new ArrayList<>(); if (liveSongs == null) liveSongs = new ArrayList<>();
Collections.shuffle(liveSongs); Collections.shuffle(liveSongs);
liveSongs.addAll(songs); liveSongs.addAll(songs);
@ -305,8 +303,8 @@ public class ArtistRepository {
return randomSongs; return randomSongs;
} }
public MutableLiveData<List<Media>> getTopSongs(String artistName, int count) { public MutableLiveData<List<Child>> getTopSongs(String artistName, int count) {
MutableLiveData<List<Media>> topSongs = new MutableLiveData<>(); MutableLiveData<List<Child>> topSongs = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -315,7 +313,7 @@ public class ArtistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getTopSongs() != null) { if (response.isSuccessful() && response.body() != null && response.body().getTopSongs() != null) {
topSongs.setValue(MappingUtil.mapSong(response.body().getTopSongs().getSongs())); topSongs.setValue(response.body().getTopSongs().getSongs());
} }
} }
@ -328,8 +326,8 @@ public class ArtistRepository {
return topSongs; return topSongs;
} }
private void addToMutableLiveData(MutableLiveData<List<Artist>> liveData, Artist artist) { private void addToMutableLiveData(MutableLiveData<List<ArtistID3>> liveData, ArtistID3 artist) {
List<Artist> liveArtists = liveData.getValue(); List<ArtistID3> liveArtists = liveData.getValue();
if (liveArtists != null) liveArtists.add(artist); if (liveArtists != null) liveArtists.add(artist);
liveData.setValue(liveArtists); liveData.setValue(liveArtists);
} }

View file

@ -4,17 +4,14 @@ import android.app.Application;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.database.AppDatabase; import com.cappielloantonio.play.database.AppDatabase;
import com.cappielloantonio.play.database.dao.DownloadDao; import com.cappielloantonio.play.database.dao.DownloadDao;
import com.cappielloantonio.play.model.Download; import com.cappielloantonio.play.model.Download;
import com.cappielloantonio.play.util.PreferenceUtil; import com.cappielloantonio.play.util.Preferences;
import java.util.List; import java.util.List;
public class DownloadRepository { public class DownloadRepository {
private static final String TAG = "QueueRepository";
private final DownloadDao downloadDao; private final DownloadDao downloadDao;
public DownloadRepository(Application application) { public DownloadRepository(Application application) {
@ -23,31 +20,31 @@ public class DownloadRepository {
} }
public LiveData<List<Download>> getLiveDownload() { public LiveData<List<Download>> getLiveDownload() {
return downloadDao.getAll(PreferenceUtil.getInstance(App.getInstance()).getServerId()); return downloadDao.getAll(Preferences.getServerId());
} }
public LiveData<List<Download>> getLiveDownloadSample(int size, boolean isArtist, boolean isAlbum, boolean isTrack, boolean isPlaylist) { public LiveData<List<Download>> getLiveDownloadSample(int size, boolean isArtist, boolean isAlbum, boolean isTrack, boolean isPlaylist) {
if (isArtist) return downloadDao.getSampleArtist(size, PreferenceUtil.getInstance(App.getInstance()).getServerId()); if (isArtist) return downloadDao.getSampleArtist(size, Preferences.getServerId());
else if (isAlbum) return downloadDao.getSampleAlbum(size, PreferenceUtil.getInstance(App.getInstance()).getServerId()); else if (isAlbum) return downloadDao.getSampleAlbum(size, Preferences.getServerId());
else if (isTrack) return downloadDao.getSample(size, PreferenceUtil.getInstance(App.getInstance()).getServerId()); else if (isTrack) return downloadDao.getSample(size, Preferences.getServerId());
else if (isPlaylist) return downloadDao.getSamplePlaylist(size, PreferenceUtil.getInstance(App.getInstance()).getServerId()); else if (isPlaylist) return downloadDao.getSamplePlaylist(size, Preferences.getServerId());
else return downloadDao.getSample(size, PreferenceUtil.getInstance(App.getInstance()).getServerId()); else return downloadDao.getSample(size, Preferences.getServerId());
} }
public LiveData<List<Download>> getLiveDownloadFromArtist(String artistId) { public LiveData<List<Download>> getLiveDownloadFromArtist(String artistId) {
return downloadDao.getAllFromArtist(PreferenceUtil.getInstance(App.getInstance()).getServerId(), artistId); return downloadDao.getAllFromArtist(Preferences.getServerId(), artistId);
} }
public LiveData<List<Download>> getLiveDownloadFromAlbum(String albumId) { public LiveData<List<Download>> getLiveDownloadFromAlbum(String albumId) {
return downloadDao.getAllFromAlbum(PreferenceUtil.getInstance(App.getInstance()).getServerId(), albumId); return downloadDao.getAllFromAlbum(Preferences.getServerId(), albumId);
} }
public LiveData<List<Download>> getLiveDownloadFromPlaylist(String playlistId) { public LiveData<List<Download>> getLiveDownloadFromPlaylist(String playlistId) {
return downloadDao.getAllFromPlaylist(PreferenceUtil.getInstance(App.getInstance()).getServerId(), playlistId); return downloadDao.getAllFromPlaylist(Preferences.getServerId(), playlistId);
} }
public LiveData<List<Download>> getLivePlaylist() { public LiveData<List<Download>> getLivePlaylist() {
return downloadDao.getAllPlaylists(PreferenceUtil.getInstance(App.getInstance()).getServerId()); return downloadDao.getAllPlaylists(Preferences.getServerId());
} }
public void insert(Download download) { public void insert(Download download) {
@ -107,7 +104,7 @@ public class DownloadRepository {
@Override @Override
public void run() { public void run() {
downloadDao.deleteAll(PreferenceUtil.getInstance(App.getInstance()).getServerId()); downloadDao.deleteAll(Preferences.getServerId());
} }
} }

View file

@ -6,11 +6,9 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.model.Genre; import com.cappielloantonio.play.subsonic.models.Genre;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -37,7 +35,7 @@ public class GenreRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getGenres() != null) { if (response.isSuccessful() && response.body() != null && response.body().getGenres() != null) {
List<Genre> genreList = new ArrayList<>(MappingUtil.mapGenre(response.body().getGenres().getGenres())); List<Genre> genreList = response.body().getGenres().getGenres();
if (random) { if (random) {
Collections.shuffle(genreList); Collections.shuffle(genreList);

View file

@ -10,10 +10,9 @@ import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.database.AppDatabase; import com.cappielloantonio.play.database.AppDatabase;
import com.cappielloantonio.play.database.dao.PlaylistDao; import com.cappielloantonio.play.database.dao.PlaylistDao;
import com.cappielloantonio.play.model.Playlist; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.Playlist;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -44,7 +43,8 @@ public class PlaylistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getPlaylists() != null) { if (response.isSuccessful() && response.body() != null && response.body().getPlaylists() != null) {
List<Playlist> playlists = new ArrayList<>(MappingUtil.mapPlaylist(response.body().getPlaylists().getPlaylists())); List<Playlist> playlists = response.body().getPlaylists().getPlaylists();
if (random) { if (random) {
Collections.shuffle(playlists); Collections.shuffle(playlists);
listLivePlaylists.setValue(playlists.subList(0, Math.min(playlists.size(), size))); listLivePlaylists.setValue(playlists.subList(0, Math.min(playlists.size(), size)));
@ -62,8 +62,8 @@ public class PlaylistRepository {
return listLivePlaylists; return listLivePlaylists;
} }
public MutableLiveData<List<Media>> getPlaylistSongs(String id) { public MutableLiveData<List<Child>> getPlaylistSongs(String id) {
MutableLiveData<List<Media>> listLivePlaylistSongs = new MutableLiveData<>(); MutableLiveData<List<Child>> listLivePlaylistSongs = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getPlaylistClient() .getPlaylistClient()
@ -72,7 +72,7 @@ public class PlaylistRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getPlaylist() != null) { if (response.isSuccessful() && response.body() != null && response.body().getPlaylist() != null) {
List<Media> songs = new ArrayList<>(MappingUtil.mapSong(response.body().getPlaylist().getEntries())); List<Child> songs = response.body().getPlaylist().getEntries();
listLivePlaylistSongs.setValue(songs); listLivePlaylistSongs.setValue(songs);
} }
} }
@ -154,7 +154,8 @@ public class PlaylistRepository {
} }
public LiveData<List<Playlist>> getPinnedPlaylists(String serverId) { public LiveData<List<Playlist>> getPinnedPlaylists(String serverId) {
return playlistDao.getAll(serverId); // return playlistDao.getAll(serverId);
return playlistDao.getAll();
} }
public void insert(Playlist playlist) { public void insert(Playlist playlist) {

View file

@ -7,10 +7,9 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.model.Media; import com.cappielloantonio.play.subsonic.models.PodcastChannel;
import com.cappielloantonio.play.model.PodcastChannel; import com.cappielloantonio.play.subsonic.models.PodcastEpisode;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.List; import java.util.List;
@ -37,7 +36,7 @@ public class PodcastRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getPodcasts() != null) { if (response.isSuccessful() && response.body() != null && response.body().getPodcasts() != null) {
livePodcastChannel.setValue(MappingUtil.mapPodcastChannel(response.body().getPodcasts().getChannels())); livePodcastChannel.setValue(response.body().getPodcasts().getChannels());
} }
} }
@ -50,8 +49,8 @@ public class PodcastRepository {
return livePodcastChannel; return livePodcastChannel;
} }
public MutableLiveData<List<Media>> getNewestPodcastEpisodes(int count) { public MutableLiveData<List<PodcastEpisode>> getNewestPodcastEpisodes(int count) {
MutableLiveData<List<Media>> liveNewestPodcastEpisodes = new MutableLiveData<>(); MutableLiveData<List<PodcastEpisode>> liveNewestPodcastEpisodes = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getPodcastClient() .getPodcastClient()
@ -60,7 +59,7 @@ public class PodcastRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getNewestPodcasts() != null) { if (response.isSuccessful() && response.body() != null && response.body().getNewestPodcasts() != null) {
liveNewestPodcastEpisodes.setValue(MappingUtil.mapPodcastEpisode(response.body().getNewestPodcasts().getEpisodes())); liveNewestPodcastEpisodes.setValue(response.body().getNewestPodcasts().getEpisodes());
} }
} }

View file

@ -1,20 +1,19 @@
package com.cappielloantonio.play.repository; package com.cappielloantonio.play.repository;
import android.app.Application; import android.app.Application;
import android.util.Log;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.media3.common.MediaItem; import androidx.media3.common.MediaItem;
import com.cappielloantonio.play.database.AppDatabase; import com.cappielloantonio.play.database.AppDatabase;
import com.cappielloantonio.play.database.dao.QueueDao; import com.cappielloantonio.play.database.dao.QueueDao;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.model.Queue; import com.cappielloantonio.play.model.Queue;
import com.cappielloantonio.play.util.MappingUtil; import com.cappielloantonio.play.subsonic.models.Child;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class QueueRepository { public class QueueRepository {
private static final String TAG = "QueueRepository"; private static final String TAG = "QueueRepository";
@ -30,8 +29,8 @@ public class QueueRepository {
return queueDao.getAll(); return queueDao.getAll();
} }
public List<Media> getMedia() { public List<Child> getMedia() {
List<Media> media = new ArrayList<>(); List<Child> media = new ArrayList<>();
GetMediaThreadSafe getMedia = new GetMediaThreadSafe(queueDao); GetMediaThreadSafe getMedia = new GetMediaThreadSafe(queueDao);
Thread thread = new Thread(getMedia); Thread thread = new Thread(getMedia);
@ -39,7 +38,10 @@ public class QueueRepository {
try { try {
thread.join(); thread.join();
media = getMedia.getMedia(); media = getMedia.getMedia().stream()
.map(Child.class::cast)
.collect(Collectors.toList());
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -47,9 +49,9 @@ public class QueueRepository {
return media; return media;
} }
public void insert(Media media, boolean reset, int afterIndex) { public void insert(Child media, boolean reset, int afterIndex) {
try { try {
List<Media> mediaList = new ArrayList<>(); List<Queue> mediaList = new ArrayList<>();
if (!reset) { if (!reset) {
GetMediaThreadSafe getMediaThreadSafe = new GetMediaThreadSafe(queueDao); GetMediaThreadSafe getMediaThreadSafe = new GetMediaThreadSafe(queueDao);
@ -60,7 +62,7 @@ public class QueueRepository {
mediaList = getMediaThreadSafe.getMedia(); mediaList = getMediaThreadSafe.getMedia();
} }
mediaList.add(afterIndex, media); mediaList.add(afterIndex, (Queue) media);
Thread delete = new Thread(new DeleteAllThreadSafe(queueDao)); Thread delete = new Thread(new DeleteAllThreadSafe(queueDao));
delete.start(); delete.start();
@ -74,9 +76,9 @@ public class QueueRepository {
} }
} }
public void insertAll(List<Media> toAdd, boolean reset, int afterIndex) { public void insertAll(List<Child> toAdd, boolean reset, int afterIndex) {
try { try {
List<Media> media = new ArrayList<>(); List<Queue> media = new ArrayList<>();
if (!reset) { if (!reset) {
GetMediaThreadSafe getMediaThreadSafe = new GetMediaThreadSafe(queueDao); GetMediaThreadSafe getMediaThreadSafe = new GetMediaThreadSafe(queueDao);
@ -87,7 +89,9 @@ public class QueueRepository {
media = getMediaThreadSafe.getMedia(); media = getMediaThreadSafe.getMedia();
} }
media.addAll(afterIndex, toAdd); for (int i = 0; i < toAdd.size(); i++) {
media.add(afterIndex + i, (Queue) toAdd.get(i));
}
Thread delete = new Thread(new DeleteAllThreadSafe(queueDao)); Thread delete = new Thread(new DeleteAllThreadSafe(queueDao));
delete.start(); delete.start();
@ -206,7 +210,7 @@ public class QueueRepository {
private static class GetMediaThreadSafe implements Runnable { private static class GetMediaThreadSafe implements Runnable {
private final QueueDao queueDao; private final QueueDao queueDao;
private List<Media> media; private List<Queue> media;
public GetMediaThreadSafe(QueueDao queueDao) { public GetMediaThreadSafe(QueueDao queueDao) {
this.queueDao = queueDao; this.queueDao = queueDao;
@ -214,26 +218,26 @@ public class QueueRepository {
@Override @Override
public void run() { public void run() {
media = MappingUtil.mapQueue(queueDao.getAllSimple()); media = queueDao.getAllSimple();
} }
public List<Media> getMedia() { public List<Queue> getMedia() {
return media; return media;
} }
} }
private static class InsertAllThreadSafe implements Runnable { private static class InsertAllThreadSafe implements Runnable {
private final QueueDao queueDao; private final QueueDao queueDao;
private final List<Media> media; private final List<Queue> media;
public InsertAllThreadSafe(QueueDao queueDao, List<Media> media) { public InsertAllThreadSafe(QueueDao queueDao, List<Queue> media) {
this.queueDao = queueDao; this.queueDao = queueDao;
this.media = media; this.media = media;
} }
@Override @Override
public void run() { public void run() {
queueDao.insertAll(MappingUtil.mapMediaToQueue(media)); queueDao.insertAll(media);
} }
} }

View file

@ -8,15 +8,12 @@ import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.database.AppDatabase; import com.cappielloantonio.play.database.AppDatabase;
import com.cappielloantonio.play.database.dao.RecentSearchDao; import com.cappielloantonio.play.database.dao.RecentSearchDao;
import com.cappielloantonio.play.model.Album;
import com.cappielloantonio.play.model.Artist;
import com.cappielloantonio.play.model.RecentSearch; import com.cappielloantonio.play.model.RecentSearch;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.subsonic.models.AlbumID3; import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.subsonic.models.ArtistID3; import com.cappielloantonio.play.subsonic.models.ArtistID3;
import com.cappielloantonio.play.subsonic.models.Child; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.subsonic.models.SearchResult3;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -37,8 +34,8 @@ public class SearchingRepository {
recentSearchDao = database.recentSearchDao(); recentSearchDao = database.recentSearchDao();
} }
public MutableLiveData<List<Media>> getSearchedSongs(String query) { public MutableLiveData<SearchResult3> search(String query) {
MutableLiveData<List<Media>> searchedSongs = new MutableLiveData<>(); MutableLiveData<SearchResult3> result = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getSearchingClient() .getSearchingClient()
@ -46,13 +43,7 @@ public class SearchingRepository {
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Media> songs = new ArrayList<>(); result.setValue(response.body().getSearchResult3());
if (response.isSuccessful() && response.body() != null && response.body().getSearchResult3() != null) {
songs.addAll(MappingUtil.mapSong(response.body().getSearchResult3().getSongs()));
}
searchedSongs.setValue(songs);
} }
@Override @Override
@ -61,61 +52,7 @@ public class SearchingRepository {
} }
}); });
return searchedSongs; return result;
}
public MutableLiveData<List<Album>> getSearchedAlbums(String query) {
MutableLiveData<List<Album>> searchedAlbums = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false)
.getSearchingClient()
.search3(query, 0, 20, 0)
.enqueue(new Callback<SubsonicResponse>() {
@Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Album> albums = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getSearchResult3() != null) {
albums.addAll(MappingUtil.mapAlbum(response.body().getSearchResult3().getAlbums()));
}
searchedAlbums.setValue(albums);
}
@Override
public void onFailure(@NonNull Call<SubsonicResponse> call, @NonNull Throwable t) {
}
});
return searchedAlbums;
}
public MutableLiveData<List<Artist>> getSearchedArtists(String query) {
MutableLiveData<List<Artist>> searchedArtists = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false)
.getSearchingClient()
.search3(query, 0, 0, 20)
.enqueue(new Callback<SubsonicResponse>() {
@Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Artist> artists = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getSearchResult3() != null) {
artists.addAll(MappingUtil.mapArtist(response.body().getSearchResult3().getArtists()));
}
searchedArtists.setValue(artists);
}
@Override
public void onFailure(@NonNull Call<SubsonicResponse> call, @NonNull Throwable t) {
}
});
return searchedArtists;
} }
public MutableLiveData<List<String>> getSuggestions(String query) { public MutableLiveData<List<String>> getSuggestions(String query) {

View file

@ -6,10 +6,8 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.interfaces.MediaCallback; import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse; import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -29,8 +27,8 @@ public class SongRepository {
this.application = application; this.application = application;
} }
public MutableLiveData<List<Media>> getStarredSongs(boolean random, int size) { public MutableLiveData<List<Child>> getStarredSongs(boolean random, int size) {
MutableLiveData<List<Media>> starredSongs = new MutableLiveData<>(); MutableLiveData<List<Child>> starredSongs = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getAlbumSongListClient() .getAlbumSongListClient()
@ -39,7 +37,7 @@ public class SongRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getStarred2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getStarred2() != null) {
List<Media> songs = new ArrayList<>(MappingUtil.mapSong(response.body().getStarred2().getSongs())); List<Child> songs = response.body().getStarred2().getSongs();
if (!random) { if (!random) {
starredSongs.setValue(songs); starredSongs.setValue(songs);
@ -59,8 +57,8 @@ public class SongRepository {
return starredSongs; return starredSongs;
} }
public MutableLiveData<ArrayList<Media>> getInstantMix(Media song, int count) { public MutableLiveData<List<Child>> getInstantMix(Child song, int count) {
MutableLiveData<ArrayList<Media>> instantMix = new MutableLiveData<>(); MutableLiveData<List<Child>> instantMix = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -69,7 +67,7 @@ public class SongRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getSimilarSongs2() != null) { if (response.isSuccessful() && response.body() != null && response.body().getSimilarSongs2() != null) {
instantMix.setValue(MappingUtil.mapSong(response.body().getSimilarSongs2().getSongs())); instantMix.setValue(response.body().getSimilarSongs2().getSongs());
} }
} }
@ -82,8 +80,8 @@ public class SongRepository {
return instantMix; return instantMix;
} }
public MutableLiveData<List<Media>> getRandomSample(int number, Integer fromYear, Integer toYear) { public MutableLiveData<List<Child>> getRandomSample(int number, Integer fromYear, Integer toYear) {
MutableLiveData<List<Media>> randomSongsSample = new MutableLiveData<>(); MutableLiveData<List<Child>> randomSongsSample = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getAlbumSongListClient() .getAlbumSongListClient()
@ -91,10 +89,10 @@ public class SongRepository {
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Media> songs = new ArrayList<>(); List<Child> songs = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getRandomSongs() != null) { if (response.isSuccessful() && response.body() != null && response.body().getRandomSongs() != null) {
songs.addAll(MappingUtil.mapSong(response.body().getRandomSongs().getSongs())); songs.addAll(response.body().getRandomSongs().getSongs());
} }
randomSongsSample.setValue(songs); randomSongsSample.setValue(songs);
@ -177,8 +175,8 @@ public class SongRepository {
}); });
} }
public MutableLiveData<List<Media>> getSongsByGenre(String id) { public MutableLiveData<List<Child>> getSongsByGenre(String id) {
MutableLiveData<List<Media>> songsByGenre = new MutableLiveData<>(); MutableLiveData<List<Child>> songsByGenre = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getAlbumSongListClient() .getAlbumSongListClient()
@ -187,15 +185,15 @@ public class SongRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null && response.body().getSongsByGenre() != null) { if (response.isSuccessful() && response.body() != null && response.body().getSongsByGenre() != null) {
List<Media> newSongs = new ArrayList<>(MappingUtil.mapSong(response.body().getSongsByGenre().getSongs())); List<Child> newSongs = response.body().getSongsByGenre().getSongs();
List<Media> songs = songsByGenre.getValue(); List<Child> songs = songsByGenre.getValue();
if (songs == null) songs = new ArrayList<>(); if (songs == null) songs = new ArrayList<>();
songs.addAll(newSongs); songs.addAll(newSongs);
Collections.shuffle(songs); Collections.shuffle(songs);
LinkedHashSet<Media> hashSet = new LinkedHashSet<>(songs); LinkedHashSet<Child> hashSet = new LinkedHashSet<>(songs);
ArrayList<Media> songsWithoutDuplicates = new ArrayList<>(hashSet); ArrayList<Child> songsWithoutDuplicates = new ArrayList<>(hashSet);
songsByGenre.setValue(songsWithoutDuplicates); songsByGenre.setValue(songsWithoutDuplicates);
} }
@ -210,8 +208,8 @@ public class SongRepository {
return songsByGenre; return songsByGenre;
} }
public MutableLiveData<List<Media>> getSongsByGenres(ArrayList<String> genresId) { public MutableLiveData<List<Child>> getSongsByGenres(ArrayList<String> genresId) {
MutableLiveData<List<Media>> songsByGenre = new MutableLiveData<>(); MutableLiveData<List<Child>> songsByGenre = new MutableLiveData<>();
for (String id : genresId) for (String id : genresId)
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
@ -220,10 +218,10 @@ public class SongRepository {
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Media> songs = new ArrayList<>(); List<Child> songs = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getSongsByGenre() != null) { if (response.isSuccessful() && response.body() != null && response.body().getSongsByGenre() != null) {
songs.addAll(MappingUtil.mapSong(response.body().getSongsByGenre().getSongs())); songs.addAll(response.body().getSongsByGenre().getSongs());
} }
songsByGenre.setValue(songs); songsByGenre.setValue(songs);
@ -238,8 +236,8 @@ public class SongRepository {
return songsByGenre; return songsByGenre;
} }
public MutableLiveData<Media> getSong(String id) { public MutableLiveData<Child> getSong(String id) {
MutableLiveData<Media> song = new MutableLiveData<>(); MutableLiveData<Child> song = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getBrowsingClient() .getBrowsingClient()
@ -248,7 +246,7 @@ public class SongRepository {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
song.setValue(MappingUtil.mapSong(response.body().getSong())); song.setValue(response.body().getSong());
} }
} }
@ -261,12 +259,12 @@ public class SongRepository {
return song; return song;
} }
public MutableLiveData<String> getSongLyrics(Media song) { public MutableLiveData<String> getSongLyrics(Child song) {
MutableLiveData<String> lyrics = new MutableLiveData<>(null); MutableLiveData<String> lyrics = new MutableLiveData<>(null);
App.getSubsonicClientInstance(application, false) App.getSubsonicClientInstance(application, false)
.getMediaRetrievalClient() .getMediaRetrievalClient()
.getLyrics(song.getArtistName(), song.getTitle()) .getLyrics(song.getArtist(), song.getTitle())
.enqueue(new Callback<SubsonicResponse>() { .enqueue(new Callback<SubsonicResponse>() {
@Override @Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) { public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {

View file

@ -1,17 +1,16 @@
package com.cappielloantonio.play.service; package com.cappielloantonio.play.service;
import android.content.Context; import android.content.Context;
import android.util.Log;
import androidx.media3.common.MediaItem; import androidx.media3.common.MediaItem;
import androidx.media3.session.MediaBrowser; import androidx.media3.session.MediaBrowser;
import com.cappielloantonio.play.App; import com.cappielloantonio.play.App;
import com.cappielloantonio.play.interfaces.MediaIndexCallback; import com.cappielloantonio.play.interfaces.MediaIndexCallback;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.repository.ChronologyRepository; import com.cappielloantonio.play.repository.ChronologyRepository;
import com.cappielloantonio.play.repository.QueueRepository; import com.cappielloantonio.play.repository.QueueRepository;
import com.cappielloantonio.play.repository.SongRepository; import com.cappielloantonio.play.repository.SongRepository;
import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.util.MappingUtil; import com.cappielloantonio.play.util.MappingUtil;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors;
@ -64,7 +63,7 @@ public class MediaManager {
try { try {
if (mediaBrowserListenableFuture.isDone()) { if (mediaBrowserListenableFuture.isDone()) {
if (mediaBrowserListenableFuture.get().getMediaItemCount() < 1) { if (mediaBrowserListenableFuture.get().getMediaItemCount() < 1) {
List<Media> media = getQueueRepository().getMedia(); List<Child> media = getQueueRepository().getMedia();
if (media != null && media.size() >= 1) { if (media != null && media.size() >= 1) {
init(mediaBrowserListenableFuture, context, media); init(mediaBrowserListenableFuture, context, media);
} }
@ -77,7 +76,7 @@ public class MediaManager {
} }
} }
public static void init(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, List<Media> media) { public static void init(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, List<Child> media) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -164,7 +163,7 @@ public class MediaManager {
} }
} }
public static void startQueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, List<Media> media, int startIndex) { public static void startQueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, List<Child> media, int startIndex) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -183,7 +182,7 @@ public class MediaManager {
} }
} }
public static void startQueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, Media media) { public static void startQueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, Child media) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -201,7 +200,7 @@ public class MediaManager {
} }
} }
public static void enqueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, List<Media> media, boolean playImmediatelyAfter) { public static void enqueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, List<Child> media, boolean playImmediatelyAfter) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -221,7 +220,7 @@ public class MediaManager {
} }
} }
public static void enqueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, Media media, boolean playImmediatelyAfter) { public static void enqueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Context context, Child media, boolean playImmediatelyAfter) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -241,7 +240,7 @@ public class MediaManager {
} }
} }
public static void swap(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, List<Media> media, int from, int to) { public static void swap(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, List<Child> media, int from, int to) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -256,7 +255,7 @@ public class MediaManager {
} }
} }
public static void remove(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, List<Media> media, int toRemove) { public static void remove(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, List<Child> media, int toRemove) {
if (mediaBrowserListenableFuture != null) { if (mediaBrowserListenableFuture != null) {
mediaBrowserListenableFuture.addListener(() -> { mediaBrowserListenableFuture.addListener(() -> {
try { try {
@ -307,7 +306,7 @@ public class MediaManager {
public static void saveChronology(MediaItem mediaItem) { public static void saveChronology(MediaItem mediaItem) {
if (mediaItem != null) if (mediaItem != null)
if (getQueueRepository().isMediaPlayingPlausible(mediaItem)) if (getQueueRepository().isMediaPlayingPlausible(mediaItem))
getChronologyRepository().insert(MappingUtil.mapChronology(mediaItem)); getChronologyRepository().insert(mediaItem.mediaMetadata.extras.getParcelable("child"));
} }
private static QueueRepository getQueueRepository() { private static QueueRepository getQueueRepository() {
@ -322,19 +321,19 @@ public class MediaManager {
return new ChronologyRepository(App.getInstance()); return new ChronologyRepository(App.getInstance());
} }
private static void enqueueDatabase(List<Media> media, boolean reset, int afterIndex) { private static void enqueueDatabase(List<Child> media, boolean reset, int afterIndex) {
getQueueRepository().insertAll(media, reset, afterIndex); getQueueRepository().insertAll(media, reset, afterIndex);
} }
private static void enqueueDatabase(Media media, boolean reset, int afterIndex) { private static void enqueueDatabase(Child media, boolean reset, int afterIndex) {
getQueueRepository().insert(media, reset, afterIndex); getQueueRepository().insert(media, reset, afterIndex);
} }
private static void swapDatabase(List<Media> media) { private static void swapDatabase(List<Child> media) {
getQueueRepository().insertAll(media, true, 0); getQueueRepository().insertAll(media, true, 0);
} }
private static void removeDatabase(List<Media> media, int toRemove) { private static void removeDatabase(List<Child> media, int toRemove) {
if (toRemove != -1) { if (toRemove != -1) {
media.remove(toRemove); media.remove(toRemove);
getQueueRepository().insertAll(media, true, 0); getQueueRepository().insertAll(media, true, 0);

View file

@ -115,13 +115,16 @@ public class Subsonic {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("u", preferences.getUsername()); params.put("u", preferences.getUsername());
if (preferences.getAuthentication().getPassword() != null) params.put("p", preferences.getAuthentication().getPassword()); if (preferences.getAuthentication().getPassword() != null)
if (preferences.getAuthentication().getSalt() != null) params.put("s", preferences.getAuthentication().getSalt()); params.put("p", preferences.getAuthentication().getPassword());
if (preferences.getAuthentication().getToken() != null) params.put("t", preferences.getAuthentication().getToken()); if (preferences.getAuthentication().getSalt() != null)
params.put("s", preferences.getAuthentication().getSalt());
if (preferences.getAuthentication().getToken() != null)
params.put("t", preferences.getAuthentication().getToken());
params.put("v", getApiVersion().getVersionString()); params.put("v", getApiVersion().getVersionString());
params.put("c", preferences.getClientName()); params.put("c", preferences.getClientName());
params.put("f", "xml"); params.put("f", "json");
return params; return params;
} }

View file

@ -1,131 +1,48 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter; import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import java.util.Date; import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml(name = "album") @Xml(name = "album")
public class AlbumID3 { open class AlbumID3 : Parcelable {
@Attribute @Attribute
protected String id; var id: String? = null
@Attribute @Attribute
protected String name; var name: String? = null
@Attribute @Attribute
protected String artist; var artist: String? = null
@Attribute @Attribute
protected String artistId; var artistId: String? = null
@Attribute(name = "coverArt") @Attribute(name = "coverArt")
protected String coverArtId; var coverArtId: String? = null
@Attribute @Attribute
protected int songCount; var songCount = 0
@Attribute @Attribute
protected int duration; var duration = 0
@Attribute @Attribute
protected Long playCount; var playCount: Long? = null
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created; @Attribute(converter = DateRfc3339TypeConverter::class)
@Attribute(converter = DateRfc3339TypeConverter.class) var created: Date? = null
protected Date starred;
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null
@Attribute @Attribute
protected Integer year; var year: Int? = null
@Attribute @Attribute
protected String genre; var genre: String? = null
public String getId() {
return id;
}
public void setId(String value) {
this.id = value;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
public String getArtist() {
return artist;
}
public void setArtist(String value) {
this.artist = value;
}
public String getArtistId() {
return artistId;
}
public void setArtistId(String value) {
this.artistId = value;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String value) {
this.coverArtId = value;
}
public int getSongCount() {
return songCount;
}
public void setSongCount(int value) {
this.songCount = value;
}
public int getDuration() {
return duration;
}
public void setDuration(int value) {
this.duration = value;
}
public Long getPlayCount() {
return playCount;
}
public void setPlayCount(Long value) {
this.playCount = value;
}
public Date getCreated() {
return created;
}
public void setCreated(Date value) {
this.created = value;
}
public Date getStarred() {
return starred;
}
public void setStarred(Date value) {
this.starred = value;
}
public Integer getYear() {
return year;
}
public void setYear(Integer value) {
this.year = value;
}
public String getGenre() {
return genre;
}
public void setGenre(String value) {
this.genre = value;
}
} }

View file

@ -1,68 +1,25 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class AlbumInfo { class AlbumInfo {
@Attribute @Attribute
protected String notes; var notes: String? = null
@Attribute @Attribute
protected String musicBrainzId; var musicBrainzId: String? = null
@Attribute @Attribute
protected String lastFmUrl; var lastFmUrl: String? = null
@Attribute @Attribute
protected String smallImageUrl; var smallImageUrl: String? = null
@Attribute @Attribute
protected String mediumImageUrl; var mediumImageUrl: String? = null
@Attribute @Attribute
protected String largeImageUrl; var largeImageUrl: String? = null
public String getNotes() {
return notes;
}
public void setNotes(String value) {
this.notes = value;
}
public String getMusicBrainzId() {
return musicBrainzId;
}
public void setMusicBrainzId(String value) {
this.musicBrainzId = value;
}
public String getLastFmUrl() {
return lastFmUrl;
}
public void setLastFmUrl(String value) {
this.lastFmUrl = value;
}
public String getSmallImageUrl() {
return smallImageUrl;
}
public void setSmallImageUrl(String value) {
this.smallImageUrl = value;
}
public String getMediumImageUrl() {
return mediumImageUrl;
}
public void setMediumImageUrl(String value) {
this.mediumImageUrl = value;
}
public String getLargeImageUrl() {
return largeImageUrl;
}
public void setLargeImageUrl(String value) {
this.largeImageUrl = value;
}
} }

View file

@ -1,35 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class AlbumList {
import java.util.List; var albums: List<Child>? = null
public class AlbumList {
protected List<Child> albums;
/**
* Gets the value of the albums property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the albums property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAlbums().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getAlbums() {
if (albums == null) {
albums = new ArrayList<>();
}
return this.albums;
}
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class AlbumList2 { class AlbumList2 {
@Element @Element
protected List<AlbumID3> albums; var albums: List<AlbumID3>? = null
public List<AlbumID3> getAlbums() {
if (albums == null) {
albums = new ArrayList<>();
}
return this.albums;
}
public void setAlbums(List<AlbumID3> albums) {
this.albums = albums;
}
} }

View file

@ -1,24 +1,13 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList; import kotlinx.android.parcel.Parcelize
import java.util.List;
@Parcelize
@Xml @Xml
public class AlbumWithSongsID3 extends AlbumID3 { class AlbumWithSongsID3 : AlbumID3(), Parcelable {
@Element(name = "song") @Element(name = "song")
protected List<Child> songs; var songs: List<Child>? = null
public List<Child> getSongs() {
if (songs == null) {
songs = new ArrayList<>();
}
return this.songs;
}
public void setSongs(List<Child> songs) {
this.songs = songs;
}
} }

View file

@ -1,112 +1,71 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime; import java.time.LocalDateTime
public class Artist {
protected String id;
protected String name;
protected LocalDateTime starred;
protected Integer userRating;
protected Double averageRating;
class Artist {
/** /**
* Gets the value of the id property. * Gets the value of the id property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getId() {
return id;
}
/** /**
* Sets the value of the id property. * Sets the value of the id property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setId(String value) { var id: String? = null
this.id = value;
}
/** /**
* Gets the value of the name property. * Gets the value of the name property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getName() {
return name;
}
/** /**
* Sets the value of the name property. * Sets the value of the name property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setName(String value) { var name: String? = null
this.name = value;
}
/** /**
* Gets the value of the starred property. * Gets the value of the starred property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public LocalDateTime getStarred() {
return starred;
}
/** /**
* Sets the value of the starred property. * Sets the value of the starred property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setStarred(LocalDateTime value) { var starred: LocalDateTime? = null
this.starred = value;
}
/** /**
* Gets the value of the userRating property. * Gets the value of the userRating property.
* *
* @return possible object is * @return possible object is
* {@link Integer } * [Integer]
*/ */
public Integer getUserRating() {
return userRating;
}
/** /**
* Sets the value of the userRating property. * Sets the value of the userRating property.
* *
* @param value allowed object is * @param value allowed object is
* {@link Integer } * [Integer]
*/ */
public void setUserRating(Integer value) { var userRating: Int? = null
this.userRating = value;
}
/** /**
* Gets the value of the averageRating property. * Gets the value of the averageRating property.
* *
* @return possible object is * @return possible object is
* {@link Double } * [Double]
*/ */
public Double getAverageRating() {
return averageRating;
}
/** /**
* Sets the value of the averageRating property. * Sets the value of the averageRating property.
* *
* @param value allowed object is * @param value allowed object is
* {@link Double } * [Double]
*/ */
public void setAverageRating(Double value) { var averageRating: Double? = null
this.averageRating = value;
}
} }

View file

@ -1,62 +1,27 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter; import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import java.util.Date; import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml(name = "artist") @Xml(name = "artist")
public class ArtistID3 { open class ArtistID3 : Parcelable {
@Attribute @Attribute
protected String id; var id: String? = null
@Attribute @Attribute
protected String name; var name: String? = null
@Attribute(name = "coverArt") @Attribute(name = "coverArt")
protected String coverArtId; var coverArtId: String? = null
@Attribute @Attribute
protected int albumCount; var albumCount = 0
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date starred;
public String getId() {
return id;
}
public void setId(String value) {
this.id = value;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String value) {
this.coverArtId = value;
}
public int getAlbumCount() {
return albumCount;
}
public void setAlbumCount(int value) {
this.albumCount = value;
}
public Date getStarred() {
return starred;
}
public void setStarred(Date value) {
this.starred = value;
}
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null
} }

View file

@ -1,36 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
public class ArtistInfo extends ArtistInfoBase {
protected List<Artist> similarArtists;
/**
* Gets the value of the similarArtists property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the similarArtists property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSimilarArtists().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Artist }
*/
public List<Artist> getSimilarArtists() {
if (similarArtists == null) {
similarArtists = new ArrayList<>();
}
return this.similarArtists;
}
class ArtistInfo : ArtistInfoBase() {
var similarArtists: List<Artist>? = null
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class ArtistInfo2 extends ArtistInfoBase { class ArtistInfo2 : ArtistInfoBase() {
@Element(name = "similarArtist") @Element(name = "similarArtist")
protected List<SimilarArtistID3> similarArtists; var similarArtists: List<SimilarArtistID3>? = null
public List<SimilarArtistID3> getSimilarArtists() {
if (similarArtists == null) {
similarArtists = new ArrayList<>();
}
return this.similarArtists;
}
public void setSimilarArtists(List<SimilarArtistID3> similarArtists) {
this.similarArtists = similarArtists;
}
} }

View file

@ -1,68 +1,25 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.PropertyElement; import com.tickaroo.tikxml.annotation.PropertyElement
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class ArtistInfoBase { open class ArtistInfoBase {
@PropertyElement @PropertyElement
protected String biography; var biography: String? = null
@PropertyElement @PropertyElement
protected String musicBrainzId; var musicBrainzId: String? = null
@PropertyElement @PropertyElement
protected String lastFmUrl; var lastFmUrl: String? = null
@PropertyElement @PropertyElement
protected String smallImageUrl; var smallImageUrl: String? = null
@PropertyElement @PropertyElement
protected String mediumImageUrl; var mediumImageUrl: String? = null
@PropertyElement @PropertyElement
protected String largeImageUrl; var largeImageUrl: String? = null
public String getBiography() {
return biography;
}
public void setBiography(String value) {
this.biography = value;
}
public String getMusicBrainzId() {
return musicBrainzId;
}
public void setMusicBrainzId(String value) {
this.musicBrainzId = value;
}
public String getLastFmUrl() {
return lastFmUrl;
}
public void setLastFmUrl(String value) {
this.lastFmUrl = value;
}
public String getSmallImageUrl() {
return smallImageUrl;
}
public void setSmallImageUrl(String value) {
this.smallImageUrl = value;
}
public String getMediumImageUrl() {
return mediumImageUrl;
}
public void setMediumImageUrl(String value) {
this.mediumImageUrl = value;
}
public String getLargeImageUrl() {
return largeImageUrl;
}
public void setLargeImageUrl(String value) {
this.largeImageUrl = value;
}
} }

View file

@ -1,24 +1,13 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList; import kotlinx.android.parcel.Parcelize
import java.util.List;
@Parcelize
@Xml @Xml
public class ArtistWithAlbumsID3 extends ArtistID3 { class ArtistWithAlbumsID3 : ArtistID3(), Parcelable {
@Element(name = "album") @Element(name = "album")
protected List<AlbumID3> albums; var albums: List<AlbumID3>? = null
public List<AlbumID3> getAlbums() {
if (albums == null) {
albums = new ArrayList<>();
}
return this.albums;
}
public void setAlbums(List<AlbumID3> albums) {
this.albums = albums;
}
} }

View file

@ -1,33 +1,11 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class ArtistsID3 { class ArtistsID3 {
@Element(name = "index") @Element(name = "index")
protected List<IndexID3> indices; var indices: List<IndexID3>? = null
protected String ignoredArticles; var ignoredArticles: String? = null
public List<IndexID3> getIndices() {
if (indices == null) {
indices = new ArrayList<>();
}
return this.indices;
}
public void setIndices(List<IndexID3> indices) {
this.indices = indices;
}
public String getIgnoredArticles() {
return ignoredArticles;
}
public void setIgnoredArticles(String value) {
this.ignoredArticles = value;
}
} }

View file

@ -1,67 +1,43 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class AudioTrack {
protected String id;
protected String name;
protected String languageCode;
class AudioTrack {
/** /**
* Gets the value of the id property. * Gets the value of the id property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getId() {
return id;
}
/** /**
* Sets the value of the id property. * Sets the value of the id property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setId(String value) { var id: String? = null
this.id = value;
}
/** /**
* Gets the value of the name property. * Gets the value of the name property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getName() {
return name;
}
/** /**
* Sets the value of the name property. * Sets the value of the name property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setName(String value) { var name: String? = null
this.name = value;
}
/** /**
* Gets the value of the languageCode property. * Gets the value of the languageCode property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getLanguageCode() {
return languageCode;
}
/** /**
* Sets the value of the languageCode property. * Sets the value of the languageCode property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setLanguageCode(String value) { var languageCode: String? = null
this.languageCode = value;
}
} }

View file

@ -1,126 +1,78 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime; import java.time.LocalDateTime
public class Bookmark {
protected Child entry;
protected long position;
protected String username;
protected String comment;
protected LocalDateTime created;
protected LocalDateTime changed;
class Bookmark {
/** /**
* Gets the value of the entry property. * Gets the value of the entry property.
* *
* @return possible object is * @return possible object is
* {@link Child } * [Child]
*/ */
public Child getEntry() {
return entry;
}
/** /**
* Sets the value of the entry property. * Sets the value of the entry property.
* *
* @param value allowed object is * @param value allowed object is
* {@link Child } * [Child]
*/ */
public void setEntry(Child value) { var entry: Child? = null
this.entry = value;
}
/** /**
* Gets the value of the position property. * Gets the value of the position property.
*/ */
public long getPosition() {
return position;
}
/** /**
* Sets the value of the position property. * Sets the value of the position property.
*/ */
public void setPosition(long value) { var position: Long = 0
this.position = value;
}
/** /**
* Gets the value of the username property. * Gets the value of the username property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getUsername() {
return username;
}
/** /**
* Sets the value of the username property. * Sets the value of the username property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setUsername(String value) { var username: String? = null
this.username = value;
}
/** /**
* Gets the value of the comment property. * Gets the value of the comment property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getComment() {
return comment;
}
/** /**
* Sets the value of the comment property. * Sets the value of the comment property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setComment(String value) { var comment: String? = null
this.comment = value;
}
/** /**
* Gets the value of the created property. * Gets the value of the created property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public LocalDateTime getCreated() {
return created;
}
/** /**
* Sets the value of the created property. * Sets the value of the created property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setCreated(LocalDateTime value) { var created: LocalDateTime? = null
this.created = value;
}
/** /**
* Gets the value of the changed property. * Gets the value of the changed property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public LocalDateTime getChanged() {
return changed;
}
/** /**
* Sets the value of the changed property. * Sets the value of the changed property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setChanged(LocalDateTime value) { var changed: LocalDateTime? = null
this.changed = value;
}
} }

View file

@ -1,36 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
public class Bookmarks {
protected List<Bookmark> bookmarks;
/**
* Gets the value of the bookmarks property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the bookmarks property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getBookmarks().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Bookmark }
*/
public List<Bookmark> getBookmarks() {
if (bookmarks == null) {
bookmarks = new ArrayList<>();
}
return this.bookmarks;
}
class Bookmarks {
var bookmarks: List<Bookmark>? = null
} }

View file

@ -1,46 +1,30 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class Captions {
protected String id;
protected String name;
class Captions {
/** /**
* Gets the value of the id property. * Gets the value of the id property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getId() {
return id;
}
/** /**
* Sets the value of the id property. * Sets the value of the id property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setId(String value) { var id: String? = null
this.id = value;
}
/** /**
* Gets the value of the name property. * Gets the value of the name property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getName() {
return name;
}
/** /**
* Sets the value of the name property. * Sets the value of the name property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setName(String value) { var name: String? = null
this.name = value;
}
} }

View file

@ -1,61 +1,37 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class ChatMessage {
protected String username;
protected long time;
protected String message;
class ChatMessage {
/** /**
* Gets the value of the username property. * Gets the value of the username property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getUsername() {
return username;
}
/** /**
* Sets the value of the username property. * Sets the value of the username property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setUsername(String value) { var username: String? = null
this.username = value;
}
/** /**
* Gets the value of the time property. * Gets the value of the time property.
*/ */
public long getTime() {
return time;
}
/** /**
* Sets the value of the time property. * Sets the value of the time property.
*/ */
public void setTime(long value) { var time: Long = 0
this.time = value;
}
/** /**
* Gets the value of the message property. * Gets the value of the message property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getMessage() {
return message;
}
/** /**
* Sets the value of the message property. * Sets the value of the message property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setMessage(String value) { var message: String? = null
this.message = value;
}
} }

View file

@ -1,35 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class ChatMessages {
import java.util.List; var chatMessages: List<ChatMessage>? = null
public class ChatMessages {
protected List<ChatMessage> chatMessages;
/**
* Gets the value of the chatMessages property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the chatMessages property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getChatMessages().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ChatMessage }
*/
public List<ChatMessage> getChatMessages() {
if (chatMessages == null) {
chatMessages = new ArrayList<>();
}
return this.chatMessages;
}
} }

View file

@ -1,322 +1,139 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Element; import androidx.room.ColumnInfo
import com.tickaroo.tikxml.annotation.Xml; import androidx.room.PrimaryKey
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
import java.util.Date; import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml @Xml
public class Child { open class Child(
@PrimaryKey
@ColumnInfo(name = "id")
@Attribute @Attribute
protected String id; open val id: String,
@ColumnInfo(name = "parent_id")
@Attribute(name = "parent") @Attribute(name = "parent")
protected String parentId; var parentId: String? = null,
@Attribute(name = "isDir")
protected boolean dir; @ColumnInfo(name = "is_dir")
@Attribute @Attribute
protected String title; var isDir: Boolean = false,
@ColumnInfo
@Attribute @Attribute
protected String album; var title: String? = null,
@ColumnInfo
@Attribute @Attribute
protected String artist; var album: String? = null,
@ColumnInfo
@Attribute @Attribute
protected Integer track; var artist: String? = null,
@ColumnInfo
@Attribute @Attribute
protected Integer year; var track: Int? = null,
@ColumnInfo
@Attribute
var year: Int? = null,
@ColumnInfo
@Attribute(name = "genre") @Attribute(name = "genre")
protected String genre; var genre: String? = null,
@ColumnInfo(name = "cover_art_id")
@Attribute(name = "coverArt") @Attribute(name = "coverArt")
protected String coverArtId; var coverArtId: String? = null,
@ColumnInfo
@Attribute @Attribute
protected Long size; var size: Long? = null,
@ColumnInfo(name = "content_type")
@Attribute @Attribute
protected String contentType; var contentType: String? = null,
@ColumnInfo
@Attribute @Attribute
protected String suffix; var suffix: String? = null,
@ColumnInfo("transcoding_content_type")
@Attribute @Attribute
protected String transcodedContentType; var transcodedContentType: String? = null,
@ColumnInfo(name = "transcoded_suffix")
@Attribute @Attribute
protected String transcodedSuffix; var transcodedSuffix: String? = null,
@ColumnInfo
@Attribute @Attribute
protected Integer duration; var duration: Int? = null,
@ColumnInfo("bitrate")
@Attribute(name = "bitRate")
var bitrate: Int? = null,
@ColumnInfo
@Attribute @Attribute
protected Integer bitRate; var path: String? = null,
@Attribute
protected String path; @ColumnInfo(name = "is_video")
@Attribute(name = "isVideo") @Attribute(name = "isVideo")
protected Boolean video; var isVideo: Boolean = false,
@ColumnInfo(name = "user_rating")
@Attribute @Attribute
protected Integer userRating; var userRating: Int? = null,
@ColumnInfo(name = "average_rating")
@Attribute @Attribute
protected Double averageRating; var averageRating: Double? = null,
@ColumnInfo(name = "play_count")
@Attribute @Attribute
protected Long playCount; var playCount: Long? = null,
@ColumnInfo(name = "disc_number")
@Attribute @Attribute
protected Integer discNumber; var discNumber: Int? = null,
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created; @ColumnInfo
@Attribute(converter = DateRfc3339TypeConverter.class) @Attribute(converter = DateRfc3339TypeConverter::class)
protected Date starred; var created: Date? = null,
@ColumnInfo
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null,
@ColumnInfo(name = "album_id")
@Attribute @Attribute
protected String albumId; var albumId: String? = null,
@ColumnInfo(name = "artist_id")
@Attribute @Attribute
protected String artistId; var artistId: String? = null,
@ColumnInfo
@Attribute @Attribute
protected String type; var type: String? = null,
@ColumnInfo(name = "bookmark_position")
@Attribute @Attribute
protected Long bookmarkPosition; var bookmarkPosition: Long? = null,
@ColumnInfo(name = "original_width")
@Attribute @Attribute
protected Integer originalWidth; var originalWidth: Int? = null,
@ColumnInfo(name = "original_height")
@Attribute @Attribute
protected Integer originalHeight; var originalHeight: Int? = null
) : Parcelable
public String getId() {
return id;
}
public void setId(String value) {
this.id = value;
}
public String getParentId() {
return parentId;
}
public void setParentId(String value) {
this.parentId = value;
}
public boolean isDir() {
return dir;
}
public void setDir(boolean value) {
this.dir = value;
}
public String getTitle() {
return title;
}
public void setTitle(String value) {
this.title = value;
}
public String getAlbum() {
return album;
}
public void setAlbum(String value) {
this.album = value;
}
public String getArtist() {
return artist;
}
public void setArtist(String value) {
this.artist = value;
}
public Integer getTrack() {
return track;
}
public void setTrack(Integer value) {
this.track = value;
}
public Integer getYear() {
return year;
}
public void setYear(Integer value) {
this.year = value;
}
public String getGenre() {
return genre;
}
public void setGenre(String value) {
this.genre = value;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String value) {
this.coverArtId = value;
}
public Long getSize() {
return size;
}
public void setSize(Long value) {
this.size = value;
}
public String getContentType() {
return contentType;
}
public void setContentType(String value) {
this.contentType = value;
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String value) {
this.suffix = value;
}
public String getTranscodedContentType() {
return transcodedContentType;
}
public void setTranscodedContentType(String value) {
this.transcodedContentType = value;
}
public String getTranscodedSuffix() {
return transcodedSuffix;
}
public void setTranscodedSuffix(String value) {
this.transcodedSuffix = value;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer value) {
this.duration = value;
}
public Integer getBitRate() {
return bitRate;
}
public void setBitRate(Integer value) {
this.bitRate = value;
}
public String getPath() {
return path;
}
public void setPath(String value) {
this.path = value;
}
public Boolean isVideo() {
return video;
}
public void setVideo(Boolean value) {
this.video = value;
}
public Integer getUserRating() {
return userRating;
}
public void setUserRating(Integer value) {
this.userRating = value;
}
public Double getAverageRating() {
return averageRating;
}
public void setAverageRating(Double value) {
this.averageRating = value;
}
public Long getPlayCount() {
return playCount;
}
public void setPlayCount(Long value) {
this.playCount = value;
}
public Integer getDiscNumber() {
return discNumber;
}
public void setDiscNumber(Integer value) {
this.discNumber = value;
}
public Date getCreated() {
return created;
}
public void setCreated(Date value) {
this.created = value;
}
public Date getStarred() {
return starred;
}
public void setStarred(Date value) {
this.starred = value;
}
public String getAlbumId() {
return albumId;
}
public void setAlbumId(String value) {
this.albumId = value;
}
public String getArtistId() {
return artistId;
}
public void setArtistId(String value) {
this.artistId = value;
}
public String getType() {
return type;
}
public void setType(String value) {
this.type = value;
}
public Long getBookmarkPosition() {
return bookmarkPosition;
}
public void setBookmarkPosition(Long value) {
this.bookmarkPosition = value;
}
public Integer getOriginalWidth() {
return originalWidth;
}
public void setOriginalWidth(Integer value) {
this.originalWidth = value;
}
public Integer getOriginalHeight() {
return originalHeight;
}
public void setOriginalHeight(Integer value) {
this.originalHeight = value;
}
}

View file

@ -1,183 +1,128 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime; import java.time.LocalDateTime
import java.util.ArrayList;
import java.util.List;
public class Directory { class Directory {
protected List<Child> children; protected var children: List<Child>? = null
protected String id; /**
protected String parentId; * Gets the value of the id property.
protected String name; *
protected LocalDateTime starred; * @return possible object is
protected Integer userRating; * [String]
protected Double averageRating; */
protected Long playCount; /**
* Sets the value of the id property.
*
* @param value allowed object is
* [String]
*/
var id: String? = null
/**
* Gets the value of the parentId property.
*
* @return possible object is
* [String]
*/
/**
* Sets the value of the parentId property.
*
* @param value allowed object is
* [String]
*/
var parentId: String? = null
/**
* Gets the value of the name property.
*
* @return possible object is
* [String]
*/
/**
* Sets the value of the name property.
*
* @param value allowed object is
* [String]
*/
var name: String? = null
/**
* Gets the value of the starred property.
*
* @return possible object is
* [String]
*/
/**
* Sets the value of the starred property.
*
* @param value allowed object is
* [String]
*/
var starred: LocalDateTime? = null
/**
* Gets the value of the userRating property.
*
* @return possible object is
* [Integer]
*/
/**
* Sets the value of the userRating property.
*
* @param value allowed object is
* [Integer]
*/
var userRating: Int? = null
/**
* Gets the value of the averageRating property.
*
* @return possible object is
* [Double]
*/
/**
* Sets the value of the averageRating property.
*
* @param value allowed object is
* [Double]
*/
var averageRating: Double? = null
/**
* Gets the value of the playCount property.
*
* @return possible object is
* [Long]
*/
/**
* Sets the value of the playCount property.
*
* @param value allowed object is
* [Long]
*/
var playCount: Long? = null
/** /**
* Gets the value of the children property. * Gets the value of the children property.
* *
* <p> *
*
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the * not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object. * returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the children property. * This is why there is not a <CODE>set</CODE> method for the children property.
* *
* <p> *
*
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
* <pre> * <pre>
* getchildren().add(newItem); * getchildren().add(newItem);
* </pre> </pre> *
*
*
* *
* *
* <p>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link Child } * [Child]
*/ */
public List<Child> getchildren() { fun getchildren(): List<Child>? {
if (children == null) { if (children == null) {
children = new ArrayList<>(); children = ArrayList()
} }
return this.children; return children
}
/**
* Gets the value of the id property.
*
* @return possible object is
* {@link String }
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value allowed object is
* {@link String }
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the parentId property.
*
* @return possible object is
* {@link String }
*/
public String getParentId() {
return parentId;
}
/**
* Sets the value of the parentId property.
*
* @param value allowed object is
* {@link String }
*/
public void setParentId(String value) {
this.parentId = value;
}
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value allowed object is
* {@link String }
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the starred property.
*
* @return possible object is
* {@link String }
*/
public LocalDateTime getStarred() {
return starred;
}
/**
* Sets the value of the starred property.
*
* @param value allowed object is
* {@link String }
*/
public void setStarred(LocalDateTime value) {
this.starred = value;
}
/**
* Gets the value of the userRating property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getUserRating() {
return userRating;
}
/**
* Sets the value of the userRating property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setUserRating(Integer value) {
this.userRating = value;
}
/**
* Gets the value of the averageRating property.
*
* @return possible object is
* {@link Double }
*/
public Double getAverageRating() {
return averageRating;
}
/**
* Sets the value of the averageRating property.
*
* @param value allowed object is
* {@link Double }
*/
public void setAverageRating(Double value) {
this.averageRating = value;
}
/**
* Gets the value of the playCount property.
*
* @return possible object is
* {@link Long }
*/
public Long getPlayCount() {
return playCount;
}
/**
* Sets the value of the playCount property.
*
* @param value allowed object is
* {@link Long }
*/
public void setPlayCount(Long value) {
this.playCount = value;
} }
} }

View file

@ -1,29 +1,14 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.cappielloantonio.play.subsonic.utils.converter.ErrorCodeConverter; import com.cappielloantonio.play.subsonic.utils.converter.ErrorCodeConverter
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class Error { class Error {
@Attribute(converter = ErrorCodeConverter.class) @Attribute(converter = ErrorCodeConverter::class)
protected ErrorCode code; var code: ErrorCode? = null
@Attribute @Attribute
protected String message; var message: String? = null
public ErrorCode getCode() {
return code;
}
public void setCode(ErrorCode value) {
this.code = value;
}
public String getMessage() {
return message;
}
public void setMessage(String value) {
this.message = value;
}
} }

View file

@ -1,23 +1,16 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class ErrorCode { class ErrorCode(val value: Int) {
public static int GENERIC_ERROR = 0;
public static int REQUIRED_PARAMETER_MISSING = 10;
public static int INCOMPATIBLE_VERSION_CLIENT = 20;
public static int INCOMPATIBLE_VERSION_SERVER = 30;
public static int WRONG_USERNAME_OR_PASSWORD = 40;
public static int TOKEN_AUTHENTICATION_NOT_SUPPORTED = 41;
public static int USER_NOT_AUTHORIZED = 50;
public static int TRIAL_PERIOD_OVER = 60;
public static int DATA_NOT_FOUND = 70;
private final int value; companion object {
var GENERIC_ERROR = 0
public ErrorCode(int value) { var REQUIRED_PARAMETER_MISSING = 10
this.value = value; var INCOMPATIBLE_VERSION_CLIENT = 20
} var INCOMPATIBLE_VERSION_SERVER = 30
var WRONG_USERNAME_OR_PASSWORD = 40
public int getValue() { var TOKEN_AUTHENTICATION_NOT_SUPPORTED = 41
return value; var USER_NOT_AUTHORIZED = 50
var TRIAL_PERIOD_OVER = 60
var DATA_NOT_FOUND = 70
} }
} }

View file

@ -1,39 +1,20 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.TextContent; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.TextContent
import com.tickaroo.tikxml.annotation.Xml
import kotlinx.android.parcel.Parcelize
@Parcelize
@Xml @Xml
public class Genre { class Genre : Parcelable {
@TextContent @TextContent
protected String genre; var genre: String? = null
@Attribute @Attribute
protected int songCount; var songCount = 0
@Attribute @Attribute
protected int albumCount; var albumCount = 0
public String getGenre() {
return genre;
}
public void setGenre(String value) {
this.genre = value;
}
public int getSongCount() {
return songCount;
}
public void setSongCount(int value) {
this.songCount = value;
}
public int getAlbumCount() {
return albumCount;
}
public void setAlbumCount(int value) {
this.albumCount = value;
}
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class Genres { class Genres {
@Element @Element
protected List<Genre> genres; var genres: List<Genre>? = null
public List<Genre> getGenres() {
if (genres == null) {
genres = new ArrayList<>();
}
return this.genres;
}
public void setGenres(List<Genre> genres) {
this.genres = genres;
}
} }

View file

@ -1,56 +1,6 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class Index {
import java.util.List; var artists: List<Artist>? = null
var name: String? = null
public class Index {
protected List<Artist> artists;
protected String name;
/**
* Gets the value of the artists property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the artists property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getArtists().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Artist }
*/
public List<Artist> getArtists() {
if (artists == null) {
artists = new ArrayList<>();
}
return this.artists;
}
/**
* Gets the value of the name property.
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value allowed object is
* {@link String }
*/
public void setName(String value) {
this.name = value;
}
} }

View file

@ -1,33 +1,11 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class IndexID3 { class IndexID3 {
@Element(name = "artist") @Element(name = "artist")
protected List<ArtistID3> artists; var artists: List<ArtistID3>? = null
protected String name; var name: String? = null
public List<ArtistID3> getArtists() {
if (artists == null) {
artists = new ArrayList<>();
}
return this.artists;
}
public void setArtists(List<ArtistID3> artists) {
this.artists = artists;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
} }

View file

@ -1,127 +1,9 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class Indexes {
import java.util.List; var shortcuts: List<Artist>? = null
var indices: List<Index>? = null
public class Indexes { var children: List<Child>? = null
protected List<Artist> shortcuts; var lastModified: Long = 0
protected List<Index> indices; var ignoredArticles: String? = null
protected List<Child> children;
protected long lastModified;
protected String ignoredArticles;
/**
* Gets the value of the shortcuts property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the shortcuts property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getShortcuts().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Artist }
*/
public List<Artist> getShortcuts() {
if (shortcuts == null) {
shortcuts = new ArrayList<>();
}
return this.shortcuts;
}
/**
* Gets the value of the indices property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the indices property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getIndices().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Index }
*/
public List<Index> getIndices() {
if (indices == null) {
indices = new ArrayList<>();
}
return this.indices;
}
/**
* Gets the value of the children property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the children property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getchildren().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getchildren() {
if (children == null) {
children = new ArrayList<>();
}
return this.children;
}
/**
* Gets the value of the lastModified property.
*/
public long getLastModified() {
return lastModified;
}
/**
* Sets the value of the lastModified property.
*/
public void setLastModified(long value) {
this.lastModified = value;
}
/**
* Gets the value of the ignoredArticles property.
*
* @return possible object is
* {@link String }
*/
public String getIgnoredArticles() {
return ignoredArticles;
}
/**
* Sets the value of the ignoredArticles property.
*
* @param value allowed object is
* {@link String }
*/
public void setIgnoredArticles(String value) {
this.ignoredArticles = value;
}
} }

View file

@ -1,88 +1,56 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class InternetRadioStation {
protected String id;
protected String name;
protected String streamUrl;
protected String homePageUrl;
class InternetRadioStation {
/** /**
* Gets the value of the id property. * Gets the value of the id property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getId() {
return id;
}
/** /**
* Sets the value of the id property. * Sets the value of the id property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setId(String value) { var id: String? = null
this.id = value;
}
/** /**
* Gets the value of the name property. * Gets the value of the name property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getName() {
return name;
}
/** /**
* Sets the value of the name property. * Sets the value of the name property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setName(String value) { var name: String? = null
this.name = value;
}
/** /**
* Gets the value of the streamUrl property. * Gets the value of the streamUrl property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getStreamUrl() {
return streamUrl;
}
/** /**
* Sets the value of the streamUrl property. * Sets the value of the streamUrl property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setStreamUrl(String value) { var streamUrl: String? = null
this.streamUrl = value;
}
/** /**
* Gets the value of the homePageUrl property. * Gets the value of the homePageUrl property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getHomePageUrl() {
return homePageUrl;
}
/** /**
* Sets the value of the homePageUrl property. * Sets the value of the homePageUrl property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setHomePageUrl(String value) { var homePageUrl: String? = null
this.homePageUrl = value;
}
} }

View file

@ -1,36 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
public class InternetRadioStations {
protected List<InternetRadioStation> internetRadioStations;
/**
* Gets the value of the internetRadioStations property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the internetRadioStations property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getInternetRadioStations().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link InternetRadioStation }
*/
public List<InternetRadioStation> getInternetRadioStations() {
if (internetRadioStations == null) {
internetRadioStations = new ArrayList<>();
}
return this.internetRadioStations;
}
class InternetRadioStations {
var internetRadioStations: List<InternetRadioStation>? = null
} }

View file

@ -1,35 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class JukeboxPlaylist : JukeboxStatus() {
import java.util.List; var entries: List<Child>? = null
public class JukeboxPlaylist extends JukeboxStatus {
protected List<Child> entries;
/**
* Gets the value of the entries property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the entries property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEntries().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getEntries() {
if (entries == null) {
entries = new ArrayList<>();
}
return this.entries;
}
} }

View file

@ -1,70 +1,38 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class JukeboxStatus {
protected int currentIndex;
protected boolean playing;
protected float gain;
protected Integer position;
open class JukeboxStatus {
/** /**
* Gets the value of the currentIndex property. * Gets the value of the currentIndex property.
*/ */
public int getCurrentIndex() {
return currentIndex;
}
/** /**
* Sets the value of the currentIndex property. * Sets the value of the currentIndex property.
*/ */
public void setCurrentIndex(int value) { var currentIndex = 0
this.currentIndex = value;
}
/** /**
* Gets the value of the playing property. * Gets the value of the playing property.
*/ */
public boolean isPlaying() {
return playing;
}
/** /**
* Sets the value of the playing property. * Sets the value of the playing property.
*/ */
public void setPlaying(boolean value) { var isPlaying = false
this.playing = value;
}
/** /**
* Gets the value of the gain property. * Gets the value of the gain property.
*/ */
public float getGain() {
return gain;
}
/** /**
* Sets the value of the gain property. * Sets the value of the gain property.
*/ */
public void setGain(float value) { var gain = 0f
this.gain = value;
}
/** /**
* Gets the value of the position property. * Gets the value of the position property.
* *
* @return possible object is * @return possible object is
* {@link Integer } * [Integer]
*/ */
public Integer getPosition() {
return position;
}
/** /**
* Sets the value of the position property. * Sets the value of the position property.
* *
* @param value allowed object is * @param value allowed object is
* {@link Integer } * [Integer]
*/ */
public void setPosition(Integer value) { var position: Int? = null
this.position = value;
}
} }

View file

@ -1,84 +1,52 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime; import java.time.LocalDateTime
public class License {
protected boolean valid;
protected String email;
protected LocalDateTime licenseExpires;
protected LocalDateTime trialExpires;
class License {
/** /**
* Gets the value of the valid property. * Gets the value of the valid property.
*/ */
public boolean isValid() {
return valid;
}
/** /**
* Sets the value of the valid property. * Sets the value of the valid property.
*/ */
public void setValid(boolean value) { var isValid = false
this.valid = value;
}
/** /**
* Gets the value of the email property. * Gets the value of the email property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public String getEmail() {
return email;
}
/** /**
* Sets the value of the email property. * Sets the value of the email property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setEmail(String value) { var email: String? = null
this.email = value;
}
/** /**
* Gets the value of the licenseExpires property. * Gets the value of the licenseExpires property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public LocalDateTime getLicenseExpires() {
return licenseExpires;
}
/** /**
* Sets the value of the licenseExpires property. * Sets the value of the licenseExpires property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setLicenseExpires(LocalDateTime value) { var licenseExpires: LocalDateTime? = null
this.licenseExpires = value;
}
/** /**
* Gets the value of the trialExpires property. * Gets the value of the trialExpires property.
* *
* @return possible object is * @return possible object is
* {@link String } * [String]
*/ */
public LocalDateTime getTrialExpires() {
return trialExpires;
}
/** /**
* Sets the value of the trialExpires property. * Sets the value of the trialExpires property.
* *
* @param value allowed object is * @param value allowed object is
* {@link String } * [String]
*/ */
public void setTrialExpires(LocalDateTime value) { var trialExpires: LocalDateTime? = null
this.trialExpires = value;
}
} }

View file

@ -1,39 +1,17 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.TextContent; import com.tickaroo.tikxml.annotation.TextContent
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml(name = "lyrics") @Xml(name = "lyrics")
public class Lyrics { class Lyrics {
@TextContent @TextContent
protected String content; var content: String? = null
@Attribute @Attribute
protected String artist; var artist: String? = null
@Attribute @Attribute
protected String title; var title: String? = null
public String getContent() {
return content;
}
public void setContent(String value) {
this.content = value;
}
public String getArtist() {
return artist;
}
public void setArtist(String value) {
this.artist = value;
}
public String getTitle() {
return title;
}
public void setTitle(String value) {
this.title = value;
}
} }

View file

@ -1,23 +1,17 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class MediaType { class MediaType {
public static String MUSIC = "music";
public static String PODCAST = "podcast";
public static String AUDIOBOOK = "audiobook";
public static String VIDEO = "video";
@Attribute @Attribute
private String value; var value: String? = null
public String getValue() { companion object {
return value; var MUSIC = "music"
} var PODCAST = "podcast"
var AUDIOBOOK = "audiobook"
public void setValue(String value) { var VIDEO = "video"
this.value = value;
} }
} }

View file

@ -1,28 +1,13 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class MusicFolder { class MusicFolder {
@Attribute @Attribute
protected int id; var id = 0
@Attribute @Attribute
protected String name; var name: String? = null
public int getId() {
return id;
}
public void setId(int value) {
this.id = value;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class MusicFolders { class MusicFolders {
@Element @Element
protected List<MusicFolder> musicFolders; var musicFolders: List<MusicFolder>? = null
public List<MusicFolder> getMusicFolders() {
if (musicFolders == null) {
musicFolders = new ArrayList<>();
}
return this.musicFolders;
}
public void setMusicFolders(List<MusicFolder> musicFolders) {
this.musicFolders = musicFolders;
}
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class NewestPodcasts { class NewestPodcasts {
@Element(name = "episode") @Element(name = "episode")
protected List<PodcastEpisode> episodes; var episodes: List<PodcastEpisode>? = null
public List<PodcastEpisode> getEpisodes() {
if (episodes == null) {
episodes = new ArrayList<>();
}
return this.episodes;
}
public void setEpisodes(List<PodcastEpisode> episodes) {
this.episodes = episodes;
}
} }

View file

@ -1,35 +1,5 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class NowPlaying {
import java.util.List; var entries: List<NowPlayingEntry>? = null
public class NowPlaying {
protected List<NowPlayingEntry> entries;
/**
* Gets the value of the entries property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the entries property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEntries().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link NowPlayingEntry }
*/
public List<NowPlayingEntry> getEntries() {
if (entries == null) {
entries = new ArrayList<>();
}
return this.entries;
}
} }

View file

@ -1,76 +1,11 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
public class NowPlayingEntry extends Child { import kotlinx.android.parcel.Parcelize
protected String username;
protected int minutesAgo;
protected int playerId;
protected String playerName;
/** @Parcelize
* Gets the value of the username property. class NowPlayingEntry(override val id: String) : Child(id) {
* var username: String? = null
* @return possible object is var minutesAgo = 0
* {@link String } var playerId = 0
*/ var playerName: String? = null
public String getUsername() {
return username;
}
/**
* Sets the value of the username property.
*
* @param value allowed object is
* {@link String }
*/
public void setUsername(String value) {
this.username = value;
}
/**
* Gets the value of the minutesAgo property.
*/
public int getMinutesAgo() {
return minutesAgo;
}
/**
* Sets the value of the minutesAgo property.
*/
public void setMinutesAgo(int value) {
this.minutesAgo = value;
}
/**
* Gets the value of the playerId property.
*/
public int getPlayerId() {
return playerId;
}
/**
* Sets the value of the playerId property.
*/
public void setPlayerId(int value) {
this.playerId = value;
}
/**
* Gets the value of the playerName property.
*
* @return possible object is
* {@link String }
*/
public String getPlayerName() {
return playerName;
}
/**
* Sets the value of the playerName property.
*
* @param value allowed object is
* {@link String }
*/
public void setPlayerName(String value) {
this.playerName = value;
}
} }

View file

@ -1,443 +0,0 @@
package com.cappielloantonio.play.subsonic.models;
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.subsonic.restapi
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link SubsonicResponse }
*/
public SubsonicResponse createSubsonicResponse() {
return new SubsonicResponse();
}
/**
* Create an instance of {@link Error }
*/
public Error createError() {
return new Error();
}
/**
* Create an instance of {@link ScanStatus }
*/
public ScanStatus createScanStatus() {
return new ScanStatus();
}
/**
* Create an instance of {@link TopSongs }
*/
public TopSongs createTopSongs() {
return new TopSongs();
}
/**
* Create an instance of {@link SimilarSongs2 }
*/
public SimilarSongs2 createSimilarSongs2() {
return new SimilarSongs2();
}
/**
* Create an instance of {@link SimilarSongs }
*/
public SimilarSongs createSimilarSongs() {
return new SimilarSongs();
}
/**
* Create an instance of {@link ArtistInfo2 }
*/
public ArtistInfo2 createArtistInfo2() {
return new ArtistInfo2();
}
/**
* Create an instance of {@link ArtistInfo }
*/
public ArtistInfo createArtistInfo() {
return new ArtistInfo();
}
/**
* Create an instance of {@link AlbumInfo }
*/
public AlbumInfo createAlbumInfo() {
return new AlbumInfo();
}
/**
* Create an instance of {@link Starred2 }
*/
public Starred2 createStarred2() {
return new Starred2();
}
/**
* Create an instance of {@link Starred }
*/
public Starred createStarred() {
return new Starred();
}
/**
* Create an instance of {@link Shares }
*/
public Shares createShares() {
return new Shares();
}
/**
* Create an instance of {@link PlayQueue }
*/
public PlayQueue createPlayQueue() {
return new PlayQueue();
}
/**
* Create an instance of {@link Bookmarks }
*/
public Bookmarks createBookmarks() {
return new Bookmarks();
}
/**
* Create an instance of {@link InternetRadioStations }
*/
public InternetRadioStations createInternetRadioStations() {
return new InternetRadioStations();
}
/**
* Create an instance of {@link NewestPodcasts }
*/
public NewestPodcasts createNewestPodcasts() {
return new NewestPodcasts();
}
/**
* Create an instance of {@link Podcasts }
*/
public Podcasts createPodcasts() {
return new Podcasts();
}
/**
* Create an instance of {@link Lyrics }
*/
public Lyrics createLyrics() {
return new Lyrics();
}
/**
* Create an instance of {@link Songs }
*/
public Songs createSongs() {
return new Songs();
}
/**
* Create an instance of {@link AlbumList2 }
*/
public AlbumList2 createAlbumList2() {
return new AlbumList2();
}
/**
* Create an instance of {@link AlbumList }
*/
public AlbumList createAlbumList() {
return new AlbumList();
}
/**
* Create an instance of {@link ChatMessages }
*/
public ChatMessages createChatMessages() {
return new ChatMessages();
}
/**
* Create an instance of {@link User }
*/
public User createUser() {
return new User();
}
/**
* Create an instance of {@link Users }
*/
public Users createUsers() {
return new Users();
}
/**
* Create an instance of {@link License }
*/
public License createLicense() {
return new License();
}
/**
* Create an instance of {@link JukeboxPlaylist }
*/
public JukeboxPlaylist createJukeboxPlaylist() {
return new JukeboxPlaylist();
}
/**
* Create an instance of {@link JukeboxStatus }
*/
public JukeboxStatus createJukeboxStatus() {
return new JukeboxStatus();
}
/**
* Create an instance of {@link PlaylistWithSongs }
*/
public PlaylistWithSongs createPlaylistWithSongs() {
return new PlaylistWithSongs();
}
/**
* Create an instance of {@link Playlists }
*/
public Playlists createPlaylists() {
return new Playlists();
}
/**
* Create an instance of {@link SearchResult3 }
*/
public SearchResult3 createSearchResult3() {
return new SearchResult3();
}
/**
* Create an instance of {@link SearchResult2 }
*/
public SearchResult2 createSearchResult2() {
return new SearchResult2();
}
/**
* Create an instance of {@link SearchResult }
*/
public SearchResult createSearchResult() {
return new SearchResult();
}
/**
* Create an instance of {@link NowPlaying }
*/
public NowPlaying createNowPlaying() {
return new NowPlaying();
}
/**
* Create an instance of {@link VideoInfo }
*/
public VideoInfo createVideoInfo() {
return new VideoInfo();
}
/**
* Create an instance of {@link Videos }
*/
public Videos createVideos() {
return new Videos();
}
/**
* Create an instance of {@link Child }
*/
public Child createChild() {
return new Child();
}
/**
* Create an instance of {@link AlbumWithSongsID3 }
*/
public AlbumWithSongsID3 createAlbumWithSongsID3() {
return new AlbumWithSongsID3();
}
/**
* Create an instance of {@link ArtistWithAlbumsID3 }
*/
public ArtistWithAlbumsID3 createArtistWithAlbumsID3() {
return new ArtistWithAlbumsID3();
}
/**
* Create an instance of {@link ArtistsID3 }
*/
public ArtistsID3 createArtistsID3() {
return new ArtistsID3();
}
/**
* Create an instance of {@link Genres }
*/
public Genres createGenres() {
return new Genres();
}
/**
* Create an instance of {@link Directory }
*/
public Directory createDirectory() {
return new Directory();
}
/**
* Create an instance of {@link Indexes }
*/
public Indexes createIndexes() {
return new Indexes();
}
/**
* Create an instance of {@link MusicFolders }
*/
public MusicFolders createMusicFolders() {
return new MusicFolders();
}
/**
* Create an instance of {@link MusicFolder }
*/
public MusicFolder createMusicFolder() {
return new MusicFolder();
}
/**
* Create an instance of {@link Index }
*/
public Index createIndex() {
return new Index();
}
/**
* Create an instance of {@link Artist }
*/
public Artist createArtist() {
return new Artist();
}
/**
* Create an instance of {@link Genre }
*/
public Genre createGenre() {
return new Genre();
}
/**
* Create an instance of {@link IndexID3 }
*/
public IndexID3 createIndexID3() {
return new IndexID3();
}
/**
* Create an instance of {@link ArtistID3 }
*/
public ArtistID3 createArtistID3() {
return new ArtistID3();
}
/**
* Create an instance of {@link AlbumID3 }
*/
public AlbumID3 createAlbumID3() {
return new AlbumID3();
}
/**
* Create an instance of {@link Captions }
*/
public Captions createCaptions() {
return new Captions();
}
/**
* Create an instance of {@link AudioTrack }
*/
public AudioTrack createAudioTrack() {
return new AudioTrack();
}
/**
* Create an instance of {@link VideoConversion }
*/
public VideoConversion createVideoConversion() {
return new VideoConversion();
}
/**
* Create an instance of {@link NowPlayingEntry }
*/
public NowPlayingEntry createNowPlayingEntry() {
return new NowPlayingEntry();
}
/**
* Create an instance of {@link Playlist }
*/
public Playlist createPlaylist() {
return new Playlist();
}
/**
* Create an instance of {@link ChatMessage }
*/
public ChatMessage createChatMessage() {
return new ChatMessage();
}
/**
* Create an instance of {@link PodcastChannel }
*/
public PodcastChannel createPodcastChannel() {
return new PodcastChannel();
}
/**
* Create an instance of {@link PodcastEpisode }
*/
public PodcastEpisode createPodcastEpisode() {
return new PodcastEpisode();
}
/**
* Create an instance of {@link InternetRadioStation }
*/
public InternetRadioStation createInternetRadioStation() {
return new InternetRadioStation();
}
/**
* Create an instance of {@link Bookmark }
*/
public Bookmark createBookmark() {
return new Bookmark();
}
/**
* Create an instance of {@link Share }
*/
public Share createShare() {
return new Share();
}
/**
* Create an instance of {@link ArtistInfoBase }
*/
public ArtistInfoBase createArtistInfoBase() {
return new ArtistInfoBase();
}
}

View file

@ -1,141 +1,12 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime; import java.time.LocalDateTime
import java.util.ArrayList;
import java.util.List;
public class PlayQueue { class PlayQueue {
protected List<Child> entries; var entries: List<Child>? = null
protected Integer current; var current: Int? = null
protected Long position; var position: Long? = null
protected String username; var username: String? = null
protected LocalDateTime changed; var changed: LocalDateTime? = null
protected String changedBy; var changedBy: String? = null
/**
* Gets the value of the entries property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the entries property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEntries().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getEntries() {
if (entries == null) {
entries = new ArrayList<>();
}
return this.entries;
}
/**
* Gets the value of the current property.
*
* @return possible object is
* {@link Integer }
*/
public Integer getCurrent() {
return current;
}
/**
* Sets the value of the current property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setCurrent(Integer value) {
this.current = value;
}
/**
* Gets the value of the position property.
*
* @return possible object is
* {@link Long }
*/
public Long getPosition() {
return position;
}
/**
* Sets the value of the position property.
*
* @param value allowed object is
* {@link Long }
*/
public void setPosition(Long value) {
this.position = value;
}
/**
* Gets the value of the username property.
*
* @return possible object is
* {@link String }
*/
public String getUsername() {
return username;
}
/**
* Sets the value of the username property.
*
* @param value allowed object is
* {@link String }
*/
public void setUsername(String value) {
this.username = value;
}
/**
* Gets the value of the changed property.
*
* @return possible object is
* {@link String }
*/
public LocalDateTime getChanged() {
return changed;
}
/**
* Sets the value of the changed property.
*
* @param value allowed object is
* {@link String }
*/
public void setChanged(LocalDateTime value) {
this.changed = value;
}
/**
* Gets the value of the changedBy property.
*
* @return possible object is
* {@link String }
*/
public String getChangedBy() {
return changedBy;
}
/**
* Sets the value of the changedBy property.
*
* @param value allowed object is
* {@link String }
*/
public void setChangedBy(String value) {
this.changedBy = value;
}
} }

View file

@ -1,125 +1,64 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import androidx.room.ColumnInfo
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter; import androidx.room.Entity
import androidx.room.Ignore
import java.util.ArrayList; import androidx.room.PrimaryKey
import java.util.Date; import com.tickaroo.tikxml.annotation.Attribute
import java.util.List; import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Entity(tableName = "playlist")
@Xml @Xml
public class Playlist { open class Playlist : Parcelable {
protected List<String> allowedUsers; @PrimaryKey
@ColumnInfo(name = "id")
@Attribute @Attribute
protected String id; lateinit var id: String
@ColumnInfo(name = "name")
@Attribute @Attribute
protected String name; var name: String? = null
@Ignore
@Attribute @Attribute
protected String comment; var comment: String? = null
@Ignore
@Attribute @Attribute
protected String owner; var owner: String? = null
@Ignore
@Attribute(name = "public") @Attribute(name = "public")
protected Boolean universal; var isUniversal: Boolean? = null
@Ignore
@Attribute @Attribute
protected int songCount; var songCount: Int = 0
@Ignore
@ColumnInfo(name = "duration")
@Attribute @Attribute
protected int duration; var duration: Long = 0
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created; @Ignore
@Attribute(converter = DateRfc3339TypeConverter.class) @Attribute(converter = DateRfc3339TypeConverter::class)
protected Date changed; var created: Date? = null
@Ignore
@Attribute(converter = DateRfc3339TypeConverter::class)
var changed: Date? = null
@Ignore
@ColumnInfo(name = "coverArt")
@Attribute @Attribute
protected String coverArtId; var coverArtId: String? = null
public List<String> getAllowedUsers() { @Ignore
if (allowedUsers == null) { @Attribute
allowedUsers = new ArrayList<>(); var allowedUsers: List<String>? = null
}
return this.allowedUsers;
}
public void setAllowedUsers(List<String> allowedUsers) {
this.allowedUsers = allowedUsers;
}
public String getId() {
return id;
}
public void setId(String value) {
this.id = value;
}
public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
public String getComment() {
return comment;
}
public void setComment(String value) {
this.comment = value;
}
public String getOwner() {
return owner;
}
public void setOwner(String value) {
this.owner = value;
}
public Boolean isUniversal() {
return universal;
}
public void setUniversal(Boolean value) {
this.universal = value;
}
public int getSongCount() {
return songCount;
}
public void setSongCount(int value) {
this.songCount = value;
}
public int getDuration() {
return duration;
}
public void setDuration(int value) {
this.duration = value;
}
public Date getCreated() {
return created;
}
public void setCreated(Date value) {
this.created = value;
}
public Date getChanged() {
return changed;
}
public void setChanged(Date value) {
this.changed = value;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String value) {
this.coverArtId = value;
}
} }

View file

@ -1,24 +1,13 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList; import kotlinx.android.parcel.Parcelize
import java.util.List;
@Parcelize
@Xml @Xml
public class PlaylistWithSongs extends Playlist { class PlaylistWithSongs : Playlist(), Parcelable {
@Element(name = "entry") @Element(name = "entry")
protected List<Child> entries; var entries: List<Child>? = null
public List<Child> getEntries() {
if (entries == null) {
entries = new ArrayList<>();
}
return this.entries;
}
public void setEntries(List<Child> entries) {
this.entries = entries;
}
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class Playlists { class Playlists {
@Element(name = "playlist") @Element(name = "playlist")
protected List<Playlist> playlists; var playlists: List<Playlist>? = null
public List<Playlist> getPlaylists() {
if (playlists == null) {
playlists = new ArrayList<>();
}
return this.playlists;
}
public void setPlaylists(List<Playlist> playlists) {
this.playlists = playlists;
}
} }

View file

@ -1,105 +1,38 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList; import kotlinx.android.parcel.Parcelize
import java.util.List;
@Parcelize
@Xml @Xml
public class PodcastChannel { class PodcastChannel : Parcelable {
@Element(name = "episode") @Element(name = "episode")
protected List<PodcastEpisode> episodes; var episodes: List<PodcastEpisode>? = null
@Attribute @Attribute
protected String id; var id: String? = null
@Attribute @Attribute
protected String url; var url: String? = null
@Attribute @Attribute
protected String title; var title: String? = null
@Attribute @Attribute
protected String description; var description: String? = null
@Attribute @Attribute
protected String coverArtId; var coverArtId: String? = null
@Attribute @Attribute
protected String originalImageUrl; var originalImageUrl: String? = null
@Attribute @Attribute
protected String status; var status: String? = null
@Attribute @Attribute
protected String errorMessage; var errorMessage: String? = null
public List<PodcastEpisode> getEpisodes() {
if (episodes == null) {
episodes = new ArrayList<>();
}
return this.episodes;
}
public void setEpisodes(List<PodcastEpisode> episodes) {
this.episodes = episodes;
}
public String getId() {
return id;
}
public void setId(String value) {
this.id = value;
}
public String getUrl() {
return url;
}
public void setUrl(String value) {
this.url = value;
}
public String getTitle() {
return title;
}
public void setTitle(String value) {
this.title = value;
}
public String getDescription() {
return description;
}
public void setDescription(String value) {
this.description = value;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String value) {
this.coverArtId = value;
}
public String getOriginalImageUrl() {
return originalImageUrl;
}
public void setOriginalImageUrl(String value) {
this.originalImageUrl = value;
}
public String getStatus() {
return status;
}
public void setStatus(String value) {
this.status = value;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String value) {
this.errorMessage = value;
}
} }

View file

@ -1,372 +1,120 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter; import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import java.util.Date; import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml @Xml
public class PodcastEpisode { class PodcastEpisode : Parcelable {
@Attribute @Attribute
protected String id; var id: String? = null
@Attribute(name = "parent") @Attribute(name = "parent")
protected String parentId; var parentId: String? = null
@Attribute(name = "isDir") @Attribute(name = "isDir")
protected boolean dir; var isDir = false
@Attribute @Attribute
protected String title; var title: String? = null
@Attribute @Attribute
protected String album; var album: String? = null
@Attribute @Attribute
protected String artist; var artist: String? = null
@Attribute @Attribute
protected Integer track; var track: Int? = null
@Attribute @Attribute
protected Integer year; var year: Int? = null
@Attribute(name = "genre") @Attribute(name = "genre")
protected String genre; var genre: String? = null
@Attribute(name = "coverArt") @Attribute(name = "coverArt")
protected String coverArtId; var coverArtId: String? = null
@Attribute @Attribute
protected Long size; var size: Long? = null
@Attribute @Attribute
protected String contentType; var contentType: String? = null
@Attribute @Attribute
protected String suffix; var suffix: String? = null
@Attribute @Attribute
protected String transcodedContentType; var transcodedContentType: String? = null
@Attribute @Attribute
protected String transcodedSuffix; var transcodedSuffix: String? = null
@Attribute @Attribute
protected Integer duration; var duration: Int? = null
@Attribute @Attribute
protected Integer bitRate; var bitRate: Int? = null
@Attribute @Attribute
protected String path; var path: String? = null
@Attribute(name = "isVideo") @Attribute(name = "isVideo")
protected Boolean video; var video: Boolean? = null
@Attribute
protected Integer userRating;
@Attribute
protected Double averageRating;
@Attribute
protected Long playCount;
@Attribute
protected Integer discNumber;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date starred;
@Attribute
protected String albumId;
@Attribute
protected String artistId;
@Attribute
protected String type;
@Attribute
protected Long bookmarkPosition;
@Attribute
protected Integer originalWidth;
@Attribute
protected Integer originalHeight;
@Attribute @Attribute
protected String streamId; var userRating: Int? = null
@Attribute @Attribute
protected String channelId; var averageRating: Double? = null
@Attribute @Attribute
protected String description; var playCount: Long? = null
@Attribute @Attribute
protected String status; var discNumber: Int? = null
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date publishDate;
public String getId() { @Attribute(converter = DateRfc3339TypeConverter::class)
return id; var created: Date? = null
}
public void setId(String id) { @Attribute(converter = DateRfc3339TypeConverter::class)
this.id = id; var starred: Date? = null
}
public String getParentId() { @Attribute
return parentId; var albumId: String? = null
}
public void setParentId(String parentId) { @Attribute
this.parentId = parentId; var artistId: String? = null
}
public boolean isDir() { @Attribute
return dir; var type: String? = null
}
public void setDir(boolean dir) { @Attribute
this.dir = dir; var bookmarkPosition: Long? = null
}
public String getTitle() { @Attribute
return title; var originalWidth: Int? = null
}
public void setTitle(String title) { @Attribute
this.title = title; var originalHeight: Int? = null
}
public String getAlbum() { @Attribute
return album; var streamId: String? = null
}
public void setAlbum(String album) { @Attribute
this.album = album; var channelId: String? = null
}
public String getArtist() { @Attribute
return artist; var description: String? = null
}
public void setArtist(String artist) { @Attribute
this.artist = artist; var status: String? = null
}
public Integer getTrack() { @Attribute(converter = DateRfc3339TypeConverter::class)
return track; var publishDate: Date? = null
}
public void setTrack(Integer track) {
this.track = track;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String coverArtId) {
this.coverArtId = coverArtId;
}
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public String getTranscodedContentType() {
return transcodedContentType;
}
public void setTranscodedContentType(String transcodedContentType) {
this.transcodedContentType = transcodedContentType;
}
public String getTranscodedSuffix() {
return transcodedSuffix;
}
public void setTranscodedSuffix(String transcodedSuffix) {
this.transcodedSuffix = transcodedSuffix;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Integer getBitRate() {
return bitRate;
}
public void setBitRate(Integer bitRate) {
this.bitRate = bitRate;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Boolean getVideo() {
return video;
}
public void setVideo(Boolean video) {
this.video = video;
}
public Integer getUserRating() {
return userRating;
}
public void setUserRating(Integer userRating) {
this.userRating = userRating;
}
public Double getAverageRating() {
return averageRating;
}
public void setAverageRating(Double averageRating) {
this.averageRating = averageRating;
}
public Long getPlayCount() {
return playCount;
}
public void setPlayCount(Long playCount) {
this.playCount = playCount;
}
public Integer getDiscNumber() {
return discNumber;
}
public void setDiscNumber(Integer discNumber) {
this.discNumber = discNumber;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getStarred() {
return starred;
}
public void setStarred(Date starred) {
this.starred = starred;
}
public String getAlbumId() {
return albumId;
}
public void setAlbumId(String albumId) {
this.albumId = albumId;
}
public String getArtistId() {
return artistId;
}
public void setArtistId(String artistId) {
this.artistId = artistId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getBookmarkPosition() {
return bookmarkPosition;
}
public void setBookmarkPosition(Long bookmarkPosition) {
this.bookmarkPosition = bookmarkPosition;
}
public Integer getOriginalWidth() {
return originalWidth;
}
public void setOriginalWidth(Integer originalWidth) {
this.originalWidth = originalWidth;
}
public Integer getOriginalHeight() {
return originalHeight;
}
public void setOriginalHeight(Integer originalHeight) {
this.originalHeight = originalHeight;
}
public String getStreamId() {
return streamId;
}
public void setStreamId(String value) {
this.streamId = value;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String value) {
this.channelId = value;
}
public String getDescription() {
return description;
}
public void setDescription(String value) {
this.description = value;
}
public String getStatus() {
return status;
}
public void setStatus(String value) {
this.status = value;
}
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date value) {
this.publishDate = value;
}
} }

View file

@ -1,25 +1,19 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class PodcastStatus { class PodcastStatus {
public static String NEW = "new";
public static String DOWNLOADING = "downloading";
public static String COMPLETED = "completed";
public static String ERROR = "error";
public static String DELETED = "deleted";
public static String SKIPPED = "skipped";
@Attribute @Attribute
private String value; var value: String? = null
public String getValue() { companion object {
return value; var NEW = "new"
} var DOWNLOADING = "downloading"
var COMPLETED = "completed"
public void setValue(String value) { var ERROR = "error"
this.value = value; var DELETED = "deleted"
var SKIPPED = "skipped"
} }
} }

View file

@ -1,24 +1,10 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class Podcasts { class Podcasts {
@Element(name = "channel") @Element(name = "channel")
protected List<PodcastChannel> channels; var channels: List<PodcastChannel>? = null
public List<PodcastChannel> getChannels() {
if (channels == null) {
channels = new ArrayList<>();
}
return this.channels;
}
public void setChannels(List<PodcastChannel> channels) {
this.channels = channels;
}
} }

View file

@ -1,20 +1,16 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class ResponseStatus { class ResponseStatus(@param:Attribute val value: String) {
public static String OK = "ok";
public static String FAILED = "failed";
private final String value; companion object {
@JvmField
var OK = "ok"
public ResponseStatus(@Attribute String value) { @JvmField
this.value = value; var FAILED = "failed"
}
public String getValue() {
return value;
} }
} }

View file

@ -1,28 +1,13 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Attribute; import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
@Xml @Xml
public class ScanStatus { class ScanStatus {
@Attribute @Attribute
protected boolean scanning; var isScanning = false
@Attribute @Attribute
protected Long count; var count: Long? = null
public boolean isScanning() {
return scanning;
}
public void setScanning(boolean value) {
this.scanning = value;
}
public Long getCount() {
return count;
}
public void setCount(Long value) {
this.count = value;
}
} }

View file

@ -1,65 +1,7 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList; class SearchResult {
import java.util.List; var matches: List<Child>? = null
var offset = 0
public class SearchResult { var totalHits = 0
protected List<Child> matches;
protected int offset;
protected int totalHits;
/**
* Gets the value of the matches property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the matches property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMatches().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getMatches() {
if (matches == null) {
matches = new ArrayList<>();
}
return this.matches;
}
/**
* Gets the value of the offset property.
*/
public int getOffset() {
return offset;
}
/**
* Sets the value of the offset property.
*/
public void setOffset(int value) {
this.offset = value;
}
/**
* Gets the value of the totalHits property.
*/
public int getTotalHits() {
return totalHits;
}
/**
* Sets the value of the totalHits property.
*/
public void setTotalHits(int value) {
this.totalHits = value;
}
} }

View file

@ -1,50 +1,16 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class SearchResult2 { class SearchResult2 {
@Element(name = "artist") @Element(name = "artist")
protected List<Artist> artists; var artists: List<Artist>? = null
@Element(name = "album") @Element(name = "album")
protected List<Child> albums; var albums: List<Child>? = null
@Element(name = "song") @Element(name = "song")
protected List<Child> songs; var songs: List<Child>? = null
public List<Artist> getArtists() {
if (artists == null) {
artists = new ArrayList<>();
}
return this.artists;
}
public void setArtists(List<Artist> artists) {
this.artists = artists;
}
public List<Child> getAlbums() {
if (albums == null) {
albums = new ArrayList<>();
}
return this.albums;
}
public void setAlbums(List<Child> albums) {
this.albums = albums;
}
public List<Child> getSongs() {
if (songs == null) {
songs = new ArrayList<>();
}
return this.songs;
}
public void setSongs(List<Child> songs) {
this.songs = songs;
}
} }

View file

@ -1,50 +1,16 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import com.tickaroo.tikxml.annotation.Element; import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml; import com.tickaroo.tikxml.annotation.Xml
import java.util.ArrayList;
import java.util.List;
@Xml @Xml
public class SearchResult3 { class SearchResult3 {
@Element(name = "artist") @Element(name = "artist")
protected List<ArtistID3> artists; var artists: List<ArtistID3>? = null
@Element(name = "album") @Element(name = "album")
protected List<AlbumID3> albums; var albums: List<AlbumID3>? = null
@Element(name = "song") @Element(name = "song")
protected List<Child> songs; var songs: List<Child>? = null
public List<ArtistID3> getArtists() {
if (artists == null) {
artists = new ArrayList<>();
}
return this.artists;
}
public List<AlbumID3> getAlbums() {
if (albums == null) {
albums = new ArrayList<>();
}
return this.albums;
}
public List<Child> getSongs() {
if (songs == null) {
songs = new ArrayList<>();
}
return this.songs;
}
public void setArtists(List<ArtistID3> artists) {
this.artists = artists;
}
public void setAlbums(List<AlbumID3> albums) {
this.albums = albums;
}
public void setSongs(List<Child> songs) {
this.songs = songs;
}
} }

View file

@ -1,198 +1,15 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime; import java.time.LocalDateTime
import java.util.ArrayList;
import java.util.List;
public class Share { class Share {
protected List<Child> entries; var entries: List<Child>? = null
protected String id; var id: String? = null
protected String url; var url: String? = null
protected String description; var description: String? = null
protected String username; var username: String? = null
protected LocalDateTime created; var created: LocalDateTime? = null
protected LocalDateTime expires; var expires: LocalDateTime? = null
protected LocalDateTime lastVisited; var lastVisited: LocalDateTime? = null
protected int visitCount; var visitCount = 0
/**
* Gets the value of the entries property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the entries property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEntries().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Child }
*/
public List<Child> getEntries() {
if (entries == null) {
entries = new ArrayList<>();
}
return this.entries;
}
/**
* Gets the value of the id property.
*
* @return possible object is
* {@link String }
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value allowed object is
* {@link String }
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the url property.
*
* @return possible object is
* {@link String }
*/
public String getUrl() {
return url;
}
/**
* Sets the value of the url property.
*
* @param value allowed object is
* {@link String }
*/
public void setUrl(String value) {
this.url = value;
}
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value allowed object is
* {@link String }
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the username property.
*
* @return possible object is
* {@link String }
*/
public String getUsername() {
return username;
}
/**
* Sets the value of the username property.
*
* @param value allowed object is
* {@link String }
*/
public void setUsername(String value) {
this.username = value;
}
/**
* Gets the value of the created property.
*
* @return possible object is
* {@link String }
*/
public LocalDateTime getCreated() {
return created;
}
/**
* Sets the value of the created property.
*
* @param value allowed object is
* {@link String }
*/
public void setCreated(LocalDateTime value) {
this.created = value;
}
/**
* Gets the value of the expires property.
*
* @return possible object is
* {@link String }
*/
public LocalDateTime getExpires() {
return expires;
}
/**
* Sets the value of the expires property.
*
* @param value allowed object is
* {@link String }
*/
public void setExpires(LocalDateTime value) {
this.expires = value;
}
/**
* Gets the value of the lastVisited property.
*
* @return possible object is
* {@link String }
*/
public LocalDateTime getLastVisited() {
return lastVisited;
}
/**
* Sets the value of the lastVisited property.
*
* @param value allowed object is
* {@link String }
*/
public void setLastVisited(LocalDateTime value) {
this.lastVisited = value;
}
/**
* Gets the value of the visitCount property.
*/
public int getVisitCount() {
return visitCount;
}
/**
* Sets the value of the visitCount property.
*/
public void setVisitCount(int value) {
this.visitCount = value;
}
} }

Some files were not shown because too many files have changed in this diff Show more