- 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">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<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" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<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.subsonic.Subsonic;
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;
public class App extends Application {
private static final String TAG = "App";
private static App instance;
private static Subsonic subsonic;
private static SharedPreferences preferences;
@Override
public void onCreate() {
@ -23,8 +24,10 @@ public class App extends Application {
DynamicColors.applyToActivitiesIfAvailable(this);
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);
preferences = getSharedPreferences(Constants.SHARED_PREF_KEY, Context.MODE_PRIVATE);
}
public static App getInstance() {
@ -41,13 +44,21 @@ public class App extends Application {
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) {
String server = PreferenceUtil.getInstance(context).getServer();
String username = PreferenceUtil.getInstance(context).getUser();
String password = PreferenceUtil.getInstance(context).getPassword();
String token = PreferenceUtil.getInstance(context).getToken();
String salt = PreferenceUtil.getInstance(context).getSalt();
boolean isLowSecurity = PreferenceUtil.getInstance(context).isLowScurity();
String server = Preferences.getServer();
String username = Preferences.getUser();
String password = Preferences.getPassword();
String token = Preferences.getToken();
String salt = Preferences.getSalt();
boolean isLowSecurity = Preferences.isLowScurity();
SubsonicPreferences preferences = new SubsonicPreferences();
preferences.setServerUrl(server);
@ -55,9 +66,12 @@ public class App extends Application {
preferences.setAuthentication(password, token, salt, isLowSecurity);
if (preferences.getAuthentication() != null) {
if (preferences.getAuthentication().getPassword() != null) PreferenceUtil.getInstance(context).setPassword(preferences.getAuthentication().getPassword());
if (preferences.getAuthentication().getToken() != null) PreferenceUtil.getInstance(context).setToken(preferences.getAuthentication().getToken());
if (preferences.getAuthentication().getSalt() != null) PreferenceUtil.getInstance(context).setSalt(preferences.getAuthentication().getSalt());
if (preferences.getAuthentication().getPassword() != null)
Preferences.setPassword(preferences.getAuthentication().getPassword());
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);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,8 +17,8 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.service.MediaManager;
import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.util.MusicUtil;
import com.google.common.util.concurrent.ListenableFuture;
@ -31,7 +31,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
private final ClickCallback click;
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
private List<Media> songs;
private List<Child> songs;
public PlayerSongQueueAdapter(Context context, ClickCallback click) {
this.context = context;
@ -48,10 +48,10 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
@Override
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.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
.from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null)
@ -69,11 +69,11 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
return songs.size();
}
public List<Media> getItems() {
public List<Child> getItems() {
return this.songs;
}
public void setItems(List<Media> songs) {
public void setItems(List<Child> songs) {
this.songs = songs;
notifyDataSetChanged();
}
@ -82,7 +82,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
this.mediaBrowserListenableFuture = mediaBrowserListenableFuture;
}
public Media getItem(int id) {
public Child getItem(int 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.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.ui.dialog.PlaylistChooserDialog;
import com.cappielloantonio.play.subsonic.models.Playlist;
import com.cappielloantonio.play.util.MusicUtil;
import com.cappielloantonio.play.viewmodel.PlaylistChooserViewModel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -27,7 +24,7 @@ public class PlaylistDialogHorizontalAdapter extends RecyclerView.Adapter<Playli
private List<Playlist> playlists;
public PlaylistDialogHorizontalAdapter(Context context,ClickCallback click) {
public PlaylistDialogHorizontalAdapter(Context context, ClickCallback click) {
this.context = context;
this.click = click;
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.cappielloantonio.play.R;
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 java.util.Collections;
@ -23,7 +23,7 @@ import java.util.List;
public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<PlaylistDialogSongHorizontalAdapter.ViewHolder> {
private final Context context;
private List<Media> songs;
private List<Child> songs;
public PlaylistDialogSongHorizontalAdapter(Context context) {
this.context = context;
@ -39,10 +39,10 @@ public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<Pl
@Override
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.songArtist.setText(MusicUtil.getReadableString(song.getArtistName()));
holder.songArtist.setText(MusicUtil.getReadableString(song.getArtist()));
holder.songDuration.setText(MusicUtil.getReadableDurationString(song.getDuration(), false));
CustomGlideRequest.Builder
@ -57,16 +57,16 @@ public class PlaylistDialogSongHorizontalAdapter extends RecyclerView.Adapter<Pl
return songs.size();
}
public List<Media> getItems() {
public List<Child> getItems() {
return this.songs;
}
public void setItems(List<Media> songs) {
public void setItems(List<Child> songs) {
this.songs = songs;
notifyDataSetChanged();
}
public Media getItem(int id) {
public Child getItem(int 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.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.subsonic.models.Playlist;
import com.cappielloantonio.play.util.MusicUtil;
import java.util.ArrayList;
@ -139,10 +139,10 @@ public class PlaylistHorizontalAdapter extends RecyclerView.Adapter<PlaylistHori
public void sort(String order) {
switch (order) {
case Playlist.ORDER_BY_NAME:
case com.cappielloantonio.play.model.Playlist.ORDER_BY_NAME:
playlists.sort(Comparator.comparing(Playlist::getName));
break;
case Playlist.ORDER_BY_RANDOM:
case com.cappielloantonio.play.model.Playlist.ORDER_BY_RANDOM:
Collections.shuffle(playlists);
break;
}

View file

@ -17,7 +17,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.glide.CustomGlideRequest;
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 java.text.SimpleDateFormat;
@ -28,7 +28,7 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
private final Context context;
private final ClickCallback click;
private List<Media> podcastEpisodes;
private List<PodcastEpisode> podcastEpisodes;
public PodcastEpisodeAdapter(Context context, ClickCallback click) {
this.context = context;
@ -45,11 +45,11 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Media podcastEpisode = podcastEpisodes.get(position);
PodcastEpisode podcastEpisode = podcastEpisodes.get(position);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM d");
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.textDescription.setText(MusicUtil.getReadableString(podcastEpisode.getDescription()));
@ -65,7 +65,7 @@ public class PodcastEpisodeAdapter extends RecyclerView.Adapter<PodcastEpisodeAd
return podcastEpisodes.size();
}
public void setItems(List<Media> podcastEpisodes) {
public void setItems(List<PodcastEpisode> podcastEpisodes) {
this.podcastEpisodes = podcastEpisodes;
notifyDataSetChanged();
}

View file

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

View file

@ -10,8 +10,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.session.MediaBrowser;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
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.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.ClickCallback;
import com.cappielloantonio.play.model.Media;
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.subsonic.models.Child;
import com.cappielloantonio.play.util.MusicUtil;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Collections;
@ -37,7 +30,7 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
private final ClickCallback click;
private final boolean isCoverVisible;
private List<Media> songs;
private List<Child> songs;
public SongHorizontalAdapter(Context context, ClickCallback click, boolean isCoverVisible) {
this.context = context;
@ -55,17 +48,18 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
@Override
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.songSubtitle.setText(context.getString(R.string.song_subtitle_formatter, MusicUtil.getReadableString(song.getArtistName()), MusicUtil.getReadableDurationString(song.getDuration(), false)));
holder.trackNumber.setText(String.valueOf(song.getTrackNumber()));
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.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);
} else {
holder.downloadIndicator.setVisibility(View.GONE);
}
} */
if (isCoverVisible) CustomGlideRequest.Builder
.from(context, song.getCoverArtId(), CustomGlideRequest.SONG_PIC, null)
@ -87,12 +81,12 @@ public class SongHorizontalAdapter extends RecyclerView.Adapter<SongHorizontalAd
return songs.size();
}
public void setItems(List<Media> songs) {
public void setItems(List<Child> songs) {
this.songs = songs;
notifyDataSetChanged();
}
public Media getItem(int id) {
public Child getItem(int id) {
return songs.get(id);
}

View file

@ -1,13 +1,13 @@
package com.cappielloantonio.play.database;
import android.annotation.SuppressLint;
import android.content.Context;
import androidx.room.AutoMigration;
import androidx.room.Database;
import androidx.room.Room;
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.DownloadDao;
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.model.Chronology;
import com.cappielloantonio.play.model.Download;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Queue;
import com.cappielloantonio.play.model.RecentSearch;
import com.cappielloantonio.play.model.Server;
import com.cappielloantonio.play.subsonic.models.Playlist;
@SuppressLint("RestrictedApi")
@Database(
version = 46,
version = 48,
entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Playlist.class, Chronology.class}
// autoMigrations = {@AutoMigration(from = 43, to = 44)}
)
@TypeConverters({DateConverters.class})
public abstract class AppDatabase extends RoomDatabase {
private final static String DB_NAME = "play_db";
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")
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);
@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);
@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);
@Query("SELECT * FROM download WHERE server=:server LIMIT :size")
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);
@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);
@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);
@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);
@Insert(onConflict = OnConflictStrategy.REPLACE)
@ -45,7 +45,7 @@ public interface DownloadDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertAll(List<Download> downloads);
@Query("DELETE FROM download WHERE mediaId = :mediaId")
@Query("DELETE FROM download WHERE media_id = :mediaId")
void delete(String mediaId);
@Query("DELETE FROM download WHERE server=:server")

View file

@ -7,14 +7,17 @@ import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.subsonic.models.Playlist;
import java.util.List;
@Dao
public interface PlaylistDao {
@Query("SELECT * FROM playlist WHERE server=:serverId")
LiveData<List<Playlist>> getAll(String serverId);
// @Query("SELECT * FROM playlist WHERE server=:serverId")
// LiveData<List<Playlist>> getAll(String serverId);
@Query("SELECT * FROM playlist")
LiveData<List<Playlist>> getAll();
@Insert(onConflict = OnConflictStrategy.REPLACE)
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.module.AppGlideModule;
import com.bumptech.glide.request.RequestOptions;
import com.cappielloantonio.play.util.PreferenceUtil;
import com.cappielloantonio.play.util.Preferences;
import java.io.File;
@ -19,7 +19,7 @@ public class CustomGlideModule extends AppGlideModule {
@Override
public void applyOptions(@NonNull Context context, GlideBuilder builder) {
File file = new File(context.getCacheDir() + "glide");
int size = PreferenceUtil.getInstance(context).getImageCacheSize();
int size = Preferences.getImageCacheSize();
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
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.cappielloantonio.play.App;
import com.cappielloantonio.play.util.MusicUtil;
import com.cappielloantonio.play.util.PreferenceUtil;
import com.cappielloantonio.play.util.Preferences;
import java.util.Map;
@ -71,12 +71,12 @@ public class CustomGlideRequest {
private Builder(Context context, String item, String category, String custom) {
this.requestManager = Glide.with(context);
if (PreferenceUtil.getInstance(context).isDataSavingMode()) {
if (Preferences.isDataSavingMode()) {
this.item = MusicUtil.getDefaultPicPerCategory(category);
} else if (custom != null && !PreferenceUtil.getInstance(context).isDataSavingMode()) {
} else if (custom != null && !Preferences.isDataSavingMode()) {
this.item = custom;
} else if (item != null && !PreferenceUtil.getInstance(context).isDataSavingMode()) {
this.item = createUrl(item, PreferenceUtil.getInstance(context).getImageSize());
} else if (item != null && !Preferences.isDataSavingMode()) {
this.item = createUrl(item, Preferences.getImageSize());
} else {
this.item = MusicUtil.getDefaultPicPerCategory(category);
}

View file

@ -2,62 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable
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 java.util.*
@Keep
@Parcelize
class Album(
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
)
class Album : Parcelable {
companion object {
const val RECENTLY_PLAYED = "RECENTLY_PLAYED"
const val MOST_PLAYED = "MOST_PLAYED"

View file

@ -2,98 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable
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
@Keep
@Parcelize
class Artist(
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
)
class Artist : Parcelable {
companion object {
const val DOWNLOADED = "DOWNLOADED"
const val STARRED = "STARRED"

View file

@ -1,55 +1,19 @@
package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.cappielloantonio.play.subsonic.models.Child
import kotlinx.android.parcel.Parcelize
@Keep
@Parcelize
@Entity(tableName = "chronology")
data class Chronology(
@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
class Chronology(@PrimaryKey override val id: String) : Child(id) {
@ColumnInfo(name = "timestamp")
var timestamp: Long = System.currentTimeMillis()
@ColumnInfo(name = "server")
var server: String? = null
}

View file

@ -1,89 +1,22 @@
package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.cappielloantonio.play.App
import com.cappielloantonio.play.util.MusicUtil
import com.cappielloantonio.play.util.PreferenceUtil
import com.cappielloantonio.play.subsonic.models.Child
import kotlinx.android.parcel.Parcelize
import java.util.*
@Keep
@Parcelize
@Entity(tableName = "download")
class Download(
@PrimaryKey @ColumnInfo(name = "id")
var id: String,
class Download(@PrimaryKey override val id: String) : Child(id) {
@ColumnInfo(name = "media_id")
var mediaID: String? = null
@ColumnInfo(name = "mediaId")
val mediaID: String,
@ColumnInfo
var server: String? = null
@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 = "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!!
)
@ColumnInfo(name = "playlist_id")
var playlistId: String? = null
}

View file

@ -2,25 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.Genre
import kotlinx.android.parcel.Parcelize
@Keep
@Parcelize
class Genre(
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
)
class Genre : Parcelable {
companion object {
const val ORDER_BY_NAME = "ORDER_BY_NAME"
const val ORDER_BY_RANDOM = "ORDER_BY_RANDOM"

View file

@ -2,192 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable
import androidx.annotation.Keep
import com.cappielloantonio.play.subsonic.models.Child
import com.cappielloantonio.play.subsonic.models.PodcastEpisode
import kotlinx.android.parcel.Parcelize
@Keep
@Parcelize
class Media(
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
)
class Media : Parcelable {
companion object {
const val MEDIA_TYPE_MUSIC = "music"
const val MEDIA_TYPE_PODCAST = "podcast"

View file

@ -2,45 +2,11 @@ package com.cappielloantonio.play.model
import android.os.Parcelable
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
@Keep
@Parcelize
@Entity(tableName = "playlist")
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()
)
class Playlist : Parcelable {
companion object {
const val ALL = "ALL"
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
import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.cappielloantonio.play.subsonic.models.Child
import kotlinx.android.parcel.Parcelize
@Keep
@Parcelize
@Entity(tableName = "queue")
data class Queue(
@PrimaryKey
class Queue(override val id: String) : Child(id) {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "track_order")
val trackOrder: Int,
@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,
var trackOrder: Int = 0
@ColumnInfo(name = "last_play", defaultValue = "0")
val lastPlay: Long,
var lastPlay: Long = 0
@ColumnInfo(name = "playing_changed", defaultValue = "0")
val playingChanged: Long,
var playingChanged: Long = 0
@ColumnInfo(name = "stream_id")
val streamId: String?,
@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
var streamId: String? = null
}

View file

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

View file

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

View file

@ -4,17 +4,14 @@ import android.app.Application;
import androidx.lifecycle.LiveData;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.database.AppDatabase;
import com.cappielloantonio.play.database.dao.DownloadDao;
import com.cappielloantonio.play.model.Download;
import com.cappielloantonio.play.util.PreferenceUtil;
import com.cappielloantonio.play.util.Preferences;
import java.util.List;
public class DownloadRepository {
private static final String TAG = "QueueRepository";
private final DownloadDao downloadDao;
public DownloadRepository(Application application) {
@ -23,31 +20,31 @@ public class DownloadRepository {
}
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) {
if (isArtist) return downloadDao.getSampleArtist(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
else if (isAlbum) return downloadDao.getSampleAlbum(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
else if (isTrack) return downloadDao.getSample(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
else if (isPlaylist) return downloadDao.getSamplePlaylist(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
else return downloadDao.getSample(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
if (isArtist) return downloadDao.getSampleArtist(size, Preferences.getServerId());
else if (isAlbum) return downloadDao.getSampleAlbum(size, Preferences.getServerId());
else if (isTrack) return downloadDao.getSample(size, Preferences.getServerId());
else if (isPlaylist) return downloadDao.getSamplePlaylist(size, Preferences.getServerId());
else return downloadDao.getSample(size, Preferences.getServerId());
}
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) {
return downloadDao.getAllFromAlbum(PreferenceUtil.getInstance(App.getInstance()).getServerId(), albumId);
return downloadDao.getAllFromAlbum(Preferences.getServerId(), albumId);
}
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() {
return downloadDao.getAllPlaylists(PreferenceUtil.getInstance(App.getInstance()).getServerId());
return downloadDao.getAllPlaylists(Preferences.getServerId());
}
public void insert(Download download) {
@ -107,7 +104,7 @@ public class DownloadRepository {
@Override
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 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.util.MappingUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -37,7 +35,7 @@ public class GenreRepository {
@Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
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) {
Collections.shuffle(genreList);

View file

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

View file

@ -7,10 +7,9 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.model.PodcastChannel;
import com.cappielloantonio.play.subsonic.models.PodcastChannel;
import com.cappielloantonio.play.subsonic.models.PodcastEpisode;
import com.cappielloantonio.play.subsonic.models.SubsonicResponse;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.List;
@ -37,7 +36,7 @@ public class PodcastRepository {
@Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
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;
}
public MutableLiveData<List<Media>> getNewestPodcastEpisodes(int count) {
MutableLiveData<List<Media>> liveNewestPodcastEpisodes = new MutableLiveData<>();
public MutableLiveData<List<PodcastEpisode>> getNewestPodcastEpisodes(int count) {
MutableLiveData<List<PodcastEpisode>> liveNewestPodcastEpisodes = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false)
.getPodcastClient()
@ -60,7 +59,7 @@ public class PodcastRepository {
@Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
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;
import android.app.Application;
import android.util.Log;
import androidx.lifecycle.LiveData;
import androidx.media3.common.MediaItem;
import com.cappielloantonio.play.database.AppDatabase;
import com.cappielloantonio.play.database.dao.QueueDao;
import com.cappielloantonio.play.model.Media;
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.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class QueueRepository {
private static final String TAG = "QueueRepository";
@ -30,8 +29,8 @@ public class QueueRepository {
return queueDao.getAll();
}
public List<Media> getMedia() {
List<Media> media = new ArrayList<>();
public List<Child> getMedia() {
List<Child> media = new ArrayList<>();
GetMediaThreadSafe getMedia = new GetMediaThreadSafe(queueDao);
Thread thread = new Thread(getMedia);
@ -39,7 +38,10 @@ public class QueueRepository {
try {
thread.join();
media = getMedia.getMedia();
media = getMedia.getMedia().stream()
.map(Child.class::cast)
.collect(Collectors.toList());
} catch (InterruptedException e) {
e.printStackTrace();
}
@ -47,9 +49,9 @@ public class QueueRepository {
return media;
}
public void insert(Media media, boolean reset, int afterIndex) {
public void insert(Child media, boolean reset, int afterIndex) {
try {
List<Media> mediaList = new ArrayList<>();
List<Queue> mediaList = new ArrayList<>();
if (!reset) {
GetMediaThreadSafe getMediaThreadSafe = new GetMediaThreadSafe(queueDao);
@ -60,7 +62,7 @@ public class QueueRepository {
mediaList = getMediaThreadSafe.getMedia();
}
mediaList.add(afterIndex, media);
mediaList.add(afterIndex, (Queue) media);
Thread delete = new Thread(new DeleteAllThreadSafe(queueDao));
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 {
List<Media> media = new ArrayList<>();
List<Queue> media = new ArrayList<>();
if (!reset) {
GetMediaThreadSafe getMediaThreadSafe = new GetMediaThreadSafe(queueDao);
@ -87,7 +89,9 @@ public class QueueRepository {
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));
delete.start();
@ -206,7 +210,7 @@ public class QueueRepository {
private static class GetMediaThreadSafe implements Runnable {
private final QueueDao queueDao;
private List<Media> media;
private List<Queue> media;
public GetMediaThreadSafe(QueueDao queueDao) {
this.queueDao = queueDao;
@ -214,26 +218,26 @@ public class QueueRepository {
@Override
public void run() {
media = MappingUtil.mapQueue(queueDao.getAllSimple());
media = queueDao.getAllSimple();
}
public List<Media> getMedia() {
public List<Queue> getMedia() {
return media;
}
}
private static class InsertAllThreadSafe implements Runnable {
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.media = media;
}
@Override
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.database.AppDatabase;
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.Media;
import com.cappielloantonio.play.subsonic.models.AlbumID3;
import com.cappielloantonio.play.subsonic.models.ArtistID3;
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.util.MappingUtil;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@ -37,8 +34,8 @@ public class SearchingRepository {
recentSearchDao = database.recentSearchDao();
}
public MutableLiveData<List<Media>> getSearchedSongs(String query) {
MutableLiveData<List<Media>> searchedSongs = new MutableLiveData<>();
public MutableLiveData<SearchResult3> search(String query) {
MutableLiveData<SearchResult3> result = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false)
.getSearchingClient()
@ -46,13 +43,7 @@ public class SearchingRepository {
.enqueue(new Callback<SubsonicResponse>() {
@Override
public void onResponse(@NonNull Call<SubsonicResponse> call, @NonNull Response<SubsonicResponse> response) {
List<Media> songs = new ArrayList<>();
if (response.isSuccessful() && response.body() != null && response.body().getSearchResult3() != null) {
songs.addAll(MappingUtil.mapSong(response.body().getSearchResult3().getSongs()));
}
searchedSongs.setValue(songs);
result.setValue(response.body().getSearchResult3());
}
@Override
@ -61,61 +52,7 @@ public class SearchingRepository {
}
});
return searchedSongs;
}
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;
return result;
}
public MutableLiveData<List<String>> getSuggestions(String query) {

View file

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

View file

@ -1,17 +1,16 @@
package com.cappielloantonio.play.service;
import android.content.Context;
import android.util.Log;
import androidx.media3.common.MediaItem;
import androidx.media3.session.MediaBrowser;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.interfaces.MediaIndexCallback;
import com.cappielloantonio.play.model.Media;
import com.cappielloantonio.play.repository.ChronologyRepository;
import com.cappielloantonio.play.repository.QueueRepository;
import com.cappielloantonio.play.repository.SongRepository;
import com.cappielloantonio.play.subsonic.models.Child;
import com.cappielloantonio.play.util.MappingUtil;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
@ -64,7 +63,7 @@ public class MediaManager {
try {
if (mediaBrowserListenableFuture.isDone()) {
if (mediaBrowserListenableFuture.get().getMediaItemCount() < 1) {
List<Media> media = getQueueRepository().getMedia();
List<Child> media = getQueueRepository().getMedia();
if (media != null && media.size() >= 1) {
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) {
mediaBrowserListenableFuture.addListener(() -> {
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) {
mediaBrowserListenableFuture.addListener(() -> {
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) {
mediaBrowserListenableFuture.addListener(() -> {
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) {
mediaBrowserListenableFuture.addListener(() -> {
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) {
mediaBrowserListenableFuture.addListener(() -> {
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) {
mediaBrowserListenableFuture.addListener(() -> {
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) {
mediaBrowserListenableFuture.addListener(() -> {
try {
@ -307,7 +306,7 @@ public class MediaManager {
public static void saveChronology(MediaItem mediaItem) {
if (mediaItem != null)
if (getQueueRepository().isMediaPlayingPlausible(mediaItem))
getChronologyRepository().insert(MappingUtil.mapChronology(mediaItem));
getChronologyRepository().insert(mediaItem.mediaMetadata.extras.getParcelable("child"));
}
private static QueueRepository getQueueRepository() {
@ -322,19 +321,19 @@ public class MediaManager {
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);
}
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);
}
private static void swapDatabase(List<Media> media) {
private static void swapDatabase(List<Child> media) {
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) {
media.remove(toRemove);
getQueueRepository().insertAll(media, true, 0);

View file

@ -115,13 +115,16 @@ public class Subsonic {
Map<String, String> params = new HashMap<>();
params.put("u", preferences.getUsername());
if (preferences.getAuthentication().getPassword() != null) params.put("p", preferences.getAuthentication().getPassword());
if (preferences.getAuthentication().getSalt() != null) params.put("s", preferences.getAuthentication().getSalt());
if (preferences.getAuthentication().getToken() != null) params.put("t", preferences.getAuthentication().getToken());
if (preferences.getAuthentication().getPassword() != null)
params.put("p", preferences.getAuthentication().getPassword());
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("c", preferences.getClientName());
params.put("f", "xml");
params.put("f", "json");
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 com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
import java.util.Date;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml(name = "album")
public class AlbumID3 {
open class AlbumID3 : Parcelable {
@Attribute
protected String id;
var id: String? = null
@Attribute
protected String name;
var name: String? = null
@Attribute
protected String artist;
var artist: String? = null
@Attribute
protected String artistId;
var artistId: String? = null
@Attribute(name = "coverArt")
protected String coverArtId;
var coverArtId: String? = null
@Attribute
protected int songCount;
var songCount = 0
@Attribute
protected int duration;
var duration = 0
@Attribute
protected Long playCount;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date starred;
var playCount: Long? = null
@Attribute(converter = DateRfc3339TypeConverter::class)
var created: Date? = null
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null
@Attribute
protected Integer year;
var year: Int? = null
@Attribute
protected String genre;
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;
}
var genre: String? = null
}

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.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class AlbumInfo {
class AlbumInfo {
@Attribute
protected String notes;
var notes: String? = null
@Attribute
protected String musicBrainzId;
var musicBrainzId: String? = null
@Attribute
protected String lastFmUrl;
var lastFmUrl: String? = null
@Attribute
protected String smallImageUrl;
var smallImageUrl: String? = null
@Attribute
protected String mediumImageUrl;
var mediumImageUrl: String? = null
@Attribute
protected String largeImageUrl;
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;
}
var largeImageUrl: String? = null
}

View file

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

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 com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import kotlinx.android.parcel.Parcelize
@Parcelize
@Xml
public class AlbumWithSongsID3 extends AlbumID3 {
class AlbumWithSongsID3 : AlbumID3(), Parcelable {
@Element(name = "song")
protected List<Child> songs;
public List<Child> getSongs() {
if (songs == null) {
songs = new ArrayList<>();
}
return this.songs;
}
public void setSongs(List<Child> songs) {
this.songs = songs;
}
var songs: List<Child>? = null
}

View file

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

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 com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
import java.util.Date;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml(name = "artist")
public class ArtistID3 {
open class ArtistID3 : Parcelable {
@Attribute
protected String id;
var id: String? = null
@Attribute
protected String name;
var name: String? = null
@Attribute(name = "coverArt")
protected String coverArtId;
var coverArtId: String? = null
@Attribute
protected int albumCount;
@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;
}
var albumCount = 0
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null
}

View file

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

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.Xml;
import com.tickaroo.tikxml.annotation.PropertyElement
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class ArtistInfoBase {
open class ArtistInfoBase {
@PropertyElement
protected String biography;
var biography: String? = null
@PropertyElement
protected String musicBrainzId;
var musicBrainzId: String? = null
@PropertyElement
protected String lastFmUrl;
var lastFmUrl: String? = null
@PropertyElement
protected String smallImageUrl;
var smallImageUrl: String? = null
@PropertyElement
protected String mediumImageUrl;
var mediumImageUrl: String? = null
@PropertyElement
protected String largeImageUrl;
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;
}
var largeImageUrl: String? = null
}

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 com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import kotlinx.android.parcel.Parcelize
@Parcelize
@Xml
public class ArtistWithAlbumsID3 extends ArtistID3 {
class ArtistWithAlbumsID3 : ArtistID3(), Parcelable {
@Element(name = "album")
protected List<AlbumID3> albums;
public List<AlbumID3> getAlbums() {
if (albums == null) {
albums = new ArrayList<>();
}
return this.albums;
}
public void setAlbums(List<AlbumID3> albums) {
this.albums = albums;
}
var albums: List<AlbumID3>? = null
}

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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class ArtistsID3 {
class ArtistsID3 {
@Element(name = "index")
protected List<IndexID3> indices;
protected String ignoredArticles;
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;
}
var indices: List<IndexID3>? = null
var ignoredArticles: String? = null
}

View file

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

View file

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

View file

@ -1,36 +1,5 @@
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;
}
package com.cappielloantonio.play.subsonic.models
class Bookmarks {
var bookmarks: List<Bookmark>? = null
}

View file

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

View file

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

View file

@ -1,35 +1,5 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
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;
}
class ChatMessages {
var chatMessages: List<ChatMessage>? = null
}

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 com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
import java.util.Date;
import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.PrimaryKey
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml
public class Child {
open class Child(
@PrimaryKey
@ColumnInfo(name = "id")
@Attribute
protected String id;
open val id: String,
@ColumnInfo(name = "parent_id")
@Attribute(name = "parent")
protected String parentId;
@Attribute(name = "isDir")
protected boolean dir;
var parentId: String? = null,
@ColumnInfo(name = "is_dir")
@Attribute
protected String title;
var isDir: Boolean = false,
@ColumnInfo
@Attribute
protected String album;
var title: String? = null,
@ColumnInfo
@Attribute
protected String artist;
var album: String? = null,
@ColumnInfo
@Attribute
protected Integer track;
var artist: String? = null,
@ColumnInfo
@Attribute
protected Integer year;
var track: Int? = null,
@ColumnInfo
@Attribute
var year: Int? = null,
@ColumnInfo
@Attribute(name = "genre")
protected String genre;
var genre: String? = null,
@ColumnInfo(name = "cover_art_id")
@Attribute(name = "coverArt")
protected String coverArtId;
var coverArtId: String? = null,
@ColumnInfo
@Attribute
protected Long size;
var size: Long? = null,
@ColumnInfo(name = "content_type")
@Attribute
protected String contentType;
var contentType: String? = null,
@ColumnInfo
@Attribute
protected String suffix;
var suffix: String? = null,
@ColumnInfo("transcoding_content_type")
@Attribute
protected String transcodedContentType;
var transcodedContentType: String? = null,
@ColumnInfo(name = "transcoded_suffix")
@Attribute
protected String transcodedSuffix;
var transcodedSuffix: String? = null,
@ColumnInfo
@Attribute
protected Integer duration;
var duration: Int? = null,
@ColumnInfo("bitrate")
@Attribute(name = "bitRate")
var bitrate: Int? = null,
@ColumnInfo
@Attribute
protected Integer bitRate;
@Attribute
protected String path;
var path: String? = null,
@ColumnInfo(name = "is_video")
@Attribute(name = "isVideo")
protected Boolean video;
var isVideo: Boolean = false,
@ColumnInfo(name = "user_rating")
@Attribute
protected Integer userRating;
var userRating: Int? = null,
@ColumnInfo(name = "average_rating")
@Attribute
protected Double averageRating;
var averageRating: Double? = null,
@ColumnInfo(name = "play_count")
@Attribute
protected Long playCount;
var playCount: Long? = null,
@ColumnInfo(name = "disc_number")
@Attribute
protected Integer discNumber;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date starred;
var discNumber: Int? = null,
@ColumnInfo
@Attribute(converter = DateRfc3339TypeConverter::class)
var created: Date? = null,
@ColumnInfo
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null,
@ColumnInfo(name = "album_id")
@Attribute
protected String albumId;
var albumId: String? = null,
@ColumnInfo(name = "artist_id")
@Attribute
protected String artistId;
var artistId: String? = null,
@ColumnInfo
@Attribute
protected String type;
var type: String? = null,
@ColumnInfo(name = "bookmark_position")
@Attribute
protected Long bookmarkPosition;
var bookmarkPosition: Long? = null,
@ColumnInfo(name = "original_width")
@Attribute
protected Integer originalWidth;
var originalWidth: Int? = null,
@ColumnInfo(name = "original_height")
@Attribute
protected Integer originalHeight;
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;
}
}
var originalHeight: Int? = null
) : Parcelable

View file

@ -1,183 +1,128 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDateTime
public class Directory {
protected List<Child> children;
protected String id;
protected String parentId;
protected String name;
protected LocalDateTime starred;
protected Integer userRating;
protected Double averageRating;
protected Long playCount;
class Directory {
protected var children: List<Child>? = null
/**
* Gets the value of the id property.
*
* @return possible object is
* [String]
*/
/**
* 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.
*
* <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>
</pre> *
*
*
*
*
* <p>
* 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) {
children = new ArrayList<>();
children = ArrayList()
}
return this.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;
return children
}
}

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.tickaroo.tikxml.annotation.Attribute;
import com.tickaroo.tikxml.annotation.Xml;
import com.cappielloantonio.play.subsonic.utils.converter.ErrorCodeConverter
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class Error {
@Attribute(converter = ErrorCodeConverter.class)
protected ErrorCode code;
class Error {
@Attribute(converter = ErrorCodeConverter::class)
var code: ErrorCode? = null
@Attribute
protected String message;
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;
}
var message: String? = null
}

View file

@ -1,23 +1,16 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
public class ErrorCode {
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;
class ErrorCode(val value: Int) {
private final int value;
public ErrorCode(int value) {
this.value = value;
}
public int getValue() {
return value;
companion object {
var GENERIC_ERROR = 0
var REQUIRED_PARAMETER_MISSING = 10
var INCOMPATIBLE_VERSION_CLIENT = 20
var INCOMPATIBLE_VERSION_SERVER = 30
var WRONG_USERNAME_OR_PASSWORD = 40
var TOKEN_AUTHENTICATION_NOT_SUPPORTED = 41
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 com.tickaroo.tikxml.annotation.TextContent;
import com.tickaroo.tikxml.annotation.Xml;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.TextContent
import com.tickaroo.tikxml.annotation.Xml
import kotlinx.android.parcel.Parcelize
@Parcelize
@Xml
public class Genre {
class Genre : Parcelable {
@TextContent
protected String genre;
var genre: String? = null
@Attribute
protected int songCount;
var songCount = 0
@Attribute
protected int albumCount;
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;
}
var albumCount = 0
}

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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class Genres {
class Genres {
@Element
protected List<Genre> genres;
public List<Genre> getGenres() {
if (genres == null) {
genres = new ArrayList<>();
}
return this.genres;
}
public void setGenres(List<Genre> genres) {
this.genres = genres;
}
var genres: List<Genre>? = null
}

View file

@ -1,56 +1,6 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
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;
}
class Index {
var artists: List<Artist>? = null
var name: String? = null
}

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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class IndexID3 {
class IndexID3 {
@Element(name = "artist")
protected List<ArtistID3> artists;
protected String name;
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;
}
var artists: List<ArtistID3>? = null
var name: String? = null
}

View file

@ -1,127 +1,9 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
public class Indexes {
protected List<Artist> shortcuts;
protected List<Index> indices;
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;
}
class Indexes {
var shortcuts: List<Artist>? = null
var indices: List<Index>? = null
var children: List<Child>? = null
var lastModified: Long = 0
var ignoredArticles: String? = null
}

View file

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

View file

@ -1,36 +1,5 @@
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;
}
package com.cappielloantonio.play.subsonic.models
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;
import java.util.List;
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;
}
class JukeboxPlaylist : JukeboxStatus() {
var entries: List<Child>? = null
}

View file

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

View file

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

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.TextContent;
import com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.TextContent
import com.tickaroo.tikxml.annotation.Xml
@Xml(name = "lyrics")
public class Lyrics {
class Lyrics {
@TextContent
protected String content;
var content: String? = null
@Attribute
protected String artist;
var artist: String? = null
@Attribute
protected String title;
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;
}
var title: String? = null
}

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.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class MediaType {
public static String MUSIC = "music";
public static String PODCAST = "podcast";
public static String AUDIOBOOK = "audiobook";
public static String VIDEO = "video";
class MediaType {
@Attribute
private String value;
var value: String? = null
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
companion object {
var MUSIC = "music"
var PODCAST = "podcast"
var AUDIOBOOK = "audiobook"
var VIDEO = "video"
}
}

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.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class MusicFolder {
class MusicFolder {
@Attribute
protected int id;
var id = 0
@Attribute
protected String name;
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;
}
var name: String? = 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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class MusicFolders {
class MusicFolders {
@Element
protected List<MusicFolder> musicFolders;
public List<MusicFolder> getMusicFolders() {
if (musicFolders == null) {
musicFolders = new ArrayList<>();
}
return this.musicFolders;
}
public void setMusicFolders(List<MusicFolder> musicFolders) {
this.musicFolders = musicFolders;
}
var musicFolders: List<MusicFolder>? = 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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class NewestPodcasts {
class NewestPodcasts {
@Element(name = "episode")
protected List<PodcastEpisode> episodes;
public List<PodcastEpisode> getEpisodes() {
if (episodes == null) {
episodes = new ArrayList<>();
}
return this.episodes;
}
public void setEpisodes(List<PodcastEpisode> episodes) {
this.episodes = episodes;
}
var episodes: List<PodcastEpisode>? = null
}

View file

@ -1,35 +1,5 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
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;
}
class NowPlaying {
var entries: List<NowPlayingEntry>? = null
}

View file

@ -1,76 +1,11 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
public class NowPlayingEntry extends Child {
protected String username;
protected int minutesAgo;
protected int playerId;
protected String playerName;
import kotlinx.android.parcel.Parcelize
/**
* 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 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;
}
@Parcelize
class NowPlayingEntry(override val id: String) : Child(id) {
var username: String? = null
var minutesAgo = 0
var playerId = 0
var playerName: String? = null
}

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.util.ArrayList;
import java.util.List;
import java.time.LocalDateTime
public class PlayQueue {
protected List<Child> entries;
protected Integer current;
protected Long position;
protected String username;
protected LocalDateTime changed;
protected String changedBy;
/**
* 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;
}
class PlayQueue {
var entries: List<Child>? = null
var current: Int? = null
var position: Long? = null
var username: String? = null
var changed: LocalDateTime? = null
var changedBy: String? = null
}

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 com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import android.os.Parcelable
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import com.tickaroo.tikxml.annotation.Attribute
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
public class Playlist {
protected List<String> allowedUsers;
open class Playlist : Parcelable {
@PrimaryKey
@ColumnInfo(name = "id")
@Attribute
protected String id;
lateinit var id: String
@ColumnInfo(name = "name")
@Attribute
protected String name;
var name: String? = null
@Ignore
@Attribute
protected String comment;
var comment: String? = null
@Ignore
@Attribute
protected String owner;
var owner: String? = null
@Ignore
@Attribute(name = "public")
protected Boolean universal;
var isUniversal: Boolean? = null
@Ignore
@Attribute
protected int songCount;
var songCount: Int = 0
@Ignore
@ColumnInfo(name = "duration")
@Attribute
protected int duration;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date changed;
var duration: Long = 0
@Ignore
@Attribute(converter = DateRfc3339TypeConverter::class)
var created: Date? = null
@Ignore
@Attribute(converter = DateRfc3339TypeConverter::class)
var changed: Date? = null
@Ignore
@ColumnInfo(name = "coverArt")
@Attribute
protected String coverArtId;
var coverArtId: String? = null
public List<String> getAllowedUsers() {
if (allowedUsers == null) {
allowedUsers = new ArrayList<>();
}
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;
}
@Ignore
@Attribute
var allowedUsers: List<String>? = null
}

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 com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import kotlinx.android.parcel.Parcelize
@Parcelize
@Xml
public class PlaylistWithSongs extends Playlist {
class PlaylistWithSongs : Playlist(), Parcelable {
@Element(name = "entry")
protected List<Child> entries;
public List<Child> getEntries() {
if (entries == null) {
entries = new ArrayList<>();
}
return this.entries;
}
public void setEntries(List<Child> entries) {
this.entries = entries;
}
var entries: List<Child>? = 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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class Playlists {
class Playlists {
@Element(name = "playlist")
protected List<Playlist> playlists;
public List<Playlist> getPlaylists() {
if (playlists == null) {
playlists = new ArrayList<>();
}
return this.playlists;
}
public void setPlaylists(List<Playlist> playlists) {
this.playlists = playlists;
}
var playlists: List<Playlist>? = null
}

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 com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
import kotlinx.android.parcel.Parcelize
@Parcelize
@Xml
public class PodcastChannel {
class PodcastChannel : Parcelable {
@Element(name = "episode")
protected List<PodcastEpisode> episodes;
var episodes: List<PodcastEpisode>? = null
@Attribute
protected String id;
var id: String? = null
@Attribute
protected String url;
var url: String? = null
@Attribute
protected String title;
var title: String? = null
@Attribute
protected String description;
var description: String? = null
@Attribute
protected String coverArtId;
var coverArtId: String? = null
@Attribute
protected String originalImageUrl;
var originalImageUrl: String? = null
@Attribute
protected String status;
var status: String? = null
@Attribute
protected String errorMessage;
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;
}
var errorMessage: String? = null
}

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 com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
import java.util.Date;
import android.os.Parcelable
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter
import kotlinx.android.parcel.Parcelize
import java.util.*
@Parcelize
@Xml
public class PodcastEpisode {
class PodcastEpisode : Parcelable {
@Attribute
protected String id;
var id: String? = null
@Attribute(name = "parent")
protected String parentId;
var parentId: String? = null
@Attribute(name = "isDir")
protected boolean dir;
var isDir = false
@Attribute
protected String title;
var title: String? = null
@Attribute
protected String album;
var album: String? = null
@Attribute
protected String artist;
var artist: String? = null
@Attribute
protected Integer track;
var track: Int? = null
@Attribute
protected Integer year;
var year: Int? = null
@Attribute(name = "genre")
protected String genre;
var genre: String? = null
@Attribute(name = "coverArt")
protected String coverArtId;
var coverArtId: String? = null
@Attribute
protected Long size;
var size: Long? = null
@Attribute
protected String contentType;
var contentType: String? = null
@Attribute
protected String suffix;
var suffix: String? = null
@Attribute
protected String transcodedContentType;
var transcodedContentType: String? = null
@Attribute
protected String transcodedSuffix;
var transcodedSuffix: String? = null
@Attribute
protected Integer duration;
var duration: Int? = null
@Attribute
protected Integer bitRate;
var bitRate: Int? = null
@Attribute
protected String path;
var path: String? = null
@Attribute(name = "isVideo")
protected Boolean video;
@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;
var video: Boolean? = null
@Attribute
protected String streamId;
var userRating: Int? = null
@Attribute
protected String channelId;
var averageRating: Double? = null
@Attribute
protected String description;
var playCount: Long? = null
@Attribute
protected String status;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date publishDate;
var discNumber: Int? = null
public String getId() {
return id;
}
@Attribute(converter = DateRfc3339TypeConverter::class)
var created: Date? = null
public void setId(String id) {
this.id = id;
}
@Attribute(converter = DateRfc3339TypeConverter::class)
var starred: Date? = null
public String getParentId() {
return parentId;
}
@Attribute
var albumId: String? = null
public void setParentId(String parentId) {
this.parentId = parentId;
}
@Attribute
var artistId: String? = null
public boolean isDir() {
return dir;
}
@Attribute
var type: String? = null
public void setDir(boolean dir) {
this.dir = dir;
}
@Attribute
var bookmarkPosition: Long? = null
public String getTitle() {
return title;
}
@Attribute
var originalWidth: Int? = null
public void setTitle(String title) {
this.title = title;
}
@Attribute
var originalHeight: Int? = null
public String getAlbum() {
return album;
}
@Attribute
var streamId: String? = null
public void setAlbum(String album) {
this.album = album;
}
@Attribute
var channelId: String? = null
public String getArtist() {
return artist;
}
@Attribute
var description: String? = null
public void setArtist(String artist) {
this.artist = artist;
}
@Attribute
var status: String? = null
public Integer getTrack() {
return track;
}
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;
}
@Attribute(converter = DateRfc3339TypeConverter::class)
var publishDate: Date? = null
}

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.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public 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";
class PodcastStatus {
@Attribute
private String value;
var value: String? = null
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
companion object {
var NEW = "new"
var DOWNLOADING = "downloading"
var COMPLETED = "completed"
var ERROR = "error"
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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class Podcasts {
class Podcasts {
@Element(name = "channel")
protected List<PodcastChannel> channels;
public List<PodcastChannel> getChannels() {
if (channels == null) {
channels = new ArrayList<>();
}
return this.channels;
}
public void setChannels(List<PodcastChannel> channels) {
this.channels = channels;
}
var channels: List<PodcastChannel>? = null
}

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.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class ResponseStatus {
public static String OK = "ok";
public static String FAILED = "failed";
class ResponseStatus(@param:Attribute val value: String) {
private final String value;
companion object {
@JvmField
var OK = "ok"
public ResponseStatus(@Attribute String value) {
this.value = value;
}
public String getValue() {
return value;
@JvmField
var FAILED = "failed"
}
}

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.Xml;
import com.tickaroo.tikxml.annotation.Attribute
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class ScanStatus {
class ScanStatus {
@Attribute
protected boolean scanning;
var isScanning = false
@Attribute
protected Long count;
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;
}
var count: Long? = null
}

View file

@ -1,65 +1,7 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.util.ArrayList;
import java.util.List;
public class SearchResult {
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;
}
class SearchResult {
var matches: List<Child>? = null
var offset = 0
var totalHits = 0
}

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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class SearchResult2 {
class SearchResult2 {
@Element(name = "artist")
protected List<Artist> artists;
var artists: List<Artist>? = null
@Element(name = "album")
protected List<Child> albums;
var albums: List<Child>? = null
@Element(name = "song")
protected List<Child> songs;
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;
}
var songs: List<Child>? = null
}

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.Xml;
import java.util.ArrayList;
import java.util.List;
import com.tickaroo.tikxml.annotation.Element
import com.tickaroo.tikxml.annotation.Xml
@Xml
public class SearchResult3 {
class SearchResult3 {
@Element(name = "artist")
protected List<ArtistID3> artists;
var artists: List<ArtistID3>? = null
@Element(name = "album")
protected List<AlbumID3> albums;
var albums: List<AlbumID3>? = null
@Element(name = "song")
protected List<Child> songs;
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;
}
var songs: List<Child>? = null
}

View file

@ -1,198 +1,15 @@
package com.cappielloantonio.play.subsonic.models;
package com.cappielloantonio.play.subsonic.models
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDateTime
public class Share {
protected List<Child> entries;
protected String id;
protected String url;
protected String description;
protected String username;
protected LocalDateTime created;
protected LocalDateTime expires;
protected LocalDateTime lastVisited;
protected int visitCount;
/**
* 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;
}
class Share {
var entries: List<Child>? = null
var id: String? = null
var url: String? = null
var description: String? = null
var username: String? = null
var created: LocalDateTime? = null
var expires: LocalDateTime? = null
var lastVisited: LocalDateTime? = null
var visitCount = 0
}

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