mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
feature: Add support for mediaSegments (#138)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
36758bd508
commit
5c560e54b5
28 changed files with 6823 additions and 8312 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:typed_data';
|
||||
|
||||
|
|
@ -12,7 +11,7 @@ import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart';
|
|||
import 'package:fladder/models/account_model.dart';
|
||||
import 'package:fladder/models/credentials_model.dart';
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/intro_skip_model.dart';
|
||||
import 'package:fladder/models/items/media_segments_model.dart';
|
||||
import 'package:fladder/models/items/trick_play_model.dart';
|
||||
import 'package:fladder/providers/api_provider.dart';
|
||||
import 'package:fladder/providers/image_provider.dart';
|
||||
|
|
@ -871,20 +870,14 @@ class JellyService {
|
|||
userId: account?.id,
|
||||
);
|
||||
|
||||
Future<Response<IntroOutSkipModel>?> introSkipGet({
|
||||
Future<Response<MediaSegmentsModel>?> mediaSegmentsGet({
|
||||
required String id,
|
||||
}) async {
|
||||
try {
|
||||
final response = await api.episodeIdIntroTimestampsGet(id: id);
|
||||
final outro = await api.episodeIdIntroSkipperSegmentsGet(id: id);
|
||||
final map = jsonDecode(outro.bodyString) as Map<String, dynamic>;
|
||||
final newModel = IntroOutSkipModel(
|
||||
intro:
|
||||
map["Introduction"] != null ? IntroSkipModel.fromJson(map["Introduction"] as Map<String, dynamic>) : null,
|
||||
credits: map["Credits"] != null ? IntroSkipModel.fromJson(map["Credits"] as Map<String, dynamic>) : null,
|
||||
);
|
||||
final response = await api.mediaSegmentsItemIdGet(itemId: id);
|
||||
final newSegments = response.body?.items?.map((e) => e.toSegment).toList() ?? [];
|
||||
return response.copyWith(
|
||||
body: newModel,
|
||||
body: MediaSegmentsModel(segments: newSegments),
|
||||
);
|
||||
} catch (e) {
|
||||
log(e.toString());
|
||||
|
|
@ -927,7 +920,7 @@ class JellyService {
|
|||
}
|
||||
}
|
||||
|
||||
Future<Response<List<SessionInfo>>> sessionsInfo(String deviceId) async => api.sessionsGet(deviceId: deviceId);
|
||||
Future<Response<List<SessionInfoDto>>> sessionsInfo(String deviceId) async => api.sessionsGet(deviceId: deviceId);
|
||||
|
||||
Future<Response<bool>> quickConnect(String code) async => api.quickConnectAuthorizePost(code: code);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue