Skip to content

Commit

Permalink
fix(playlists): prevent adding playlists with empty name, author, and…
Browse files Browse the repository at this point in the history
… null video count
  • Loading branch information
gokadzev committed Nov 19, 2024
1 parent 452ba73 commit 1e12bcb
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lib/API/musify.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,18 @@ Future<String> addUserPlaylist(String input, BuildContext context) async {
}

try {
await _yt.playlists.get(playlistId);
final _playlist = await _yt.playlists.get(playlistId);

if (userPlaylists.contains(playlistId)) {
return '${context.l10n!.playlistAlreadyExists}!';
}

if (_playlist.title == '' &&
_playlist.author == '' &&
_playlist.videoCount == null) {
return '${context.l10n!.invalidYouTubePlaylist}!';
}

userPlaylists.add(playlistId);
addOrUpdateData('user', 'playlists', userPlaylists);
return '${context.l10n!.addedSuccess}!';
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "حدث خطأ ما",
"folderRestrictions": "نظرًا للقيود الجديدة على Android، فإنه من الضروري اختيار مجلدات محددة ومناسبة لأنواع الملفات المختلفة. يرجى التأكد من اختيار مجلد 'المستندات' أو 'التنزيلات' لنسخة احتياطية للتطبيق.",
"home": "الرئيسية",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "اللغة",
"languageMsg": "تم تغيير اللغة",
"library": "Library",
Expand Down
3 changes: 2 additions & 1 deletion lib/localization/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Etwas ist schiefgelaufen",
"folderRestrictions": "Aufgrund neuer Beschränkungen auf Android ist es wichtig, spezifische und geeignete Ordner für verschiedene Dateitypen auszuwählen. Stelle sicher, dass du entweder den Ordner 'Dokumente' oder 'Downloads' für das App-Backup auswählst.",
"home": "Startseite",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Sprache",
"languageMsg": "Sprache geändert",
"library": "Bibliothek",
Expand Down Expand Up @@ -89,4 +90,4 @@
"useSquigglySlider": "Wellenförmiger Playback-Balken",
"userPlaylists": "Deine Playlists",
"youtubePlaylistLinkOrId": "Youtube-Playlist-Link oder ID einer Youtube-Playlist"
}
}
1 change: 1 addition & 0 deletions lib/localization/app_el.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Παρουσιάστηκε κάποιο πρόβλημα",
"folderRestrictions": "Λόγω νέων περιορισμών στο Android, είναι απαραίτητο να επιλέξετε συγκεκριμένους και κατάλληλους φακέλους για διάφορους τύπους αρχείων. Βεβαιωθείτε ότι επιλέγετε είτε τον φάκελο 'Έγγραφα' είτε τον φάκελο 'Λήψεις' για τη δημιουργία αντιγράφου ασφαλείας της εφαρμογής.",
"home": "Κεντρική",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Γλώσσα",
"languageMsg": "Η γλώσσα έχει αλλάξει",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "An error occurred. Please try again.",
"folderRestrictions": "Android restrictions require selecting specific folders (e.g., Documents or Downloads) for backup.",
"home": "Home",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Language",
"languageMsg": "Language updated",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Une erreur s'est produite",
"folderRestrictions": "En raison des nouvelles restrictions sur Android, il est essentiel de sélectionner des dossiers spécifiques et appropriés pour différents types de fichiers. Assurez-vous de choisir soit le dossier 'Documents' soit le dossier 'Téléchargements' pour la sauvegarde de l'application.",
"home": "Accueil",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Langue",
"languageMsg": "Langue modifiée",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_id.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Kesalahan",
"folderRestrictions": "Karena adanya pembatasan baru pada Android, penting untuk memilih folder yang spesifik dan sesuai untuk berbagai jenis file. Pastikan Anda memilih folder 'Dokumen' atau 'Unduhan' untuk pencadangan aplikasi.",
"home": "Beranda",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Bahasa",
"languageMsg": "Bahasa berhasil diubah",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_it.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Qualcosa è andato storto",
"folderRestrictions": "A causa delle nuove restrizioni su Android, è necessario selezionare cartelle specifiche e appropriate per diversi tipi di file. Assicurati di scegliere la cartella 'Documents' o 'Downloads' per il backup dell'app.",
"home": "Home",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Lingua",
"languageMsg": "Lingua cambiata con successo",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "不明のエラーが発生",
"folderRestrictions": "Androidの新しい制約により、ファイルの種類に対して適切なフォルダを選択する必要があります。本アプリのバックアップには、「Documents」か「Downloads」フォルダを必ず選択してください。",
"home": "ホーム",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "言語",
"languageMsg": "言語を変更しました",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_ka.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "დაფიქსირდა შეცდომა",
"folderRestrictions": "Android-ის ახალი შეზღუდვებიდან გამომდინარე, საჭიროა რომ აირჩიოთ კონკრეტული და შესაბამისი საქაღალდეები განსხვავებული ფაილის ტიპებისთვის. გთხოვთ დარწმუნდით რომ ირჩევთ 'Documents' ან 'Downloads' საქაღალდეს აპლიკაციის ინფორმაციის რეზერვისთვის.",
"home": "მთავარი",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "ენა",
"languageMsg": "ენა შეიცვალა",
"library": "Library",
Expand Down
3 changes: 2 additions & 1 deletion lib/localization/app_ko.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "오류가 발생했습니다. 다시 시도해 주세요.",
"folderRestrictions": "안드로이드 제한으로 인해 백업할 특정 폴더(예: 문서 또는 다운로드)를 선택해야 합니다.",
"home": "홈",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "언어",
"languageMsg": "언어가 성공적으로 변경되었음",
"library": "라이브러리",
Expand Down Expand Up @@ -89,4 +90,4 @@
"useSquigglySlider": "굴곡 슬라이더",
"userPlaylists": "사용자 재생목록",
"youtubePlaylistLinkOrId": "유튜브 재생목록 링크 또는 ID "
}
}
1 change: 1 addition & 0 deletions lib/localization/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Coś poszło nie tak",
"folderRestrictions": "Ze względu na nowe ograniczenia w systemie Android konieczne jest wybranie określonych i odpowiednich folderów dla różnych typów plików. Upewnij się, że wybrałeś folder „Dokumenty” lub „Pobrane” dla kopii zapasowej aplikacji.",
"home": "Dom",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Język",
"languageMsg": "Język został zmieniony",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Algo deu errado",
"folderRestrictions": "Devido às novas restrições no Android, é essencial selecionar pastas específicas e apropriadas para diferentes tipos de arquivo. Por favor, certifique-se de escolher a pasta 'Documentos' ou 'Downloads' para o backup do aplicativo.",
"home": "Início",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Idioma",
"languageMsg": "O idioma foi alterado",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Bir hata oluştu",
"folderRestrictions": "Android üzerindeki yeni kısıtlamalar nedeniyle, farklı dosya türleri için belirli ve uygun klasörleri seçmek önemlidir. Lütfen uygulama yedekleme için 'Belgeler' veya 'İndirilenler' klasörlerinden birini seçtiğinizden emin olun.",
"home": "Ana Sayfa",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Dil",
"languageMsg": "Dil değiştirildi",
"library": "Library",
Expand Down
1 change: 1 addition & 0 deletions lib/localization/app_uk.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"error": "Щось пішло не так",
"folderRestrictions": "У зв'язку з новими обмеженнями на Android, обирається конкретні та відповідні теки для різних типів файлів. Будь ласка, переконайтеся, що ви вибрали теку 'Документи' або 'Завантаження' для резервного копіювання програми",
"home": "Головна",
"invalidYouTubePlaylist": "Invalid Youtube playlist",
"language": "Мова",
"languageMsg": "Мову змінено",
"library": "Library",
Expand Down
6 changes: 5 additions & 1 deletion no_translations.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"ru": [
"invalidYouTubePlaylist"
]
}

1 comment on commit 1e12bcb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main translation file (app_en.arb) has been updated. Please review and update your translations accordingly.
@muhammadbahaa2001, @Anto1337, @gokadzev, @Yoshlix, @CrisBalGreece, @daviddprtma, @motzarello, @maboroshin, @DDinghoya, @S0nter, @Pazdikan, @GeovaneDev, @kyskerem, @DanielProg39

Please sign in to comment.