mirror of
https://github.com/gokadzev/Musify.git
synced 2025-05-17 06:26:05 +08:00
Added checker for deleted playlists and albums
This commit is contained in:
1
checkdb.sh
Normal file
1
checkdb.sh
Normal file
@ -0,0 +1 @@
|
||||
dart scripts/checker.dart > checker.txt
|
26
scripts/checker.dart
Normal file
26
scripts/checker.dart
Normal file
@ -0,0 +1,26 @@
|
||||
// ignore_for_file: avoid_print
|
||||
|
||||
import 'package:musify/DB/albums.db.dart';
|
||||
import 'package:musify/DB/playlists.db.dart';
|
||||
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
|
||||
|
||||
final _yt = YoutubeExplode();
|
||||
List playlists = [...playlistsDB, ...albumsDB];
|
||||
|
||||
void main() async {
|
||||
print('PLAYLISTS AND ALBUMS CHECKING RESULT:');
|
||||
print(' ');
|
||||
for (final playlist in playlists) {
|
||||
final plist = await _yt.playlists.get(playlist['ytid']);
|
||||
|
||||
if (plist.videoCount == null) {
|
||||
if (playlist['isAlbum'] != null && playlist['isAlbum']) {
|
||||
print('> The album with the ID ${playlist['ytid']} does not exist.');
|
||||
} else {
|
||||
print('> The playlist with the ID ${playlist['ytid']} does not exist.');
|
||||
}
|
||||
}
|
||||
}
|
||||
print(' ');
|
||||
print('The checking process is done');
|
||||
}
|
Reference in New Issue
Block a user