mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-21 03:32:06 +00:00
fix
This commit is contained in:
parent
6fbbbc5bc2
commit
f940da50eb
8 changed files with 63 additions and 19 deletions
|
|
@ -75,8 +75,14 @@ class VideoModel {
|
|||
String? originalUrl;
|
||||
Map<String, String>? headers;
|
||||
List<TrackModel>? subtitles;
|
||||
List<TrackModel>? audios;
|
||||
VideoModel(
|
||||
{this.url, this.quality, this.originalUrl, this.headers, this.subtitles});
|
||||
{this.url,
|
||||
this.quality,
|
||||
this.originalUrl,
|
||||
this.headers,
|
||||
this.subtitles,
|
||||
this.audios});
|
||||
}
|
||||
|
||||
class TrackModel {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ class $VideoModel implements VideoModel, $Instance {
|
|||
BridgeTypeAnnotation(BridgeTypeRef.type(RuntimeTypes.mapType))),
|
||||
'substitles': BridgeFieldDef(BridgeTypeAnnotation(BridgeTypeRef(
|
||||
CoreTypes.list, [BridgeTypeRef.type(RuntimeTypes.dynamicType)]))),
|
||||
'audios': BridgeFieldDef(BridgeTypeAnnotation(BridgeTypeRef(
|
||||
CoreTypes.list, [BridgeTypeRef.type(RuntimeTypes.dynamicType)]))),
|
||||
},
|
||||
wrap: true);
|
||||
|
||||
|
|
@ -88,6 +90,11 @@ class $VideoModel implements VideoModel, $Instance {
|
|||
.map((e) =>
|
||||
$TrackModel.wrap(TrackModel(file: e.file, label: e.label)))
|
||||
.toList());
|
||||
case 'audios':
|
||||
return $List.wrap($value.audios!
|
||||
.map((e) =>
|
||||
$TrackModel.wrap(TrackModel(file: e.file, label: e.label)))
|
||||
.toList());
|
||||
|
||||
default:
|
||||
return _superclass.$getProperty(runtime, identifier);
|
||||
|
|
@ -110,6 +117,8 @@ class $VideoModel implements VideoModel, $Instance {
|
|||
$value.headers = value.$reified as Map<String, String>;
|
||||
case 'subtitles':
|
||||
$value.subtitles = value.$reified as List<TrackModel>;
|
||||
case 'audios':
|
||||
$value.audios = value.$reified as List<TrackModel>;
|
||||
|
||||
default:
|
||||
_superclass.$setProperty(runtime, identifier, value);
|
||||
|
|
@ -122,6 +131,9 @@ class $VideoModel implements VideoModel, $Instance {
|
|||
@override
|
||||
List<TrackModel>? get subtitles => $value.subtitles;
|
||||
|
||||
@override
|
||||
List<TrackModel>? get audios => $value.audios;
|
||||
|
||||
@override
|
||||
String? get quality => $value.quality;
|
||||
|
||||
|
|
@ -145,4 +157,7 @@ class $VideoModel implements VideoModel, $Instance {
|
|||
|
||||
@override
|
||||
set subtitles(List? subtitles) {}
|
||||
|
||||
@override
|
||||
set audios(List? audios) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -943,14 +943,15 @@ class MBridge {
|
|||
return utf8.decode(base64.decode(text));
|
||||
}
|
||||
|
||||
static Video toVideo(
|
||||
String url, String quality, String originalUrl, String? headers) {
|
||||
static Video toVideo(String url, String quality, String originalUrl,
|
||||
String? headers, List<Track>? subtitles, List<Track>? audios) {
|
||||
Map<String, String> newHeaders = {};
|
||||
if (headers != null) {
|
||||
newHeaders = (jsonDecode(headers) as Map)
|
||||
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||
}
|
||||
return Video(url, quality, originalUrl, headers: newHeaders);
|
||||
return Video(url, quality, originalUrl,
|
||||
headers: newHeaders, subtitles: subtitles ?? [], audios: audios ?? []);
|
||||
}
|
||||
|
||||
//Check if value is empty
|
||||
|
|
@ -1284,6 +1285,20 @@ class $MBridge extends MBridge with $Bridge {
|
|||
BridgeTypeRef.type(RuntimeTypes.stringType),
|
||||
nullable: true),
|
||||
true),
|
||||
BridgeParameter(
|
||||
'subtitles',
|
||||
BridgeTypeAnnotation(
|
||||
BridgeTypeRef(CoreTypes.list,
|
||||
[BridgeTypeRef.type(RuntimeTypes.dynamicType)]),
|
||||
nullable: true),
|
||||
true),
|
||||
BridgeParameter(
|
||||
'audios',
|
||||
BridgeTypeAnnotation(
|
||||
BridgeTypeRef(CoreTypes.list,
|
||||
[BridgeTypeRef.type(RuntimeTypes.dynamicType)]),
|
||||
nullable: true),
|
||||
true),
|
||||
],
|
||||
namedParams: []),
|
||||
isStatic: true),
|
||||
|
|
@ -1855,8 +1870,8 @@ class $MBridge extends MBridge with $Bridge {
|
|||
|
||||
static $VideoModel $toVideo(
|
||||
Runtime runtime, $Value? target, List<$Value?> args) {
|
||||
final value = MBridge.toVideo(
|
||||
args[0]!.$value, args[1]!.$value, args[2]!.$value, args[3]!.$value);
|
||||
final value = MBridge.toVideo(args[0]!.$value, args[1]!.$value,
|
||||
args[2]!.$value, args[3]!.$value, args[4]!.$value, args[5]!.$value);
|
||||
|
||||
return _toVideoModel(value);
|
||||
}
|
||||
|
|
@ -2109,6 +2124,13 @@ $VideoModel _toVideoModel(Video e) => $VideoModel.wrap(VideoModel()
|
|||
..subtitles = $List.wrap(e.subtitles == null
|
||||
? []
|
||||
: e.subtitles!
|
||||
.map((t) => $TrackModel.wrap(TrackModel()
|
||||
..file = t.file
|
||||
..label = t.label))
|
||||
.toList())
|
||||
..audios = $List.wrap(e.audios == null
|
||||
? []
|
||||
: e.audios!
|
||||
.map((t) => $TrackModel.wrap(TrackModel()
|
||||
..file = t.file
|
||||
..label = t.label))
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ class Video {
|
|||
final String originalUrl;
|
||||
final Map<String, String>? headers;
|
||||
final List<Track>? subtitles;
|
||||
final List<Track>? audios;
|
||||
|
||||
Video(this.url, this.quality, this.originalUrl,
|
||||
{this.headers, this.subtitles});
|
||||
{this.headers, this.subtitles, this.audios});
|
||||
}
|
||||
|
||||
class Track {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ class _AnimePlayerViewState extends riv.ConsumerState<AnimePlayerView> {
|
|||
loading: () {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: AppBar(
|
||||
title: const Text(''),
|
||||
leading: BackButton(
|
||||
|
|
@ -196,12 +197,6 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
_currentPositionSub;
|
||||
if (_firstVid.subtitles!.isNotEmpty) {
|
||||
final firstSub = _firstVid.subtitles!.first;
|
||||
_subtitle.value = VideoPrefs(
|
||||
subtitle: SubtitleTrack.uri(firstSub.file!,
|
||||
title: firstSub.label, language: firstSub.label));
|
||||
}
|
||||
|
||||
_video.value = VideoPrefs(
|
||||
videoTrack: VideoTrack(
|
||||
|
|
@ -337,7 +332,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
_subtitle.value ??= videoSubtitle.first;
|
||||
final l10n = l10nLocalizations(context)!;
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@ class RapidCloudExtractor {
|
|||
|
||||
return [
|
||||
Video(decrypted[0]["file"], name, decrypted[0]["file"],
|
||||
subtitles:
|
||||
data.tracks!.map((e) => Track(e.file!, e.label!)).toList())
|
||||
subtitles: data.tracks != null && data.tracks!.isEmpty
|
||||
? []
|
||||
: data.tracks!
|
||||
.map((e) => Track(e.file ?? "", e.label ?? ""))
|
||||
.toList())
|
||||
];
|
||||
} catch (_) {
|
||||
return [];
|
||||
|
|
@ -67,7 +70,6 @@ class RapidCloudExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class Tracks {
|
||||
String? file;
|
||||
String? label;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ Future<(List<Video>, bool)> getAnimeServers(
|
|||
List<Video> video = [];
|
||||
if (episode.manga.value!.isLocalArchive!) {
|
||||
return (
|
||||
[Video(episode.archivePath!, episode.name!, episode.archivePath!)],
|
||||
[
|
||||
Video(episode.archivePath!, episode.name!, episode.archivePath!,
|
||||
subtitles: [])
|
||||
],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
name: mangayomi
|
||||
description: Free and open source manga reader multi plateform app inspired by Tachiyomi.
|
||||
|
||||
version: 0.0.3+13
|
||||
version: 0.0.4+14
|
||||
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
|
|
|
|||
Loading…
Reference in a new issue