mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Added information on bitrate and file extension
This commit is contained in:
parent
91c9037fe5
commit
3e87610a9f
4 changed files with 117 additions and 13 deletions
|
|
@ -21,9 +21,9 @@ import com.cappielloantonio.play.model.Server;
|
|||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Database(
|
||||
version = 38,
|
||||
version = 41,
|
||||
entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Playlist.class}
|
||||
// autoMigrations = { @AutoMigration(from = 35, to = 36) }
|
||||
// autoMigrations = {@AutoMigration(from = 39, to = 40)}
|
||||
)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
private static final String TAG = "AppDatabase";
|
||||
|
|
|
|||
|
|
@ -54,10 +54,19 @@ public class Download {
|
|||
@ColumnInfo(name = "playlistName")
|
||||
private String playlistName;
|
||||
|
||||
@ColumnInfo(name = "container")
|
||||
private String container;
|
||||
|
||||
@ColumnInfo(name = "bitrate")
|
||||
private int bitrate;
|
||||
|
||||
@ColumnInfo(name = "extension")
|
||||
private String extension;
|
||||
|
||||
@ColumnInfo(name = "type")
|
||||
private String type;
|
||||
|
||||
public Download(@NonNull String id, String mediaID, String title, String albumId, String albumName, String artistId, String artistName, int trackNumber, String primary, long duration, String server, String playlistId, String playlistName, String type) {
|
||||
public Download(@NonNull String id, String mediaID, String title, String albumId, String albumName, String artistId, String artistName, int trackNumber, String primary, long duration, String server, String playlistId, String playlistName, String container, int bitrate, String extension, String type) {
|
||||
this.id = id;
|
||||
this.mediaID = mediaID;
|
||||
this.title = title;
|
||||
|
|
@ -71,6 +80,9 @@ public class Download {
|
|||
this.server = server;
|
||||
this.playlistId = playlistId;
|
||||
this.playlistName = playlistName;
|
||||
this.container = container;
|
||||
this.bitrate = bitrate;
|
||||
this.extension = extension;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +100,9 @@ public class Download {
|
|||
this.server = PreferenceUtil.getInstance(App.getInstance()).getServerId();
|
||||
this.playlistId = playlistId;
|
||||
this.playlistName = playlistName;
|
||||
this.container = media.getContainer();
|
||||
this.bitrate = media.getBitrate();
|
||||
this.extension = media.getExtension();
|
||||
this.type = media.getType();
|
||||
}
|
||||
|
||||
|
|
@ -196,6 +211,30 @@ public class Download {
|
|||
this.playlistName = playlistName;
|
||||
}
|
||||
|
||||
public String getContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
public void setContainer(String container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public int getBitrate() {
|
||||
return bitrate;
|
||||
}
|
||||
|
||||
public void setBitrate(int bitrate) {
|
||||
this.bitrate = bitrate;
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
public void setExtension(String extension) {
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.cappielloantonio.play.model;
|
|||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
|
|
@ -53,7 +54,8 @@ public class Media implements Parcelable {
|
|||
private String path;
|
||||
private long size;
|
||||
private String container;
|
||||
private int bitRate;
|
||||
private int bitrate;
|
||||
private String extension;
|
||||
private long added;
|
||||
private String type;
|
||||
private int playCount;
|
||||
|
|
@ -75,14 +77,22 @@ public class Media implements Parcelable {
|
|||
this.coverArtId = child.getCoverArtId();
|
||||
this.starred = child.getStarred() != null;
|
||||
this.path = child.getPath();
|
||||
this.size = child.getSize();
|
||||
this.size = child.getSize() != null ? child.getSize() : 0;
|
||||
this.container = child.getContentType();
|
||||
this.bitRate = child.getBitRate();
|
||||
this.bitrate = child.getBitRate();
|
||||
this.extension = child.getSuffix();
|
||||
this.added = child.getCreated().getTime();
|
||||
this.playCount = 0;
|
||||
this.lastPlay = 0;
|
||||
this.rating = child.getUserRating() != null ? child.getUserRating() : 0;
|
||||
this.type = child.getType();
|
||||
|
||||
Log.i(TAG, "Title: " + child.getTitle());
|
||||
Log.i(TAG, "ContentType: " + child.getContentType());
|
||||
Log.i(TAG, "Bitrate: " + child.getBitRate());
|
||||
Log.i(TAG, "Suffix: " + child.getSuffix());
|
||||
Log.i(TAG, "TranscodedContentType: " + child.getTranscodedContentType());
|
||||
Log.i(TAG, "TranscodedCSuffix: " + child.getTranscodedSuffix());
|
||||
}
|
||||
|
||||
public Media(PodcastEpisode podcastEpisode) {
|
||||
|
|
@ -100,6 +110,9 @@ public class Media implements Parcelable {
|
|||
this.description = podcastEpisode.getDescription();
|
||||
this.status = podcastEpisode.getStatus();
|
||||
this.publishDate = podcastEpisode.getPublishDate().getTime();
|
||||
this.container = podcastEpisode.getContentType();
|
||||
this.bitrate = podcastEpisode.getBitRate();
|
||||
this.extension = podcastEpisode.getSuffix();
|
||||
this.type = podcastEpisode.getType();
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +128,9 @@ public class Media implements Parcelable {
|
|||
this.streamId = queue.getStreamId();
|
||||
this.channelId = queue.getChannelId();
|
||||
this.publishDate = queue.getPublishingDate();
|
||||
this.container = queue.getContainer();
|
||||
this.bitrate = queue.getBitrate();
|
||||
this.extension = queue.getExtension();
|
||||
this.type = queue.getType();
|
||||
}
|
||||
|
||||
|
|
@ -128,6 +144,9 @@ public class Media implements Parcelable {
|
|||
this.trackNumber = download.getTrackNumber();
|
||||
this.coverArtId = download.getPrimary();
|
||||
this.duration = download.getDuration();
|
||||
this.container = download.getContainer();
|
||||
this.bitrate = download.getBitrate();
|
||||
this.extension = download.getExtension();
|
||||
this.type = download.getType();
|
||||
}
|
||||
|
||||
|
|
@ -283,12 +302,20 @@ public class Media implements Parcelable {
|
|||
this.container = container;
|
||||
}
|
||||
|
||||
public int getBitRate() {
|
||||
return bitRate;
|
||||
public int getBitrate() {
|
||||
return bitrate;
|
||||
}
|
||||
|
||||
public void setBitRate(int bitRate) {
|
||||
this.bitRate = bitRate;
|
||||
public void setBitrate(int bitRate) {
|
||||
this.bitrate = bitRate;
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
public void setExtension(String extension) {
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public long getAdded() {
|
||||
|
|
@ -385,7 +412,8 @@ public class Media implements Parcelable {
|
|||
dest.writeString(this.path);
|
||||
dest.writeLong(this.size);
|
||||
dest.writeString(this.container);
|
||||
dest.writeInt(this.bitRate);
|
||||
dest.writeInt(this.bitrate);
|
||||
dest.writeString(this.extension);
|
||||
dest.writeLong(this.added);
|
||||
dest.writeString(this.type);
|
||||
dest.writeInt(this.playCount);
|
||||
|
|
@ -414,7 +442,8 @@ public class Media implements Parcelable {
|
|||
this.path = in.readString();
|
||||
this.size = in.readLong();
|
||||
this.container = in.readString();
|
||||
this.bitRate = in.readInt();
|
||||
this.bitrate = in.readInt();
|
||||
this.extension = in.readString();
|
||||
this.added = in.readLong();
|
||||
this.type = in.readString();
|
||||
this.playCount = in.readInt();
|
||||
|
|
|
|||
|
|
@ -49,10 +49,19 @@ public class Queue {
|
|||
@ColumnInfo(name = "publishing_date", defaultValue = "0")
|
||||
private long publishingDate;
|
||||
|
||||
@ColumnInfo(name = "container")
|
||||
private String container;
|
||||
|
||||
@ColumnInfo(name = "bitrate")
|
||||
private int bitrate;
|
||||
|
||||
@ColumnInfo(name = "extension")
|
||||
private String extension;
|
||||
|
||||
@ColumnInfo(name = "media_type")
|
||||
private String type;
|
||||
|
||||
public Queue(int trackOrder, String id, String title, String albumId, String albumName, String artistId, String artistName, String coverArtId, long duration, long lastPlay, long playingChanged, String streamId, String channelId, long publishingDate, String type) {
|
||||
public Queue(int trackOrder, String id, String title, String albumId, String albumName, String artistId, String artistName, String coverArtId, long duration, long lastPlay, long playingChanged, String streamId, String channelId, long publishingDate, String container, int bitrate, String extension, String type) {
|
||||
this.trackOrder = trackOrder;
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
|
|
@ -67,6 +76,9 @@ public class Queue {
|
|||
this.streamId = streamId;
|
||||
this.channelId = channelId;
|
||||
this.publishingDate = publishingDate;
|
||||
this.container = container;
|
||||
this.bitrate = bitrate;
|
||||
this.extension = extension;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
|
@ -182,6 +194,30 @@ public class Queue {
|
|||
this.publishingDate = publishingDate;
|
||||
}
|
||||
|
||||
public String getContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
public void setContainer(String container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public int getBitrate() {
|
||||
return bitrate;
|
||||
}
|
||||
|
||||
public void setBitrate(int bitrate) {
|
||||
this.bitrate = bitrate;
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return extension;
|
||||
}
|
||||
|
||||
public void setExtension(String extension) {
|
||||
this.extension = extension;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue