refactor: remove outdated album entries and update playlist images

This commit is contained in:
Valeri Gokadze
2025-10-15 23:17:12 +04:00
parent 1594e7f05e
commit e3c2599aaa
3 changed files with 33 additions and 61 deletions

View File

@@ -83,20 +83,6 @@ List albumsDB = [
'isAlbum': true,
'list': [],
},
{
'ytid': 'PL2YYYbxwOUaKedFVO8nv_HY_0XZCH00S4',
'title': 'Beauty Behind The Madness - The Weeknd',
'image': 'https://i.scdn.co/image/ab67616d0000b2737fcead687e99583072cc217b',
'isAlbum': true,
'list': [],
},
{
'ytid': 'PL2YYYbxwOUaIUIjvLgpVyn_K4-IIl3mFc',
'title': 'After Hours - The Weeknd',
'image': 'https://i.scdn.co/image/ab67616d0000b2738863bc11d2aa12b54f5aeb36',
'isAlbum': true,
'list': [],
},
{
'ytid': 'PLorwKgiUml5v7dtrSLgvs6p-Y3oCh61yU',
'title': "Don't Smile at Me - Billie Eilish",
@@ -356,13 +342,6 @@ List albumsDB = [
'isAlbum': true,
'list': [],
},
{
'ytid': 'OLAK5uy_kDuqdPyyBdToRV-mvWklRE_ysv7-LqveI',
'title': 'One Thing At A Time - Morgan Wallen',
'image': 'https://i.scdn.co/image/ab67616d0000b273705079df9a25a28b452c1fc9',
'isAlbum': true,
'list': [],
},
{
'ytid': 'OLAK5uy_kFa9tOyLsP4JH1EqSD3hIudVdkmQWfKT0',
'title': 'DECIDE - Djo',

View File

@@ -333,7 +333,7 @@ List<Map<String, dynamic>> playlistsDB = [
'ytid': 'PLXpMeQYR1ilK2M6PUwdA75st7uAUrH7Z_',
'title': 'Canciones 2025 Reggaeton',
'image':
'https://image-cdn-ak.spotifycdn.com/image/ab67706c0000da8448420cf3245a947f2200fb1a',
'https://image-cdn-ak.spotifycdn.com/image/ab67706c0000da8428450fba04bfd105d51c7486',
'list': [],
},
{
@@ -382,7 +382,8 @@ List<Map<String, dynamic>> playlistsDB = [
{
'ytid': 'PLXpMeQYR1ilL_qsEr9Z9aaTlcOq2oQhe8',
'title': 'New Song 2024 Dance',
'image': 'https://i.scdn.co/image/ab67706c0000da84958dfdf2e46ba62b0ba2c38e',
'image':
'https://image-cdn-ak.spotifycdn.com/image/ab67706c0000da8414b2741de5d2163184ecb459',
'list': [],
},
{

View File

@@ -4,8 +4,6 @@ import 'package:http/http.dart' as http;
import 'package:musify/DB/albums.db.dart';
import 'package:musify/DB/playlists.db.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
import 'package:musify/services/proxy_manager.dart';
import 'package:musify/services/settings_manager.dart';
List playlists = [...playlistsDB, ...albumsDB];
@@ -13,51 +11,45 @@ void main() async {
print('PLAYLISTS AND ALBUMS CHECKING RESULT:');
print(' ');
// Obtain a YoutubeExplode client that respects proxy setting.
YoutubeExplode? ytClient;
try {
if (useProxy.value) {
ytClient = await ProxyManager().getYoutubeExplodeClient();
} else {
ytClient = ProxyManager().getClientSync();
}
YoutubeExplode? ytClient = await YoutubeExplode();
for (final playlist in playlists) {
try {
final plist = await ytClient!.playlists.get(playlist['ytid']);
try {
final plist = await ytClient!.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.',
);
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.',
);
}
}
}
final imageAvailability = await isImageAvailable(playlist['image']);
if (!imageAvailability) {
if (playlist['isAlbum'] != null && playlist['isAlbum']) {
print(
'> The album artwork with the URL ${playlist['image']} is not available.',
);
} else {
print(
'> The playlist artwork with the URL ${playlist['image']} is not available.',
);
final imageAvailability = await isImageAvailable(playlist['image']);
if (!imageAvailability) {
if (playlist['isAlbum'] != null && playlist['isAlbum']) {
print(
'> The album artwork with the URL ${playlist['image']} is not available.',
);
} else {
print(
'> The playlist artwork with the URL ${playlist['image']} is not available.',
);
}
}
} catch (e) {
print(
'An error occurred while checking playlist ${playlist['title']}: $e',
);
}
} catch (e) {
print(
'An error occurred while checking playlist ${playlist['title']}: $e',
);
}
}
} finally {
try {
if (useProxy.value) ytClient?.close();
} catch (_) {}
} catch (e) {
print('An error occurred while initializing YoutubeExplode: $e');
}
print(' ');