-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5de9fa6
commit cbb797f
Showing
10 changed files
with
146 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
## 0.0.2 | ||
|
||
* Sibnet parser! | ||
* Source code optimizations | ||
|
||
## 0.0.1 | ||
|
||
* Release! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import 'package:args/command_runner.dart'; | ||
// ignore: depend_on_referenced_packages | ||
import 'package:dio/dio.dart'; | ||
import 'package:libanime/libanime.dart'; | ||
import 'package:libanime/structures/video.dart'; | ||
import 'package:mason_logger/mason_logger.dart'; | ||
|
||
/// `maco sibnet` | ||
/// A Sibnet downloader [Command] | ||
class SibnetCommand extends Command<int> { | ||
/// {@macro sibnet_command} | ||
SibnetCommand({ | ||
required Logger logger, | ||
}) : _logger = logger { | ||
argParser | ||
/*..addOption( | ||
'path', | ||
abbr: 'p', | ||
help: 'Path for downloading. (Default ./video.mp4)', | ||
) | ||
..addFlag( | ||
'download', | ||
abbr: 'd', | ||
help: 'Download video. Use path option for downloading path change.', | ||
negatable: false, | ||
)*/ | ||
.addOption( | ||
'url', | ||
abbr: 'u', | ||
help: 'Player Url', | ||
); | ||
} | ||
|
||
@override | ||
String get description => 'Download video from Sibnet player.'; | ||
|
||
@override | ||
String get name => 'sibnet'; | ||
|
||
final Logger _logger; | ||
final dio = Dio(); | ||
|
||
@override | ||
Future<int> run() async { | ||
if (argResults?.wasParsed('url') == false) { | ||
_logger.err(lightRed.wrap('Url option cannot be null.')); | ||
return ExitCode.noInput.code; | ||
} | ||
final url = argResults!['url'].toString(); | ||
final sibnet = Sibnet(); | ||
Video link; | ||
final progress = _logger.progress('Begging video extraction.'); | ||
try { | ||
link = await sibnet.parse(url); | ||
} on Exception { | ||
progress.fail('An error occurred'); | ||
_logger.err(lightRed.wrap('Link decode error!')); | ||
return ExitCode.unavailable.code; | ||
} | ||
progress.complete('Fetching complete!'); | ||
|
||
final mp4Url = link.url; | ||
_logger.info(mp4Url); | ||
/* Not working, ToDo: fix | ||
if (argResults?['download'] == true) { | ||
var path = './video.mp4'; | ||
// ignore: use_if_null_to_convert_nulls_to_bools | ||
if (argResults?.wasParsed('path') == true) { | ||
path = argResults!['path'].toString(); | ||
} | ||
final downloadProgress = _logger.progress('Downloading.'); | ||
try { | ||
await dio.download(mp4Url, path, options: Options( | ||
headers: { | ||
'Referer': mp4Url | ||
}, | ||
),); | ||
} catch (e) { | ||
downloadProgress.fail('An error occurred while downloading'); | ||
_logger.detail('Error: $e'); | ||
} | ||
downloadProgress.complete('Downloaded at $path'); | ||
}*/ | ||
|
||
return ExitCode.success.code; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Map<String, String> en = { | ||
'beg_ext': 'Begging video extraction.', | ||
'using_def_token': 'Token not set, using default.', | ||
'non_null_url': 'Url option cannot be null.', | ||
'error_occ': 'An error occurred', | ||
'downloading': 'Downloading.', | ||
'error_dl': 'An error occurred while downloading', | ||
"error_log": 'Error:', | ||
'dl_at': 'Downloaded at' | ||
}; | ||
|
||
Map<String, String> ru = { | ||
'beg_ext': 'Начинаю вытаскивание ссылки.', | ||
'using_def_token': 'Токен не указан, изпользую стандартный.', | ||
'non_null_url': 'Поле url обязательно.', | ||
'error_occ': 'Произошла ошибка', | ||
'downloading': 'Скачиваю.', | ||
'error_dl': 'Произошла ошибка при скачивании.', | ||
"error_log": 'Ошибка:', | ||
'dl_at': 'Скачано в' | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters