[playlist] add playlist name
This commit is contained in:
parent
4ac4ce0d7e
commit
c2ab736a54
|
|
@ -45,7 +45,8 @@ class DlFormCubit extends Cubit<DlFormState> {
|
|||
var video = Video.fromJson(videoTmp);
|
||||
videos.add(video.copyWith(
|
||||
format: state.format,
|
||||
filename: '${video.id}_${state.format.format}'));
|
||||
filename: '${video.id}_${state.format.format}',
|
||||
playlistTitle: playlistTitle));
|
||||
}
|
||||
} else {
|
||||
var video = Video.fromJson(dataInfos);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class DlForm extends StatelessWidget {
|
|||
DropdownFormat(),
|
||||
SubmitButton(),
|
||||
]),
|
||||
DebugDlFormState(),
|
||||
//DebugDlFormState(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Video extends Equatable {
|
|||
this.uploader = '',
|
||||
this.uploadDate = '',
|
||||
this.filename = '',
|
||||
this.playlistTitle = '',
|
||||
});
|
||||
|
||||
final String id;
|
||||
|
|
@ -33,6 +34,7 @@ class Video extends Equatable {
|
|||
final String uploader;
|
||||
final String uploadDate;
|
||||
final String filename;
|
||||
final String playlistTitle;
|
||||
|
||||
factory Video.fromJson(Map<String, dynamic> json) {
|
||||
return Video(
|
||||
|
|
@ -63,6 +65,7 @@ class Video extends Equatable {
|
|||
String? uploader,
|
||||
String? uploadDate,
|
||||
String? filename,
|
||||
String? playlistTitle,
|
||||
}) {
|
||||
return Video(
|
||||
id: id ?? this.id,
|
||||
|
|
@ -78,6 +81,7 @@ class Video extends Equatable {
|
|||
uploader: uploader ?? this.uploader,
|
||||
uploadDate: uploadDate ?? this.uploadDate,
|
||||
filename: filename ?? this.filename,
|
||||
playlistTitle: playlistTitle ?? this.playlistTitle,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -95,5 +99,6 @@ class Video extends Equatable {
|
|||
url,
|
||||
isParsed,
|
||||
filename,
|
||||
playlistTitle,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,10 +74,3 @@ class Home extends StatelessWidget {
|
|||
}));
|
||||
}
|
||||
}
|
||||
/*
|
||||
SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: viewportConstraints.maxHeight),
|
||||
child:
|
||||
*/
|
||||
|
|
@ -91,6 +91,15 @@ class VideosCubit extends Cubit<VideosState> {
|
|||
final tmpFile =
|
||||
File('temp/${video.filename}_done.${video.format.extension}');
|
||||
|
||||
var playlistTitle = video.playlistTitle;
|
||||
await Directory('${downloadDirectory.path}/$playlistTitle')
|
||||
.create(recursive: true)
|
||||
.catchError((e) => debugPrint('Error creating directory: $e'));
|
||||
debugPrint('Playlist title: $playlistTitle');
|
||||
if (playlistTitle.isNotEmpty && playlistTitle != '') {
|
||||
cleanTitle = playlistTitle + '/' + cleanTitle;
|
||||
}
|
||||
|
||||
final newFile = File(
|
||||
'${downloadDirectory.path}/$cleanTitle.${video.format.extension}');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
name: notube
|
||||
description: NoTube
|
||||
description: noTube
|
||||
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 0.0.1+1
|
||||
version: 0.0.18
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue