Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay

This commit is contained in:
Koen 2023-12-27 11:11:36 +01:00
commit 05b6cd7c97
8 changed files with 151 additions and 61 deletions

View file

@ -1,13 +1,37 @@
declare class ScriptException extends Error { declare class ScriptException extends Error {
//If only one parameter is provided, acts as msg
constructor(type: string, msg: string); constructor(type: string, msg: string);
} }
declare class TimeoutException extends ScriptException {
declare class LoginRequiredException extends ScriptException {
constructor(msg: string); constructor(msg: string);
} }
//Alias
declare class ScriptLoginRequiredException extends ScriptException {
constructor(msg: string);
}
declare class CaptchaRequiredException extends ScriptException {
constructor(url: string, body: string);
}
declare class CriticalException extends ScriptException {
constructor(msg: string);
}
declare class UnavailableException extends ScriptException { declare class UnavailableException extends ScriptException {
constructor(msg: string); constructor(msg: string);
} }
declare class AgeException extends ScriptException {
constructor(msg: string);
}
declare class TimeoutException extends ScriptException {
constructor(msg: string);
}
declare class ScriptImplementationException extends ScriptException { declare class ScriptImplementationException extends ScriptException {
constructor(msg: string); constructor(msg: string);
} }
@ -38,16 +62,23 @@ declare class FilterCapability {
declare class PlatformAuthorLink { declare class PlatformAuthorLink {
constructor(id: PlatformID, name: string, url: string, thumbnail: string, subscribers: integer?); constructor(id: PlatformID, name: string, url: string, thumbnail: string, subscribers: integer?, membershipUrl: string?);
}
declare class PlatformAuthorMembershipLink {
constructor(id: PlatformID, name: string, url: string, thumbnail: string, subscribers: integer?, membershipUrl: string?);
} }
declare interface PlatformContentDef { declare interface PlatformContentDef {
id: PlatformID, id: PlatformID,
name: string, name: string,
thumbnails: Thumbnails,
author: PlatformAuthorLink, author: PlatformAuthorLink,
datetime: integer, datetime: integer,
url: string url: string
} }
declare interface PlatformContent {}
declare interface PlatformNestedMediaContentDef extends PlatformContentDef { declare interface PlatformNestedMediaContentDef extends PlatformContentDef {
contentUrl: string, contentUrl: string,
contentName: string?, contentName: string?,
@ -59,16 +90,26 @@ declare class PlatformNestedMediaContent {
constructor(obj: PlatformNestedMediaContentDef); constructor(obj: PlatformNestedMediaContentDef);
} }
declare interface PlatformLockedContentDef extends PlatformContentDef {
contentName: string?,
contentThumbnails: Thumbnails?,
unlockUrl: string,
lockDescription: string?,
}
declare class PlatformLockedContent {
constructor(obj: PlatformLockedContentDef);
}
declare interface PlatformVideoDef extends PlatformContentDef { declare interface PlatformVideoDef extends PlatformContentDef {
thumbnails: Thumbnails, thumbnails: Thumbnails,
author: PlatformAuthorLink, author: PlatformAuthorLink,
duration: int, duration: int,
viewCount: long, viewCount: long,
isLive: boolean isLive: boolean,
shareUrl: string?
} }
declare interface PlatformContent {}
declare class PlatformVideo implements PlatformContent { declare class PlatformVideo implements PlatformContent {
constructor(obj: PlatformVideoDef); constructor(obj: PlatformVideoDef);
} }
@ -77,14 +118,15 @@ declare class PlatformVideo implements PlatformContent {
declare interface PlatformVideoDetailsDef extends PlatformVideoDef { declare interface PlatformVideoDetailsDef extends PlatformVideoDef {
description: string, description: string,
video: VideoSourceDescriptor, video: VideoSourceDescriptor,
live: SubtitleSource[], live: IVideoSource,
rating: IRating rating: IRating,
subtitles: SubtitleSource[]
} }
declare class PlatformVideoDetails extends PlatformVideo { declare class PlatformVideoDetails extends PlatformVideo {
constructor(obj: PlatformVideoDetailsDef); constructor(obj: PlatformVideoDetailsDef);
} }
declare class PlatformPostDef extends PlatformContentDef { declare interface PlatformPostDef extends PlatformContentDef {
thumbnails: string[], thumbnails: string[],
images: string[], images: string[],
description: string description: string
@ -93,7 +135,7 @@ declare class PlatformPost extends PlatformContent {
constructor(obj: PlatformPostDef) constructor(obj: PlatformPostDef)
} }
declare class PlatformPostDetailsDef extends PlatformPostDef { declare interface PlatformPostDetailsDef extends PlatformPostDef {
rating: IRating, rating: IRating,
textType: int, textType: int,
content: String content: String
@ -110,8 +152,8 @@ declare interface MuxVideoSourceDescriptorDef {
isUnMuxed: boolean, isUnMuxed: boolean,
videoSources: VideoSource[] videoSources: VideoSource[]
} }
declare class MuxVideoSourceDescriptor implements IVideoSourceDescriptor { declare class VideoSourceDescriptor implements IVideoSourceDescriptor {
constructor(obj: VideoSourceDescriptorDef); constructor(videoSourcesOrObj: VideoSource[]);
} }
declare interface UnMuxVideoSourceDescriptorDef { declare interface UnMuxVideoSourceDescriptorDef {
@ -129,7 +171,7 @@ declare interface IVideoSource {
declare interface IAudioSource { declare interface IAudioSource {
} }
interface VideoUrlSourceDef implements IVideoSource { declare interface VideoUrlSourceDef implements IVideoSource {
width: integer, width: integer,
height: integer, height: integer,
container: string, container: string,
@ -139,22 +181,22 @@ interface VideoUrlSourceDef implements IVideoSource {
duration: integer, duration: integer,
url: string url: string
} }
class VideoUrlSource { declare class VideoUrlSource {
constructor(obj: VideoUrlSourceDef); constructor(obj: VideoUrlSourceDef);
getRequestModifier(): RequestModifier?; getRequestModifier(): RequestModifier?;
} }
interface VideoUrlRangeSourceDef extends VideoUrlSource { declare interface VideoUrlRangeSourceDef extends VideoUrlSource {
itagId: integer, itagId: integer,
initStart: integer, initStart: integer,
initEnd: integer, initEnd: integer,
indexStart: integer, indexStart: integer,
indexEnd: integer, indexEnd: integer,
} }
class VideoUrlRangeSource extends VideoUrlSource { declare class VideoUrlRangeSource extends VideoUrlSource {
constructor(obj: YTVideoSourceDef); constructor(obj: YTVideoSourceDef);
} }
interface AudioUrlSourceDef { declare interface AudioUrlSourceDef {
name: string, name: string,
bitrate: integer, bitrate: integer,
container: string, container: string,
@ -163,24 +205,12 @@ interface AudioUrlSourceDef {
url: string, url: string,
language: string language: string
} }
class AudioUrlSource implements IAudioSource { declare class AudioUrlSource implements IAudioSource {
constructor(obj: AudioUrlSourceDef); constructor(obj: AudioUrlSourceDef);
getRequestModifier(): RequestModifier?; getRequestModifier(): RequestModifier?;
} }
interface IRequest { declare interface AudioUrlRangeSourceDef extends AudioUrlSource {
url: string,
headers: Map<string, string>
}
interface IRequestModifierDef {
allowByteSkip: boolean
}
class RequestModifier {
constructor(obj: IRequestModifierDef) { }
modifyRequest(url: string, headers: Map<string, string>): IRequest;
}
interface AudioUrlRangeSourceDef extends AudioUrlSource {
itagId: integer, itagId: integer,
initStart: integer, initStart: integer,
initEnd: integer, initEnd: integer,
@ -188,28 +218,44 @@ interface AudioUrlRangeSourceDef extends AudioUrlSource {
indexEnd: integer, indexEnd: integer,
audioChannels: integer audioChannels: integer
} }
class AudioUrlRangeSource extends AudioUrlSource { declare class AudioUrlRangeSource extends AudioUrlSource {
constructor(obj: AudioUrlRangeSourceDef); constructor(obj: AudioUrlRangeSourceDef);
} }
interface HLSSourceDef { declare interface HLSSourceDef {
name: string, name: string,
duration: integer, duration: integer,
url: string url: string,
priority: boolean?,
language: string?
} }
class HLSSource implements IVideoSource { declare class HLSSource implements IVideoSource {
constructor(obj: HLSSourceDef); constructor(obj: HLSSourceDef);
} }
interface DashSourceDef { declare interface DashSourceDef {
name: string, name: string,
duration: integer, duration: integer,
url: string url: string,
language: string?
} }
class DashSource implements IVideoSource { declare class DashSource implements IVideoSource {
constructor(obj: DashSourceDef) constructor(obj: DashSourceDef)
} }
declare interface IRequest {
url: string,
headers: Map<string, string>
}
declare interface IRequestModifierDef {
allowByteSkip: boolean
}
declare class RequestModifier {
constructor(obj: IRequestModifierDef) { }
modifyRequest(url: string, headers: Map<string, string>): IRequest;
}
//Channel //Channel
interface PlatformChannelDef { declare interface PlatformChannelDef {
id: PlatformID, id: PlatformID,
name: string, name: string,
thumbnail: string, thumbnail: string,
@ -217,12 +263,29 @@ interface PlatformChannelDef {
subscribers: integer, subscribers: integer,
description: string, description: string,
url: string, url: string,
urlAlternatives: string[],
links: Map<string>? links: Map<string>?
} }
class PlatformChannel { declare class PlatformChannel {
constructor(obj: PlatformChannelDef); constructor(obj: PlatformChannelDef);
} }
//Playlist
declare interface PlatformPlaylistDef implements PlatformContent {
videoCount: integer,
thumbnail: string
}
declare class PlatformPlaylist extends PlatformContent {
constructor(obj: PlatformPlaylistDef);
}
declare interface PlatformPlaylistDetailsDef implements PlatformPlaylistDef {
contents: ContentPager
}
declare class PlatformPlaylistDetails extends PlatformContent {
constructor(obj: PlatformPlaylistDetailsDef);
}
//Ratings //Ratings
interface IRating { interface IRating {
type: integer type: integer
@ -250,7 +313,11 @@ declare class PlatformComment {
constructor(obj: CommentDef); constructor(obj: CommentDef);
} }
declare class PlaybackTracker {
constructor(interval: integer);
setProgress(seconds: integer);
}
declare class LiveEventPager { declare class LiveEventPager {
nextRequest = 4000; nextRequest = 4000;
@ -261,8 +328,8 @@ declare class LiveEventPager {
nextPage(): LiveEventPager; //Could be self nextPage(): LiveEventPager; //Could be self
} }
class LiveEvent { declare class LiveEvent {
type: String constructor(type: integer);
} }
declare class LiveEventComment extends LiveEvent { declare class LiveEventComment extends LiveEvent {
constructor(name: string, message: string, thumbnail: string?, colorName: string?, badges: string[]); constructor(name: string, message: string, thumbnail: string?, colorName: string?, badges: string[]);
@ -287,25 +354,31 @@ declare class ContentPager {
constructor(results: PlatformContent[], hasMore: boolean); constructor(results: PlatformContent[], hasMore: boolean);
hasMorePagers(): boolean hasMorePagers(): boolean
nextPage(): VideoPager; //Could be self nextPage(): ContentPager?; //Could be self
} }
declare class VideoPager { declare class VideoPager {
constructor(results: PlatformVideo[], hasMore: boolean); constructor(results: PlatformVideo[], hasMore: boolean);
hasMorePagers(): boolean hasMorePagers(): boolean
nextPage(): VideoPager; //Could be self nextPage(): VideoPager?; //Could be self
} }
declare class ChannelPager { declare class ChannelPager {
constructor(results: PlatformChannel[], hasMore: boolean); constructor(results: PlatformChannel[], hasMore: boolean);
hasMorePagers(): boolean; hasMorePagers(): boolean;
nextPage(): ChannelPager; //Could be self nextPage(): ChannelPager?; //Could be self
}
declare class PlaylistPager {
constructor(results: PlatformPlaylist[], hasMore: boolean);
hasMorePagers(): boolean;
nextPage(): PlaylistPager?;
} }
declare class CommentPager { declare class CommentPager {
constructor(results: PlatformComment[], hasMore: boolean); constructor(results: PlatformComment[], hasMore: boolean);
hasMorePagers(): boolean hasMorePagers(): boolean
nextPage(): CommentPager; //Could be self nextPage(): CommentPager?; //Could be self
} }
interface Map<T> { interface Map<T> {
@ -341,8 +414,9 @@ interface Source {
getChannelCapabilities(): ResultCapabilities; getChannelCapabilities(): ResultCapabilities;
isContentDetailsUrl(url: string): boolean; isContentDetailsUrl(url: string): boolean;
getContentDetails(url: string): PlatformVideoDetails; getContentDetails(url: string): PlatformContentDetails;
//Optional
getLiveEvents(url: string): LiveEventPager; getLiveEvents(url: string): LiveEventPager;
//Optional //Optional

View file

@ -78,6 +78,11 @@ class ScriptLoginRequiredException extends ScriptException {
super("ScriptLoginRequiredException", msg); super("ScriptLoginRequiredException", msg);
} }
} }
class LoginRequiredException extends ScriptException {
constructor(msg) {
super("ScriptLoginRequiredException", msg);
}
}
class CaptchaRequiredException extends Error { class CaptchaRequiredException extends Error {
constructor(url, body) { constructor(url, body) {
super(JSON.stringify({ 'plugin_type': 'CaptchaRequiredException', url, body })); super(JSON.stringify({ 'plugin_type': 'CaptchaRequiredException', url, body }));
@ -249,8 +254,8 @@ class PlatformVideoDetails extends PlatformVideo {
this.description = obj.description ?? "";//String this.description = obj.description ?? "";//String
this.video = obj.video ?? {}; //VideoSourceDescriptor this.video = obj.video ?? {}; //VideoSourceDescriptor
this.dash = obj.dash ?? null; //DashSource this.dash = obj.dash ?? null; //DashSource, deprecated
this.hls = obj.hls ?? null; //HLSSource this.hls = obj.hls ?? null; //HLSSource, deprecated
this.live = obj.live ?? null; //VideoSource this.live = obj.live ?? null; //VideoSource
this.rating = obj.rating ?? null; //IRating this.rating = obj.rating ?? null; //IRating
@ -388,7 +393,7 @@ class DashSource {
class RequestModifier { class RequestModifier {
constructor(obj) { constructor(obj) {
obj = obj ?? {}; obj = obj ?? {};
this.allowByteSkip = obj.allowByteSkip; this.allowByteSkip = obj.allowByteSkip; //Kinda deprecated.. wip
} }
} }

View file

@ -418,6 +418,7 @@ class ChannelFragment : MainFragment() {
_buttonSubscribe.setSubscribeChannel(channel); _buttonSubscribe.setSubscribeChannel(channel);
_buttonSubscriptionSettings.visibility = if(_buttonSubscribe.isSubscribed) View.VISIBLE else View.GONE; _buttonSubscriptionSettings.visibility = if(_buttonSubscribe.isSubscribed) View.VISIBLE else View.GONE;
_textChannel.text = channel.name;
_textChannelSub.text = if(channel.subscribers > 0) "${channel.subscribers.toHumanNumber()} " + context.getString(R.string.subscribers).lowercase() else ""; _textChannelSub.text = if(channel.subscribers > 0) "${channel.subscribers.toHumanNumber()} " + context.getString(R.string.subscribers).lowercase() else "";
//TODO: Find a better way to access the adapter fragments.. //TODO: Find a better way to access the adapter fragments..

View file

@ -11,6 +11,7 @@ import android.view.ViewGroup
import android.widget.Button import android.widget.Button
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.net.toFile import androidx.core.net.toFile
@ -48,7 +49,7 @@ class ImageVariableOverlay: ConstraintLayout {
private val _buttonGallery: BigButton; private val _buttonGallery: BigButton;
private val _imageGallerySelected: ImageView; private val _imageGallerySelected: ImageView;
private val _imageGallerySelectedContainer: LinearLayout; private val _imageGallerySelectedContainer: LinearLayout;
private val _buttonSelect: Button; private val _buttonSelect: TextView;
private val _topbar: OverlayTopbar; private val _topbar: OverlayTopbar;
private val _recyclerPresets: AnyAdapterView<PresetImage, PresetViewHolder>; private val _recyclerPresets: AnyAdapterView<PresetImage, PresetViewHolder>;
private val _recyclerCreators: AnyAdapterView<SelectableCreatorBarViewHolder.Selectable, SelectableCreatorBarViewHolder>; private val _recyclerCreators: AnyAdapterView<SelectableCreatorBarViewHolder.Selectable, SelectableCreatorBarViewHolder>;

View file

@ -190,7 +190,7 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent">
<TextView <TextView

View file

@ -38,7 +38,7 @@
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:background="@drawable/background_button_primary" android:background="@drawable/background_button_primary"

View file

@ -116,20 +116,29 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<LinearLayout
<FrameLayout
android:id="@+id/container_select" android:id="@+id/container_select"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="50dp"
android:background="@drawable/background_button_primary"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"> app:layout_constraintRight_toRightOf="parent">
<Button
<TextView
android:id="@+id/button_select" android:id="@+id/button_select"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_margin="10dp" android:fontFamily="@font/inter_regular"
android:background="@drawable/background_button_primary" android:text="@string/select"
android:text="Select" /> android:textSize="16dp"
</LinearLayout> android:gravity="center"
android:layout_gravity="center" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -726,7 +726,7 @@
<string name="position">Position</string> <string name="position">Position</string>
<string name="tutorials">Tutorials</string> <string name="tutorials">Tutorials</string>
<string name="do_you_want_to_see_the_tutorials_you_can_find_them_at_any_time_through_the_more_button">Do you want to see the tutorials? You can find them at any time through the more button.</string> <string name="do_you_want_to_see_the_tutorials_you_can_find_them_at_any_time_through_the_more_button">Do you want to see the tutorials? You can find them at any time through the more button.</string>
<string name="add_creator">Add More</string> <string name="add_creator">Add Creators</string>
<string name="select">Select</string> <string name="select">Select</string>
<string-array name="home_screen_array"> <string-array name="home_screen_array">
<item>Recommendations</item> <item>Recommendations</item>