Some fixes

This commit is contained in:
Thomas 2020-09-26 19:31:38 +02:00
parent 2044a85b58
commit 9c476037ef
11 changed files with 343 additions and 154 deletions

View File

@ -61,6 +61,7 @@ import app.fedilab.fedilabtube.client.data.AccountData.Account;
import app.fedilab.fedilabtube.client.data.ChannelData.Channel;
import app.fedilab.fedilabtube.client.data.VideoData.Video;
import app.fedilab.fedilabtube.client.entities.Item;
import app.fedilab.fedilabtube.client.entities.ItemStr;
import app.fedilab.fedilabtube.client.entities.VideoParams;
import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.viewmodel.ChannelsVM;
@ -93,8 +94,8 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
private VideoParams videoParams;
private Video video;
private String channelToSendId;
Item languageToSend, licenseToSend, privacyToSend, categoryToSend;
Item licenseToSend, privacyToSend, categoryToSend;
ItemStr languageToSend;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -271,10 +272,10 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
});
if (languageToSend == null) {
languageToSend = new Item();
languageToSend = new ItemStr();
LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages());
Map.Entry<String, String> entryString = languages.entrySet().iterator().next();
languageToSend.setId(Long.parseLong(entryString.getKey()));
languageToSend.setId(entryString.getKey());
languageToSend.setLabel(entryString.getValue());
}
@ -449,7 +450,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
while (it.hasNext()) {
Map.Entry<String, String> pair = it.next();
if (i == position) {
languageToSend.setId(Long.parseLong(pair.getKey()));
languageToSend.setId(pair.getKey());
languageToSend.setLabel(pair.getValue());
break;
}
@ -490,7 +491,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
Item finalCategoryToSend = categoryToSend;
Item finalLicenseToSend = licenseToSend;
Item finalLanguageToSend = languageToSend;
ItemStr finalLanguageToSend = languageToSend;
Item finalPrivacyToSend = privacyToSend;
set_upload_submit.setOnClickListener(v -> {
String title1 = p_video_title.getText().toString().trim();
@ -504,7 +505,7 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
videoParams.setCommentsEnabled(commentEnabled1);
videoParams.setCategory((int)finalCategoryToSend.getId());
videoParams.setLicence(String.valueOf(finalLicenseToSend.getId()));
videoParams.setLanguage((int) finalLanguageToSend.getId());
videoParams.setLanguage(finalLanguageToSend.getId());
videoParams.setChannelId(channelToSendId);
videoParams.setPrivacy((int) finalPrivacyToSend.getId());
List<String> tags = p_video_tags.getTags();
@ -519,9 +520,9 @@ public class PeertubeEditUploadActivity extends AppCompatActivity {
set_upload_licenses.setSelection(licensePosition);
set_upload_categories.setSelection(categoryPosition);
String[] tags = video.getTags();
if (tags != null && tags.length > 0) {
p_video_tags.setTags(tags);
List<String> tags = video.getTags();
if (tags != null && tags.size() > 0) {
p_video_tags.setTags(tags.toArray(new String[0]));
}
}

View File

@ -26,7 +26,7 @@ import app.fedilab.fedilabtube.client.data.NotificationData;
import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.OverviewVideo;
import app.fedilab.fedilabtube.client.data.OverviewVideoData.OverviewVideo;
import app.fedilab.fedilabtube.client.entities.Rating;
@SuppressWarnings({"unused", "RedundantSuppression"})

View File

@ -23,13 +23,13 @@ import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.data.CommentData;
import app.fedilab.fedilabtube.client.data.InstanceData;
import app.fedilab.fedilabtube.client.data.NotificationData;
import app.fedilab.fedilabtube.client.data.OverviewVideoData;
import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.CaptionsParams;
import app.fedilab.fedilabtube.client.entities.ChannelParams;
import app.fedilab.fedilabtube.client.entities.Oauth;
import app.fedilab.fedilabtube.client.entities.OauthParams;
import app.fedilab.fedilabtube.client.entities.OverviewVideo;
import app.fedilab.fedilabtube.client.entities.PlaylistExist;
import app.fedilab.fedilabtube.client.entities.PlaylistParams;
import app.fedilab.fedilabtube.client.entities.Rating;
@ -95,31 +95,31 @@ public interface PeertubeService {
//Timelines Authenticated
//Subscriber timeline
@GET("users/me/subscriptions/videos?sort=-publishedAt")
Call<List<VideoData.Video>> getSubscriptionVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
Call<VideoData> getSubscriptionVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
//Overview videos
@GET("overviews/videos")
Call<OverviewVideo> getOverviewVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
Call<OverviewVideoData> getOverviewVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
//Most liked videos
@GET("videos?sort=-likes")
Call<List<VideoData.Video>> getMostLikedVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
Call<VideoData> getMostLikedVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
//Most liked videos
@GET("videos?sort=-trending")
Call<List<VideoData.Video>> getTrendingVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
Call<VideoData> getTrendingVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
//Recently added videos
@GET("videos?sort=-publishedAt")
Call<List<VideoData.Video>> getRecentlyAddedVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
Call<VideoData> getRecentlyAddedVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
//Local videos
@GET("videos?sort=-publishedAt&filter=local")
Call<List<VideoData.Video>> getLocalVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
Call<VideoData> getLocalVideos(@Query("start") String maxId, @Query("languageOneOf") List<String> languageOneOf);
//History
@GET("users/me/history/videos")
Call<List<VideoData.Video>> getHistory(@Query("start") String maxId);
Call<VideoData> getHistory(@Query("start") String maxId);
//Search
@GET("search/videos")
@ -136,7 +136,7 @@ public interface PeertubeService {
//Get my video
@GET("users/me/videos?sort=-publishedAt")
Call<List<VideoData.Video>> getMyVideo(@Header("Authorization") String credentials, @Query("start") String maxId);
Call<VideoData> getMyVideo(@Header("Authorization") String credentials, @Query("start") String maxId);
//Get my video
@GET("accounts/{name}/videos?sort=-publishedAt")

View File

@ -41,6 +41,7 @@ import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.data.CommentData;
import app.fedilab.fedilabtube.client.data.InstanceData;
import app.fedilab.fedilabtube.client.data.NotificationData;
import app.fedilab.fedilabtube.client.data.OverviewVideoData;
import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.AccountCreation;
@ -49,7 +50,6 @@ import app.fedilab.fedilabtube.client.entities.Error;
import app.fedilab.fedilabtube.client.entities.InstanceParams;
import app.fedilab.fedilabtube.client.entities.Oauth;
import app.fedilab.fedilabtube.client.entities.OauthParams;
import app.fedilab.fedilabtube.client.entities.OverviewVideo;
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
import app.fedilab.fedilabtube.client.entities.PlaylistParams;
import app.fedilab.fedilabtube.client.entities.Rating;
@ -248,35 +248,36 @@ public class RetrofitPeertubeAPI {
public APIResponse getTL(TimelineVM.TimelineType timelineType, String max_id) {
APIResponse apiResponse = new APIResponse();
PeertubeService peertubeService = init();
Call<List<VideoData.Video>> videoCall = null;
Call<VideoData> videoCall = null;
ArrayList<String> filter = selection!=null?new ArrayList<>(selection):null;
switch (timelineType) {
case MY_VIDEOS:
videoCall = peertubeService.getMyVideo(token, max_id);
break;
case SUBSCRIBTIONS:
videoCall = peertubeService.getSubscriptionVideos(max_id, new ArrayList<>(selection));
videoCall = peertubeService.getSubscriptionVideos(max_id, filter);
break;
case MOST_LIKED:
videoCall = peertubeService.getMostLikedVideos(max_id, new ArrayList<>(selection));
videoCall = peertubeService.getMostLikedVideos(max_id, filter);
break;
case LOCAL:
videoCall = peertubeService.getLocalVideos(max_id, new ArrayList<>(selection));
videoCall = peertubeService.getLocalVideos(max_id, filter);
break;
case TRENDING:
videoCall = peertubeService.getTrendingVideos(max_id, new ArrayList<>(selection));
videoCall = peertubeService.getTrendingVideos(max_id, filter);
break;
case HISTORY:
videoCall = peertubeService.getHistory(max_id);
break;
case RECENT:
videoCall = peertubeService.getRecentlyAddedVideos(max_id, new ArrayList<>(selection));
videoCall = peertubeService.getRecentlyAddedVideos(max_id, filter);
break;
}
if (videoCall != null) {
try {
Response<List<VideoData.Video>> response = videoCall.execute();
if (response.isSuccessful()) {
apiResponse.setPeertubes(response.body());
Response<VideoData> response = videoCall.execute();
if (response.isSuccessful() && response.body() != null) {
apiResponse.setPeertubes(response.body().data);
} else {
Error error = new Error();
error.setStatusCode(response.code());
@ -306,11 +307,12 @@ public class RetrofitPeertubeAPI {
public APIResponse getOverviewVideo(String max_id) {
APIResponse apiResponse = new APIResponse();
PeertubeService peertubeService = init();
Call<OverviewVideo> overviewVideoCall = peertubeService.getOverviewVideos(max_id, new ArrayList<>(selection));
ArrayList<String> filter = selection!=null?new ArrayList<>(selection):null;
Call<OverviewVideoData> overviewVideoCall = peertubeService.getOverviewVideos(max_id, filter);
try {
Response<OverviewVideo> response = overviewVideoCall.execute();
if (response.isSuccessful()) {
apiResponse.setOverviewVideo(response.body());
Response<OverviewVideoData> response = overviewVideoCall.execute();
if (response.isSuccessful() && response.body() != null) {
apiResponse.setOverviewVideo(response.body().data);
} else {
Error error = new Error();
error.setStatusCode(response.code());
@ -818,15 +820,10 @@ public class RetrofitPeertubeAPI {
* @param channelParams PlaylistParams
* @return APIResponse
*/
public APIResponse createOrUpdateChannel(ChannelsVM.action apiAction, String channelId, ChannelParams channelParams, File thumbnail) {
public APIResponse createOrUpdateChannel(ChannelsVM.action apiAction, String channelId, ChannelParams channelParams) {
PeertubeService peertubeService = init();
APIResponse apiResponse = new APIResponse();
MultipartBody.Part body = null;
if (thumbnail != null) {
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), thumbnail);
body = MultipartBody.Part.createFormData("image", thumbnail.getName(), requestFile);
}
try {
if (apiAction == ChannelsVM.action.CREATE_CHANNEL) {
Call<String> stringCall = peertubeService.addChannel(token, channelParams);

View File

@ -1,4 +1,4 @@
package app.fedilab.fedilabtube.client.entities;
package app.fedilab.fedilabtube.client.data;
/* Copyright 2020 Thomas Schneider
*
* This file is a part of TubeLab
@ -18,40 +18,48 @@ import com.google.gson.annotations.SerializedName;
import java.util.List;
import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.Item;
public class OverviewVideo {
public class OverviewVideoData {
@SerializedName("categories")
private Categories categories;
@SerializedName("channels")
private Channels channels;
@SerializedName("tags")
private Tags tags;
@SerializedName("total")
public int total;
@SerializedName("data")
public OverviewVideo data;
public Categories getCategories() {
return categories;
}
public static class OverviewVideo {
@SerializedName("categories")
private Categories categories;
@SerializedName("channels")
private Channels channels;
@SerializedName("tags")
private Tags tags;
public void setCategories(Categories categories) {
this.categories = categories;
}
public Categories getCategories() {
return categories;
}
public Channels getChannels() {
return channels;
}
public void setCategories(Categories categories) {
this.categories = categories;
}
public void setChannels(Channels channels) {
this.channels = channels;
}
public Channels getChannels() {
return channels;
}
public void setChannels(Channels channels) {
this.channels = channels;
}
public Tags getTags() {
return tags;
}
public void setTags(Tags tags) {
this.tags = tags;
}
public Tags getTags() {
return tags;
}
public void setTags(Tags tags) {
this.tags = tags;
}
public static class Categories {

View File

@ -29,6 +29,8 @@ import java.util.List;
import app.fedilab.fedilabtube.client.data.AccountData.Account;
import app.fedilab.fedilabtube.client.entities.File;
import app.fedilab.fedilabtube.client.entities.Item;
import app.fedilab.fedilabtube.client.entities.ItemStr;
import app.fedilab.fedilabtube.client.entities.StreamingPlaylists;
import app.fedilab.fedilabtube.helper.Helper;
@ -41,17 +43,6 @@ public class VideoData {
public List<Video> data;
public static class Video implements Parcelable {
public static final Creator<Video> CREATOR = new Creator<Video>() {
@Override
public Video createFromParcel(Parcel source) {
return new Video(source);
}
@Override
public Video[] newArray(int size) {
return new Video[size];
}
};
@SerializedName("account")
private Account account;
@SerializedName("blacklisted")
@ -85,7 +76,7 @@ public class VideoData {
@SerializedName("isLocal")
private boolean isLocal;
@SerializedName("language")
private Item language;
private ItemStr language;
@SerializedName("licence")
private Item licence;
@SerializedName("likes")
@ -105,15 +96,15 @@ public class VideoData {
@SerializedName("state")
private Item state;
@SerializedName("streamingPlaylists")
private String[] streamingPlaylists;
private List<StreamingPlaylists> streamingPlaylists;
@SerializedName("support")
private String support;
@SerializedName("tags")
private String[] tags;
private List<String> tags;
@SerializedName("thumbnailPath")
private String thumbnailPath;
@SerializedName("trackerUrls")
private String[] trackerUrls;
private List<String> trackerUrls;
@SerializedName("updatedAt")
private Date updatedAt;
@SerializedName("uuid")
@ -122,54 +113,13 @@ public class VideoData {
private int views;
@SerializedName("waitTranscoding")
private boolean waitTranscoding;
private String myRating;
public Video() {
}
protected Video(Parcel in) {
this.account = in.readParcelable(Account.class.getClassLoader());
this.blacklisted = in.readByte() != 0;
this.blacklistedReason = in.readString();
this.category = in.readParcelable(Item.class.getClassLoader());
this.channel = in.readParcelable(ChannelData.Channel.class.getClassLoader());
this.commentsEnabled = in.readByte() != 0;
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
this.description = in.readString();
this.descriptionPath = in.readString();
this.dislikes = in.readInt();
this.downloadEnabled = in.readByte() != 0;
this.duration = in.readInt();
this.embedPath = in.readString();
this.files = new ArrayList<>();
in.readList(this.files, File.class.getClassLoader());
this.id = in.readString();
this.isLocal = in.readByte() != 0;
this.language = in.readParcelable(Item.class.getClassLoader());
this.licence = in.readParcelable(Item.class.getClassLoader());
this.likes = in.readInt();
this.name = in.readString();
this.nsfw = in.readByte() != 0;
long tmpOriginallyPublishedAt = in.readLong();
this.originallyPublishedAt = tmpOriginallyPublishedAt == -1 ? null : new Date(tmpOriginallyPublishedAt);
this.previewPath = in.readString();
this.privacy = in.readParcelable(Item.class.getClassLoader());
long tmpPublishedAt = in.readLong();
this.publishedAt = tmpPublishedAt == -1 ? null : new Date(tmpPublishedAt);
this.state = in.readParcelable(Item.class.getClassLoader());
this.streamingPlaylists = in.createStringArray();
this.support = in.readString();
this.tags = in.createStringArray();
this.thumbnailPath = in.readString();
this.trackerUrls = in.createStringArray();
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.uuid = in.readString();
this.views = in.readInt();
this.waitTranscoding = in.readByte() != 0;
}
public String getFileUrl(String resolution, Context context) {
@ -249,8 +199,8 @@ public class VideoData {
return category;
}
public void setCategory(Item item) {
this.category = item;
public void setCategory(Item category) {
this.category = category;
}
public ChannelData.Channel getChannel() {
@ -333,14 +283,6 @@ public class VideoData {
this.files = files;
}
public String getMyRating() {
return myRating;
}
public void setMyRating(String myRating) {
this.myRating = myRating;
}
public String getId() {
return id;
}
@ -357,11 +299,11 @@ public class VideoData {
isLocal = local;
}
public Item getLanguage() {
public ItemStr getLanguage() {
return language;
}
public void setLanguage(Item language) {
public void setLanguage(ItemStr language) {
this.language = language;
}
@ -437,11 +379,11 @@ public class VideoData {
this.state = state;
}
public String[] getStreamingPlaylists() {
public List<StreamingPlaylists> getStreamingPlaylists() {
return streamingPlaylists;
}
public void setStreamingPlaylists(String[] streamingPlaylists) {
public void setStreamingPlaylists(List<StreamingPlaylists> streamingPlaylists) {
this.streamingPlaylists = streamingPlaylists;
}
@ -453,11 +395,11 @@ public class VideoData {
this.support = support;
}
public String[] getTags() {
public List<String> getTags() {
return tags;
}
public void setTags(String[] tags) {
public void setTags(List<String> tags) {
this.tags = tags;
}
@ -469,11 +411,11 @@ public class VideoData {
this.thumbnailPath = thumbnailPath;
}
public String[] getTrackerUrls() {
public List<String> getTrackerUrls() {
return trackerUrls;
}
public void setTrackerUrls(String[] trackerUrls) {
public void setTrackerUrls(List<String> trackerUrls) {
this.trackerUrls = trackerUrls;
}
@ -509,6 +451,15 @@ public class VideoData {
this.waitTranscoding = waitTranscoding;
}
public String getMyRating() {
return myRating;
}
public void setMyRating(String myRating) {
this.myRating = myRating;
}
@Override
public int describeContents() {
return 0;
@ -542,16 +493,74 @@ public class VideoData {
dest.writeParcelable(this.privacy, flags);
dest.writeLong(this.publishedAt != null ? this.publishedAt.getTime() : -1);
dest.writeParcelable(this.state, flags);
dest.writeStringArray(this.streamingPlaylists);
dest.writeList(this.streamingPlaylists);
dest.writeString(this.support);
dest.writeStringArray(this.tags);
dest.writeStringList(this.tags);
dest.writeString(this.thumbnailPath);
dest.writeStringArray(this.trackerUrls);
dest.writeStringList(this.trackerUrls);
dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1);
dest.writeString(this.uuid);
dest.writeInt(this.views);
dest.writeByte(this.waitTranscoding ? (byte) 1 : (byte) 0);
dest.writeString(this.myRating);
}
protected Video(Parcel in) {
this.account = in.readParcelable(Account.class.getClassLoader());
this.blacklisted = in.readByte() != 0;
this.blacklistedReason = in.readString();
this.category = in.readParcelable(Item.class.getClassLoader());
this.channel = in.readParcelable(ChannelData.Channel.class.getClassLoader());
this.commentsEnabled = in.readByte() != 0;
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
this.description = in.readString();
this.descriptionPath = in.readString();
this.dislikes = in.readInt();
this.downloadEnabled = in.readByte() != 0;
this.duration = in.readInt();
this.embedPath = in.readString();
this.files = new ArrayList<>();
in.readList(this.files, File.class.getClassLoader());
this.id = in.readString();
this.isLocal = in.readByte() != 0;
this.language = in.readParcelable(ItemStr.class.getClassLoader());
this.licence = in.readParcelable(Item.class.getClassLoader());
this.likes = in.readInt();
this.name = in.readString();
this.nsfw = in.readByte() != 0;
long tmpOriginallyPublishedAt = in.readLong();
this.originallyPublishedAt = tmpOriginallyPublishedAt == -1 ? null : new Date(tmpOriginallyPublishedAt);
this.previewPath = in.readString();
this.privacy = in.readParcelable(Item.class.getClassLoader());
long tmpPublishedAt = in.readLong();
this.publishedAt = tmpPublishedAt == -1 ? null : new Date(tmpPublishedAt);
this.state = in.readParcelable(Item.class.getClassLoader());
this.streamingPlaylists = new ArrayList<>();
in.readList(this.streamingPlaylists, StreamingPlaylists.class.getClassLoader());
this.support = in.readString();
this.tags = in.createStringArrayList();
this.thumbnailPath = in.readString();
this.trackerUrls = in.createStringArrayList();
long tmpUpdatedAt = in.readLong();
this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt);
this.uuid = in.readString();
this.views = in.readInt();
this.waitTranscoding = in.readByte() != 0;
this.myRating = in.readString();
}
public static final Creator<Video> CREATOR = new Creator<Video>() {
@Override
public Video createFromParcel(Parcel source) {
return new Video(source);
}
@Override
public Video[] newArray(int size) {
return new Video[size];
}
};
}
public static class VideoImport {

View File

@ -0,0 +1,78 @@
package app.fedilab.fedilabtube.client.entities;
/* Copyright 2020 Thomas Schneider
*
* This file is a part of TubeLab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class ItemStr implements Parcelable {
@SerializedName("id")
private String id;
@SerializedName("label")
private String label;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.id);
dest.writeString(this.label);
}
public ItemStr() {
}
protected ItemStr(Parcel in) {
this.id = in.readString();
this.label = in.readString();
}
public static final Creator<ItemStr> CREATOR = new Creator<ItemStr>() {
@Override
public ItemStr createFromParcel(Parcel source) {
return new ItemStr(source);
}
@Override
public ItemStr[] newArray(int size) {
return new ItemStr[size];
}
};
}

View File

@ -0,0 +1,96 @@
package app.fedilab.fedilabtube.client.entities;
/* Copyright 2020 Thomas Schneider
*
* This file is a part of TubeLab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* TubeLab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
* see <http://www.gnu.org/licenses>. */
import com.google.gson.annotations.SerializedName;
import java.util.List;
@SuppressWarnings("unused")
public class StreamingPlaylists {
@SerializedName("id")
private String id;
@SerializedName("type")
private int type;
@SerializedName("playlistUrl")
private String playlistUrl;
@SerializedName("segmentsSha256Url")
private String segmentsSha256Url;
@SerializedName("files")
private List<File> files;
@SerializedName("redundancies")
private List<Redundancies> redundancies;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getPlaylistUrl() {
return playlistUrl;
}
public void setPlaylistUrl(String playlistUrl) {
this.playlistUrl = playlistUrl;
}
public String getSegmentsSha256Url() {
return segmentsSha256Url;
}
public void setSegmentsSha256Url(String segmentsSha256Url) {
this.segmentsSha256Url = segmentsSha256Url;
}
public List<File> getFiles() {
return files;
}
public void setFiles(List<File> files) {
this.files = files;
}
public List<Redundancies> getRedundancies() {
return redundancies;
}
public void setRedundancies(List<Redundancies> redundancies) {
this.redundancies = redundancies;
}
public static class Redundancies{
@SerializedName("baseUrl")
private String baseUrl;
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
}
}

View File

@ -35,7 +35,7 @@ public class VideoParams {
@SerializedName("downloadEnabled")
private boolean downloadEnabled;
@SerializedName("language")
private int language;
private String language;
@SerializedName("licence")
private String licence;
@SerializedName("nsfw")
@ -99,11 +99,11 @@ public class VideoParams {
this.downloadEnabled = downloadEnabled;
}
public int getLanguage() {
public String getLanguage() {
return language;
}
public void setLanguage(int language) {
public void setLanguage(String language) {
this.language = language;
}

View File

@ -76,7 +76,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
Helper.loadGiF(context, account.getAvatar().getPath(), holder.peertube_profile);
} else {
holder.peertube_account_name.setText(peertube.getChannel().getAcct());
Helper.loadGiF(context, peertube.getChannel().getAvatar().getPath(), holder.peertube_profile);
Helper.loadGiF(context, peertube.getChannel().getAvatar()!=null?peertube.getChannel().getAvatar().getPath():null, holder.peertube_profile);
}
holder.peertube_title.setText(peertube.getName());
holder.peertube_duration.setText(Helper.secondsToString(peertube.getDuration()));
@ -101,9 +101,9 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
}
if (peertube.getTags() != null) {
String[] type = peertube.getTags();
if (type.length > 0) {
holder.header_title.setText(String.format("#%s", peertube.getTags()[0]));
List<String> type = peertube.getTags();
if (type.size() > 0) {
holder.header_title.setText(String.format("#%s", peertube.getTags().get(0)));
holder.header_title.setVisibility(View.VISIBLE);
} else {
holder.header_title.setVisibility(View.GONE);

View File

@ -224,9 +224,9 @@ public class DisplayChannelsFragment extends Fragment implements ChannelListAdap
}
new Thread(() -> {
if (oldChannelValues == null) {
new RetrofitPeertubeAPI(context).createOrUpdateChannel(ChannelsVM.action.CREATE_CHANNEL, null, channelCreation, null);
new RetrofitPeertubeAPI(context).createOrUpdateChannel(ChannelsVM.action.CREATE_CHANNEL, null, channelCreation);
} else {
new RetrofitPeertubeAPI(context).createOrUpdateChannel(ChannelsVM.action.UPDATE_CHANNEL, channelCreation.getName() + "@" + Helper.getLiveInstance(context), channelCreation, null);
new RetrofitPeertubeAPI(context).createOrUpdateChannel(ChannelsVM.action.UPDATE_CHANNEL, channelCreation.getName() + "@" + Helper.getLiveInstance(context), channelCreation);
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {