Skip to content

Commit

Permalink
Added checker for deleted playlists and albums
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed Jan 30, 2024
1 parent 7c7e82d commit 574d3d4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions checkdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dart scripts/checker.dart > checker.txt
26 changes: 26 additions & 0 deletions scripts/checker.dart
Original file line number Diff line number Diff line change
@@ -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');
}

0 comments on commit 574d3d4

Please sign in to comment.