[playlist] add playlist name
This commit is contained in:
parent
51acf1cabf
commit
8f2739aa42
|
|
@ -45,7 +45,8 @@ class DlFormCubit extends Cubit<DlFormState> {
|
||||||
var video = Video.fromJson(videoTmp);
|
var video = Video.fromJson(videoTmp);
|
||||||
videos.add(video.copyWith(
|
videos.add(video.copyWith(
|
||||||
format: state.format,
|
format: state.format,
|
||||||
filename: '${video.id}_${state.format.format}'));
|
filename: '${video.id}_${state.format.format}',
|
||||||
|
playlistTitle: playlistTitle));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var video = Video.fromJson(dataInfos);
|
var video = Video.fromJson(dataInfos);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class DlForm extends StatelessWidget {
|
||||||
DropdownFormat(),
|
DropdownFormat(),
|
||||||
SubmitButton(),
|
SubmitButton(),
|
||||||
]),
|
]),
|
||||||
DebugDlFormState(),
|
//DebugDlFormState(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class Video extends Equatable {
|
||||||
this.uploader = '',
|
this.uploader = '',
|
||||||
this.uploadDate = '',
|
this.uploadDate = '',
|
||||||
this.filename = '',
|
this.filename = '',
|
||||||
|
this.playlistTitle = '',
|
||||||
});
|
});
|
||||||
|
|
||||||
final String id;
|
final String id;
|
||||||
|
|
@ -33,6 +34,7 @@ class Video extends Equatable {
|
||||||
final String uploader;
|
final String uploader;
|
||||||
final String uploadDate;
|
final String uploadDate;
|
||||||
final String filename;
|
final String filename;
|
||||||
|
final String playlistTitle;
|
||||||
|
|
||||||
factory Video.fromJson(Map<String, dynamic> json) {
|
factory Video.fromJson(Map<String, dynamic> json) {
|
||||||
return Video(
|
return Video(
|
||||||
|
|
@ -63,6 +65,7 @@ class Video extends Equatable {
|
||||||
String? uploader,
|
String? uploader,
|
||||||
String? uploadDate,
|
String? uploadDate,
|
||||||
String? filename,
|
String? filename,
|
||||||
|
String? playlistTitle,
|
||||||
}) {
|
}) {
|
||||||
return Video(
|
return Video(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
|
|
@ -78,6 +81,7 @@ class Video extends Equatable {
|
||||||
uploader: uploader ?? this.uploader,
|
uploader: uploader ?? this.uploader,
|
||||||
uploadDate: uploadDate ?? this.uploadDate,
|
uploadDate: uploadDate ?? this.uploadDate,
|
||||||
filename: filename ?? this.filename,
|
filename: filename ?? this.filename,
|
||||||
|
playlistTitle: playlistTitle ?? this.playlistTitle,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,5 +99,6 @@ class Video extends Equatable {
|
||||||
url,
|
url,
|
||||||
isParsed,
|
isParsed,
|
||||||
filename,
|
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 =
|
final tmpFile =
|
||||||
File('temp/${video.filename}_done.${video.format.extension}');
|
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(
|
final newFile = File(
|
||||||
'${downloadDirectory.path}/$cleanTitle.${video.format.extension}');
|
'${downloadDirectory.path}/$cleanTitle.${video.format.extension}');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
name: notube
|
name: notube
|
||||||
description: NoTube
|
description: noTube
|
||||||
|
|
||||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.1+1
|
version: 0.0.18
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue