mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07: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,47 +0,0 @@
|
|||
// ignore_for_file: public_member_api_docs, sort_constructors_first, invalid_annotation_target
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'intro_skip_model.freezed.dart';
|
||||
part 'intro_skip_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class IntroOutSkipModel with _$IntroOutSkipModel {
|
||||
const IntroOutSkipModel._();
|
||||
factory IntroOutSkipModel({
|
||||
IntroSkipModel? intro,
|
||||
IntroSkipModel? credits,
|
||||
}) = _IntroOutSkipModel;
|
||||
|
||||
factory IntroOutSkipModel.fromJson(Map<String, dynamic> json) => _$IntroOutSkipModelFromJson(json);
|
||||
|
||||
bool introInRange(Duration position) {
|
||||
if (intro == null) return false;
|
||||
return (position.compareTo(intro!.showTime) >= 0 && position.compareTo(intro!.hideTime) <= 0);
|
||||
}
|
||||
|
||||
bool creditsInRange(Duration position) {
|
||||
if (credits == null) return false;
|
||||
return (position.compareTo(credits!.showTime) >= 0 && position.compareTo(credits!.hideTime) <= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@freezed
|
||||
class IntroSkipModel with _$IntroSkipModel {
|
||||
factory IntroSkipModel({
|
||||
@JsonKey(name: "EpisodeId") required String id,
|
||||
@JsonKey(name: "Valid") required bool valid,
|
||||
@JsonKey(name: "IntroStart", fromJson: _durationFromMilliseconds, toJson: _durationToMilliseconds)
|
||||
required Duration start,
|
||||
@JsonKey(name: "IntroEnd", fromJson: _durationFromMilliseconds, toJson: _durationToMilliseconds)
|
||||
required Duration end,
|
||||
@JsonKey(name: "ShowSkipPromptAt", fromJson: _durationFromMilliseconds, toJson: _durationToMilliseconds)
|
||||
required Duration showTime,
|
||||
@JsonKey(name: "HideSkipPromptAt", fromJson: _durationFromMilliseconds, toJson: _durationToMilliseconds)
|
||||
required Duration hideTime,
|
||||
}) = _IntroSkipModel;
|
||||
|
||||
factory IntroSkipModel.fromJson(Map<String, dynamic> json) => _$IntroSkipModelFromJson(json);
|
||||
}
|
||||
|
||||
Duration _durationFromMilliseconds(num milliseconds) => Duration(milliseconds: (milliseconds * 1000).toInt());
|
||||
num _durationToMilliseconds(Duration duration) => duration.inMilliseconds.toDouble() / 1000.0;
|
||||
|
|
@ -1,595 +0,0 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'intro_skip_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
IntroOutSkipModel _$IntroOutSkipModelFromJson(Map<String, dynamic> json) {
|
||||
return _IntroOutSkipModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$IntroOutSkipModel {
|
||||
IntroSkipModel? get intro => throw _privateConstructorUsedError;
|
||||
IntroSkipModel? get credits => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this IntroOutSkipModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$IntroOutSkipModelCopyWith<IntroOutSkipModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $IntroOutSkipModelCopyWith<$Res> {
|
||||
factory $IntroOutSkipModelCopyWith(
|
||||
IntroOutSkipModel value, $Res Function(IntroOutSkipModel) then) =
|
||||
_$IntroOutSkipModelCopyWithImpl<$Res, IntroOutSkipModel>;
|
||||
@useResult
|
||||
$Res call({IntroSkipModel? intro, IntroSkipModel? credits});
|
||||
|
||||
$IntroSkipModelCopyWith<$Res>? get intro;
|
||||
$IntroSkipModelCopyWith<$Res>? get credits;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$IntroOutSkipModelCopyWithImpl<$Res, $Val extends IntroOutSkipModel>
|
||||
implements $IntroOutSkipModelCopyWith<$Res> {
|
||||
_$IntroOutSkipModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? intro = freezed,
|
||||
Object? credits = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
intro: freezed == intro
|
||||
? _value.intro
|
||||
: intro // ignore: cast_nullable_to_non_nullable
|
||||
as IntroSkipModel?,
|
||||
credits: freezed == credits
|
||||
? _value.credits
|
||||
: credits // ignore: cast_nullable_to_non_nullable
|
||||
as IntroSkipModel?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$IntroSkipModelCopyWith<$Res>? get intro {
|
||||
if (_value.intro == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $IntroSkipModelCopyWith<$Res>(_value.intro!, (value) {
|
||||
return _then(_value.copyWith(intro: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$IntroSkipModelCopyWith<$Res>? get credits {
|
||||
if (_value.credits == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $IntroSkipModelCopyWith<$Res>(_value.credits!, (value) {
|
||||
return _then(_value.copyWith(credits: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$IntroOutSkipModelImplCopyWith<$Res>
|
||||
implements $IntroOutSkipModelCopyWith<$Res> {
|
||||
factory _$$IntroOutSkipModelImplCopyWith(_$IntroOutSkipModelImpl value,
|
||||
$Res Function(_$IntroOutSkipModelImpl) then) =
|
||||
__$$IntroOutSkipModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({IntroSkipModel? intro, IntroSkipModel? credits});
|
||||
|
||||
@override
|
||||
$IntroSkipModelCopyWith<$Res>? get intro;
|
||||
@override
|
||||
$IntroSkipModelCopyWith<$Res>? get credits;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$IntroOutSkipModelImplCopyWithImpl<$Res>
|
||||
extends _$IntroOutSkipModelCopyWithImpl<$Res, _$IntroOutSkipModelImpl>
|
||||
implements _$$IntroOutSkipModelImplCopyWith<$Res> {
|
||||
__$$IntroOutSkipModelImplCopyWithImpl(_$IntroOutSkipModelImpl _value,
|
||||
$Res Function(_$IntroOutSkipModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? intro = freezed,
|
||||
Object? credits = freezed,
|
||||
}) {
|
||||
return _then(_$IntroOutSkipModelImpl(
|
||||
intro: freezed == intro
|
||||
? _value.intro
|
||||
: intro // ignore: cast_nullable_to_non_nullable
|
||||
as IntroSkipModel?,
|
||||
credits: freezed == credits
|
||||
? _value.credits
|
||||
: credits // ignore: cast_nullable_to_non_nullable
|
||||
as IntroSkipModel?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$IntroOutSkipModelImpl extends _IntroOutSkipModel {
|
||||
_$IntroOutSkipModelImpl({this.intro, this.credits}) : super._();
|
||||
|
||||
factory _$IntroOutSkipModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$IntroOutSkipModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
final IntroSkipModel? intro;
|
||||
@override
|
||||
final IntroSkipModel? credits;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'IntroOutSkipModel(intro: $intro, credits: $credits)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$IntroOutSkipModelImpl &&
|
||||
(identical(other.intro, intro) || other.intro == intro) &&
|
||||
(identical(other.credits, credits) || other.credits == credits));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, intro, credits);
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$IntroOutSkipModelImplCopyWith<_$IntroOutSkipModelImpl> get copyWith =>
|
||||
__$$IntroOutSkipModelImplCopyWithImpl<_$IntroOutSkipModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$IntroOutSkipModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _IntroOutSkipModel extends IntroOutSkipModel {
|
||||
factory _IntroOutSkipModel(
|
||||
{final IntroSkipModel? intro,
|
||||
final IntroSkipModel? credits}) = _$IntroOutSkipModelImpl;
|
||||
_IntroOutSkipModel._() : super._();
|
||||
|
||||
factory _IntroOutSkipModel.fromJson(Map<String, dynamic> json) =
|
||||
_$IntroOutSkipModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
IntroSkipModel? get intro;
|
||||
@override
|
||||
IntroSkipModel? get credits;
|
||||
|
||||
/// Create a copy of IntroOutSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$IntroOutSkipModelImplCopyWith<_$IntroOutSkipModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
IntroSkipModel _$IntroSkipModelFromJson(Map<String, dynamic> json) {
|
||||
return _IntroSkipModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$IntroSkipModel {
|
||||
@JsonKey(name: "EpisodeId")
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "Valid")
|
||||
bool get valid => throw _privateConstructorUsedError;
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get start => throw _privateConstructorUsedError;
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get end => throw _privateConstructorUsedError;
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get showTime => throw _privateConstructorUsedError;
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get hideTime => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this IntroSkipModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of IntroSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$IntroSkipModelCopyWith<IntroSkipModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $IntroSkipModelCopyWith<$Res> {
|
||||
factory $IntroSkipModelCopyWith(
|
||||
IntroSkipModel value, $Res Function(IntroSkipModel) then) =
|
||||
_$IntroSkipModelCopyWithImpl<$Res, IntroSkipModel>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "EpisodeId") String id,
|
||||
@JsonKey(name: "Valid") bool valid,
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration start,
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration end,
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration showTime,
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration hideTime});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$IntroSkipModelCopyWithImpl<$Res, $Val extends IntroSkipModel>
|
||||
implements $IntroSkipModelCopyWith<$Res> {
|
||||
_$IntroSkipModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of IntroSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? valid = null,
|
||||
Object? start = null,
|
||||
Object? end = null,
|
||||
Object? showTime = null,
|
||||
Object? hideTime = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
valid: null == valid
|
||||
? _value.valid
|
||||
: valid // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
start: null == start
|
||||
? _value.start
|
||||
: start // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
end: null == end
|
||||
? _value.end
|
||||
: end // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
showTime: null == showTime
|
||||
? _value.showTime
|
||||
: showTime // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
hideTime: null == hideTime
|
||||
? _value.hideTime
|
||||
: hideTime // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$IntroSkipModelImplCopyWith<$Res>
|
||||
implements $IntroSkipModelCopyWith<$Res> {
|
||||
factory _$$IntroSkipModelImplCopyWith(_$IntroSkipModelImpl value,
|
||||
$Res Function(_$IntroSkipModelImpl) then) =
|
||||
__$$IntroSkipModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: "EpisodeId") String id,
|
||||
@JsonKey(name: "Valid") bool valid,
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration start,
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration end,
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration showTime,
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration hideTime});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$IntroSkipModelImplCopyWithImpl<$Res>
|
||||
extends _$IntroSkipModelCopyWithImpl<$Res, _$IntroSkipModelImpl>
|
||||
implements _$$IntroSkipModelImplCopyWith<$Res> {
|
||||
__$$IntroSkipModelImplCopyWithImpl(
|
||||
_$IntroSkipModelImpl _value, $Res Function(_$IntroSkipModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of IntroSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? valid = null,
|
||||
Object? start = null,
|
||||
Object? end = null,
|
||||
Object? showTime = null,
|
||||
Object? hideTime = null,
|
||||
}) {
|
||||
return _then(_$IntroSkipModelImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
valid: null == valid
|
||||
? _value.valid
|
||||
: valid // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
start: null == start
|
||||
? _value.start
|
||||
: start // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
end: null == end
|
||||
? _value.end
|
||||
: end // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
showTime: null == showTime
|
||||
? _value.showTime
|
||||
: showTime // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
hideTime: null == hideTime
|
||||
? _value.hideTime
|
||||
: hideTime // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$IntroSkipModelImpl implements _IntroSkipModel {
|
||||
_$IntroSkipModelImpl(
|
||||
{@JsonKey(name: "EpisodeId") required this.id,
|
||||
@JsonKey(name: "Valid") required this.valid,
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required this.start,
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required this.end,
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required this.showTime,
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required this.hideTime});
|
||||
|
||||
factory _$IntroSkipModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$IntroSkipModelImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: "EpisodeId")
|
||||
final String id;
|
||||
@override
|
||||
@JsonKey(name: "Valid")
|
||||
final bool valid;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
final Duration start;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
final Duration end;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
final Duration showTime;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
final Duration hideTime;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'IntroSkipModel(id: $id, valid: $valid, start: $start, end: $end, showTime: $showTime, hideTime: $hideTime)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$IntroSkipModelImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.valid, valid) || other.valid == valid) &&
|
||||
(identical(other.start, start) || other.start == start) &&
|
||||
(identical(other.end, end) || other.end == end) &&
|
||||
(identical(other.showTime, showTime) ||
|
||||
other.showTime == showTime) &&
|
||||
(identical(other.hideTime, hideTime) ||
|
||||
other.hideTime == hideTime));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, valid, start, end, showTime, hideTime);
|
||||
|
||||
/// Create a copy of IntroSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$IntroSkipModelImplCopyWith<_$IntroSkipModelImpl> get copyWith =>
|
||||
__$$IntroSkipModelImplCopyWithImpl<_$IntroSkipModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$IntroSkipModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _IntroSkipModel implements IntroSkipModel {
|
||||
factory _IntroSkipModel(
|
||||
{@JsonKey(name: "EpisodeId") required final String id,
|
||||
@JsonKey(name: "Valid") required final bool valid,
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required final Duration start,
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required final Duration end,
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required final Duration showTime,
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
required final Duration hideTime}) = _$IntroSkipModelImpl;
|
||||
|
||||
factory _IntroSkipModel.fromJson(Map<String, dynamic> json) =
|
||||
_$IntroSkipModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "EpisodeId")
|
||||
String get id;
|
||||
@override
|
||||
@JsonKey(name: "Valid")
|
||||
bool get valid;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "IntroStart",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get start;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "IntroEnd",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get end;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "ShowSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get showTime;
|
||||
@override
|
||||
@JsonKey(
|
||||
name: "HideSkipPromptAt",
|
||||
fromJson: _durationFromMilliseconds,
|
||||
toJson: _durationToMilliseconds)
|
||||
Duration get hideTime;
|
||||
|
||||
/// Create a copy of IntroSkipModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$IntroSkipModelImplCopyWith<_$IntroSkipModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'intro_skip_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$IntroOutSkipModelImpl _$$IntroOutSkipModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$IntroOutSkipModelImpl(
|
||||
intro: json['intro'] == null
|
||||
? null
|
||||
: IntroSkipModel.fromJson(json['intro'] as Map<String, dynamic>),
|
||||
credits: json['credits'] == null
|
||||
? null
|
||||
: IntroSkipModel.fromJson(json['credits'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$IntroOutSkipModelImplToJson(
|
||||
_$IntroOutSkipModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'intro': instance.intro,
|
||||
'credits': instance.credits,
|
||||
};
|
||||
|
||||
_$IntroSkipModelImpl _$$IntroSkipModelImplFromJson(Map<String, dynamic> json) =>
|
||||
_$IntroSkipModelImpl(
|
||||
id: json['EpisodeId'] as String,
|
||||
valid: json['Valid'] as bool,
|
||||
start: _durationFromMilliseconds(json['IntroStart'] as num),
|
||||
end: _durationFromMilliseconds(json['IntroEnd'] as num),
|
||||
showTime: _durationFromMilliseconds(json['ShowSkipPromptAt'] as num),
|
||||
hideTime: _durationFromMilliseconds(json['HideSkipPromptAt'] as num),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$IntroSkipModelImplToJson(
|
||||
_$IntroSkipModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'EpisodeId': instance.id,
|
||||
'Valid': instance.valid,
|
||||
'IntroStart': _durationToMilliseconds(instance.start),
|
||||
'IntroEnd': _durationToMilliseconds(instance.end),
|
||||
'ShowSkipPromptAt': _durationToMilliseconds(instance.showTime),
|
||||
'HideSkipPromptAt': _durationToMilliseconds(instance.hideTime),
|
||||
};
|
||||
79
lib/models/items/media_segments_model.dart
Normal file
79
lib/models/items/media_segments_model.dart
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart' as dto;
|
||||
|
||||
part 'media_segments_model.freezed.dart';
|
||||
part 'media_segments_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class MediaSegmentsModel with _$MediaSegmentsModel {
|
||||
const MediaSegmentsModel._();
|
||||
|
||||
factory MediaSegmentsModel({
|
||||
@Default([]) List<MediaSegment> segments,
|
||||
}) = _MediaSegmentsModel;
|
||||
|
||||
factory MediaSegmentsModel.fromJson(Map<String, dynamic> json) => _$MediaSegmentsModelFromJson(json);
|
||||
|
||||
MediaSegment? get intro => segments.firstWhereOrNull((element) => element.type == MediaSegmentType.intro);
|
||||
MediaSegment? get outro => segments.firstWhereOrNull((element) => element.type == MediaSegmentType.outro);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class MediaSegment with _$MediaSegment {
|
||||
const MediaSegment._();
|
||||
|
||||
factory MediaSegment({
|
||||
required MediaSegmentType type,
|
||||
required Duration start,
|
||||
required Duration end,
|
||||
}) = _MediaSegment;
|
||||
|
||||
factory MediaSegment.fromJson(Map<String, dynamic> json) => _$MediaSegmentFromJson(json);
|
||||
|
||||
bool inRange(Duration position) => (position.compareTo(start) >= 0 && position.compareTo(end) <= 0);
|
||||
}
|
||||
|
||||
enum MediaSegmentType {
|
||||
unknown,
|
||||
commercial,
|
||||
preview,
|
||||
recap,
|
||||
outro,
|
||||
intro;
|
||||
|
||||
Color get color => switch (this) {
|
||||
MediaSegmentType.unknown => Colors.black,
|
||||
MediaSegmentType.commercial => Colors.purpleAccent,
|
||||
MediaSegmentType.preview => Colors.deepOrangeAccent,
|
||||
MediaSegmentType.recap => Colors.lightBlueAccent,
|
||||
MediaSegmentType.outro => Colors.yellowAccent,
|
||||
MediaSegmentType.intro => Colors.greenAccent,
|
||||
};
|
||||
|
||||
static MediaSegmentType fromDto(dto.MediaSegmentType? value) {
|
||||
return switch (value) {
|
||||
dto.MediaSegmentType.swaggerGeneratedUnknown => MediaSegmentType.unknown,
|
||||
dto.MediaSegmentType.unknown => MediaSegmentType.unknown,
|
||||
dto.MediaSegmentType.commercial => MediaSegmentType.commercial,
|
||||
dto.MediaSegmentType.preview => MediaSegmentType.preview,
|
||||
dto.MediaSegmentType.recap => MediaSegmentType.recap,
|
||||
dto.MediaSegmentType.outro => MediaSegmentType.outro,
|
||||
dto.MediaSegmentType.intro => MediaSegmentType.intro,
|
||||
null => MediaSegmentType.unknown,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
extension MediaSegmentExtension on dto.MediaSegmentDto {
|
||||
MediaSegment get toSegment => MediaSegment(
|
||||
type: MediaSegmentType.fromDto(type),
|
||||
start: _durationToMilliseconds(startTicks ?? 0),
|
||||
end: _durationToMilliseconds(endTicks ?? 0),
|
||||
);
|
||||
}
|
||||
|
||||
Duration _durationToMilliseconds(num milliseconds) => Duration(milliseconds: (milliseconds ~/ 10000));
|
||||
363
lib/models/items/media_segments_model.freezed.dart
Normal file
363
lib/models/items/media_segments_model.freezed.dart
Normal file
|
|
@ -0,0 +1,363 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'media_segments_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
MediaSegmentsModel _$MediaSegmentsModelFromJson(Map<String, dynamic> json) {
|
||||
return _MediaSegmentsModel.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MediaSegmentsModel {
|
||||
List<MediaSegment> get segments => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this MediaSegmentsModel to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of MediaSegmentsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MediaSegmentsModelCopyWith<MediaSegmentsModel> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MediaSegmentsModelCopyWith<$Res> {
|
||||
factory $MediaSegmentsModelCopyWith(
|
||||
MediaSegmentsModel value, $Res Function(MediaSegmentsModel) then) =
|
||||
_$MediaSegmentsModelCopyWithImpl<$Res, MediaSegmentsModel>;
|
||||
@useResult
|
||||
$Res call({List<MediaSegment> segments});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MediaSegmentsModelCopyWithImpl<$Res, $Val extends MediaSegmentsModel>
|
||||
implements $MediaSegmentsModelCopyWith<$Res> {
|
||||
_$MediaSegmentsModelCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of MediaSegmentsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? segments = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
segments: null == segments
|
||||
? _value.segments
|
||||
: segments // ignore: cast_nullable_to_non_nullable
|
||||
as List<MediaSegment>,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MediaSegmentsModelImplCopyWith<$Res>
|
||||
implements $MediaSegmentsModelCopyWith<$Res> {
|
||||
factory _$$MediaSegmentsModelImplCopyWith(_$MediaSegmentsModelImpl value,
|
||||
$Res Function(_$MediaSegmentsModelImpl) then) =
|
||||
__$$MediaSegmentsModelImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<MediaSegment> segments});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MediaSegmentsModelImplCopyWithImpl<$Res>
|
||||
extends _$MediaSegmentsModelCopyWithImpl<$Res, _$MediaSegmentsModelImpl>
|
||||
implements _$$MediaSegmentsModelImplCopyWith<$Res> {
|
||||
__$$MediaSegmentsModelImplCopyWithImpl(_$MediaSegmentsModelImpl _value,
|
||||
$Res Function(_$MediaSegmentsModelImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of MediaSegmentsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? segments = null,
|
||||
}) {
|
||||
return _then(_$MediaSegmentsModelImpl(
|
||||
segments: null == segments
|
||||
? _value._segments
|
||||
: segments // ignore: cast_nullable_to_non_nullable
|
||||
as List<MediaSegment>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$MediaSegmentsModelImpl extends _MediaSegmentsModel {
|
||||
_$MediaSegmentsModelImpl({final List<MediaSegment> segments = const []})
|
||||
: _segments = segments,
|
||||
super._();
|
||||
|
||||
factory _$MediaSegmentsModelImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MediaSegmentsModelImplFromJson(json);
|
||||
|
||||
final List<MediaSegment> _segments;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<MediaSegment> get segments {
|
||||
if (_segments is EqualUnmodifiableListView) return _segments;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_segments);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MediaSegmentsModel(segments: $segments)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MediaSegmentsModelImpl &&
|
||||
const DeepCollectionEquality().equals(other._segments, _segments));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, const DeepCollectionEquality().hash(_segments));
|
||||
|
||||
/// Create a copy of MediaSegmentsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MediaSegmentsModelImplCopyWith<_$MediaSegmentsModelImpl> get copyWith =>
|
||||
__$$MediaSegmentsModelImplCopyWithImpl<_$MediaSegmentsModelImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$MediaSegmentsModelImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _MediaSegmentsModel extends MediaSegmentsModel {
|
||||
factory _MediaSegmentsModel({final List<MediaSegment> segments}) =
|
||||
_$MediaSegmentsModelImpl;
|
||||
_MediaSegmentsModel._() : super._();
|
||||
|
||||
factory _MediaSegmentsModel.fromJson(Map<String, dynamic> json) =
|
||||
_$MediaSegmentsModelImpl.fromJson;
|
||||
|
||||
@override
|
||||
List<MediaSegment> get segments;
|
||||
|
||||
/// Create a copy of MediaSegmentsModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MediaSegmentsModelImplCopyWith<_$MediaSegmentsModelImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
MediaSegment _$MediaSegmentFromJson(Map<String, dynamic> json) {
|
||||
return _MediaSegment.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MediaSegment {
|
||||
MediaSegmentType get type => throw _privateConstructorUsedError;
|
||||
Duration get start => throw _privateConstructorUsedError;
|
||||
Duration get end => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this MediaSegment to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of MediaSegment
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MediaSegmentCopyWith<MediaSegment> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MediaSegmentCopyWith<$Res> {
|
||||
factory $MediaSegmentCopyWith(
|
||||
MediaSegment value, $Res Function(MediaSegment) then) =
|
||||
_$MediaSegmentCopyWithImpl<$Res, MediaSegment>;
|
||||
@useResult
|
||||
$Res call({MediaSegmentType type, Duration start, Duration end});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MediaSegmentCopyWithImpl<$Res, $Val extends MediaSegment>
|
||||
implements $MediaSegmentCopyWith<$Res> {
|
||||
_$MediaSegmentCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of MediaSegment
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? type = null,
|
||||
Object? start = null,
|
||||
Object? end = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as MediaSegmentType,
|
||||
start: null == start
|
||||
? _value.start
|
||||
: start // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
end: null == end
|
||||
? _value.end
|
||||
: end // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MediaSegmentImplCopyWith<$Res>
|
||||
implements $MediaSegmentCopyWith<$Res> {
|
||||
factory _$$MediaSegmentImplCopyWith(
|
||||
_$MediaSegmentImpl value, $Res Function(_$MediaSegmentImpl) then) =
|
||||
__$$MediaSegmentImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({MediaSegmentType type, Duration start, Duration end});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MediaSegmentImplCopyWithImpl<$Res>
|
||||
extends _$MediaSegmentCopyWithImpl<$Res, _$MediaSegmentImpl>
|
||||
implements _$$MediaSegmentImplCopyWith<$Res> {
|
||||
__$$MediaSegmentImplCopyWithImpl(
|
||||
_$MediaSegmentImpl _value, $Res Function(_$MediaSegmentImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of MediaSegment
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? type = null,
|
||||
Object? start = null,
|
||||
Object? end = null,
|
||||
}) {
|
||||
return _then(_$MediaSegmentImpl(
|
||||
type: null == type
|
||||
? _value.type
|
||||
: type // ignore: cast_nullable_to_non_nullable
|
||||
as MediaSegmentType,
|
||||
start: null == start
|
||||
? _value.start
|
||||
: start // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
end: null == end
|
||||
? _value.end
|
||||
: end // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$MediaSegmentImpl extends _MediaSegment {
|
||||
_$MediaSegmentImpl(
|
||||
{required this.type, required this.start, required this.end})
|
||||
: super._();
|
||||
|
||||
factory _$MediaSegmentImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$MediaSegmentImplFromJson(json);
|
||||
|
||||
@override
|
||||
final MediaSegmentType type;
|
||||
@override
|
||||
final Duration start;
|
||||
@override
|
||||
final Duration end;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MediaSegment(type: $type, start: $start, end: $end)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MediaSegmentImpl &&
|
||||
(identical(other.type, type) || other.type == type) &&
|
||||
(identical(other.start, start) || other.start == start) &&
|
||||
(identical(other.end, end) || other.end == end));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, type, start, end);
|
||||
|
||||
/// Create a copy of MediaSegment
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MediaSegmentImplCopyWith<_$MediaSegmentImpl> get copyWith =>
|
||||
__$$MediaSegmentImplCopyWithImpl<_$MediaSegmentImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$MediaSegmentImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _MediaSegment extends MediaSegment {
|
||||
factory _MediaSegment(
|
||||
{required final MediaSegmentType type,
|
||||
required final Duration start,
|
||||
required final Duration end}) = _$MediaSegmentImpl;
|
||||
_MediaSegment._() : super._();
|
||||
|
||||
factory _MediaSegment.fromJson(Map<String, dynamic> json) =
|
||||
_$MediaSegmentImpl.fromJson;
|
||||
|
||||
@override
|
||||
MediaSegmentType get type;
|
||||
@override
|
||||
Duration get start;
|
||||
@override
|
||||
Duration get end;
|
||||
|
||||
/// Create a copy of MediaSegment
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MediaSegmentImplCopyWith<_$MediaSegmentImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
45
lib/models/items/media_segments_model.g.dart
Normal file
45
lib/models/items/media_segments_model.g.dart
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'media_segments_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$MediaSegmentsModelImpl _$$MediaSegmentsModelImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$MediaSegmentsModelImpl(
|
||||
segments: (json['segments'] as List<dynamic>?)
|
||||
?.map((e) => MediaSegment.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MediaSegmentsModelImplToJson(
|
||||
_$MediaSegmentsModelImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'segments': instance.segments,
|
||||
};
|
||||
|
||||
_$MediaSegmentImpl _$$MediaSegmentImplFromJson(Map<String, dynamic> json) =>
|
||||
_$MediaSegmentImpl(
|
||||
type: $enumDecode(_$MediaSegmentTypeEnumMap, json['type']),
|
||||
start: Duration(microseconds: (json['start'] as num).toInt()),
|
||||
end: Duration(microseconds: (json['end'] as num).toInt()),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$MediaSegmentImplToJson(_$MediaSegmentImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'type': _$MediaSegmentTypeEnumMap[instance.type]!,
|
||||
'start': instance.start.inMicroseconds,
|
||||
'end': instance.end.inMicroseconds,
|
||||
};
|
||||
|
||||
const _$MediaSegmentTypeEnumMap = {
|
||||
MediaSegmentType.unknown: 'unknown',
|
||||
MediaSegmentType.commercial: 'commercial',
|
||||
MediaSegmentType.preview: 'preview',
|
||||
MediaSegmentType.recap: 'recap',
|
||||
MediaSegmentType.outro: 'outro',
|
||||
MediaSegmentType.intro: 'intro',
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue