mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 11:22:16 +08:00
refa: download video (#1737)
* opt: save pb danmaku * refa: download video * opt: replaceAll * fix: wait delete * opt: remove completer * fix: index.json * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
37b1228552
commit
407b31c5c1
@@ -1,5 +1,6 @@
|
||||
abstract class Em {
|
||||
static final _exp = RegExp('<[^>]*>([^<]*)</[^>]*>');
|
||||
static final _htmlRegExp = RegExp(r'&(lt|gt|quot|apos|nbsp|amp);');
|
||||
|
||||
static String regCate(String origin) {
|
||||
Iterable<Match> matches = _exp.allMatches(origin);
|
||||
@@ -17,14 +18,21 @@ abstract class Em {
|
||||
},
|
||||
onNonMatch: (String str) {
|
||||
if (str != '') {
|
||||
str = str
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll(' ', " ")
|
||||
.replaceAll('&', "&");
|
||||
res.add((isEm: false, text: str));
|
||||
res.add((
|
||||
isEm: false,
|
||||
text: str.replaceAllMapped(
|
||||
_htmlRegExp,
|
||||
(m) => switch (m.group(1)) {
|
||||
'lt' => '<',
|
||||
'gt' => '>',
|
||||
'quot' => '"',
|
||||
'apos' => "'",
|
||||
'nbsp' => ' ',
|
||||
'amp' => '&',
|
||||
_ => m.group(0)!,
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
@@ -260,6 +260,14 @@ extension DirectoryExt on Directory {
|
||||
await delete(recursive: recursive);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
Future<bool> lengthGte(int length) async {
|
||||
int count = 0;
|
||||
await for (var _ in list()) {
|
||||
if (++count == length) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extension SizeExt on Size {
|
||||
|
||||
@@ -16,6 +16,8 @@ abstract final class PathUtils {
|
||||
static const _fileExt = '.m4s';
|
||||
static const audioNameType2 = 'audio$_fileExt';
|
||||
static const videoNameType2 = 'video$_fileExt';
|
||||
static const coverName = 'cover.jpg';
|
||||
static const danmakuName = 'danmaku.pb';
|
||||
static const downloadDir = 'download';
|
||||
|
||||
static String buildShadersAbsolutePath(
|
||||
|
||||
Reference in New Issue
Block a user