-
-
Notifications
You must be signed in to change notification settings - Fork 131
/
constants.dart
348 lines (316 loc) · 8.92 KB
/
constants.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// ignore_for_file: non_constant_identifier_names, constant_identifier_names
import 'dart:collection';
import 'package:flutter/services.dart';
import 'package:namida/class/lang.dart';
import 'package:namida/class/track.dart';
import 'package:namida/controller/indexer_controller.dart';
import 'package:namida/controller/settings_controller.dart';
///
int kSdkVersion = 21;
final Set<String> kStoragePaths = {};
final Set<String> kInitialDirectoriesToScan = {};
final List<double> kDefaultWaveFormData = List<double>.filled(1, 2.0);
final List<double> kDefaultScaleList = List<double>.filled(1, 0.01);
final RegExp kYoutubeRegex = RegExp(
r'\b(?:https?://)?(?:www\.)?(?:youtube\.com/watch\?v=|youtu\.be/)([\w\-]+)(?:\S+)?',
caseSensitive: false,
);
final RegExp kYoutubeRegexPlaylists = RegExp(
r'\b(?:https?://)?(?:www\.)?(?:youtube\.com/playlist\?list=|youtu\.be/)([\w\-]+)(?:\S+)?',
caseSensitive: false,
);
/// Main Color
const Color kMainColor = Color.fromARGB(160, 117, 128, 224);
const Color kMainColorLight = Color.fromARGB(255, 116, 126, 219);
const Color kMainColorDark = Color.fromARGB(255, 139, 149, 241);
/// Files used by Namida
class AppPaths {
static final _USER_DATA = AppDirs.USER_DATA;
// ================= User Data =================
static final SETTINGS = '$_USER_DATA/namida_settings.json';
static final TRACKS = '$_USER_DATA/tracks.json';
static final VIDEOS_LOCAL = '$_USER_DATA/local_videos.json';
static final VIDEOS_CACHE = '$_USER_DATA/cache_videos.json';
static final TRACKS_STATS = '$_USER_DATA/tracks_stats.json';
static final LATEST_QUEUE = '$_USER_DATA/latest_queue.json';
static final LOGS = '$_USER_DATA/logs.txt';
static final LOGS_TAGGER = '$_USER_DATA/tagger_logs.txt';
static final TOTAL_LISTEN_TIME = '$_USER_DATA/total_listen.txt';
static final FAVOURITES_PLAYLIST = '$_USER_DATA/favs.json';
static final NAMIDA_LOGO = '${AppDirs.ARTWORKS}.ARTWORKS.NAMIDA_DEFAULT_ARTWORK.PNG';
// ================= Youtube =================
static final YT_LIKES_PLAYLIST = '${AppDirs.YOUTUBE_MAIN_DIRECTORY}/yt_likes.json';
}
/// Directories used by Namida
class AppDirs {
static String USER_DATA = '';
static String APP_CACHE = '';
static String INTERNAL_STORAGE = '';
// ================= User Data =================
static final HISTORY_PLAYLIST = '$USER_DATA/History/';
static final PLAYLISTS = '$USER_DATA/Playlists/';
static final QUEUES = '$USER_DATA/Queues/';
static final ARTWORKS = '$USER_DATA/Artworks/'; // extracted audio artworks
static final PALETTES = '$USER_DATA/Palettes/';
static final VIDEOS_CACHE = '$USER_DATA/Videos/';
static final AUDIOS_CACHE = '$USER_DATA/Audios/';
static final VIDEOS_CACHE_TEMP = '$USER_DATA/Videos/Temp/';
static final THUMBNAILS = '$USER_DATA/Thumbnails/'; // extracted video thumbnails
static final LYRICS = '$USER_DATA/Lyrics/';
static final M3UBackup = '$USER_DATA/M3U Backup/'; // backups m3u on first found
// ================= Internal Storage =================
static final SAVED_ARTWORKS = '$INTERNAL_STORAGE/Artworks/';
static final BACKUPS = '$INTERNAL_STORAGE/Backups'; // only one without ending slash.
static final COMPRESSED_IMAGES = '$INTERNAL_STORAGE/Compressed/';
static final M3UPlaylists = '$INTERNAL_STORAGE/M3U Playlists/';
static final YOUTUBE_DOWNLOADS = '$INTERNAL_STORAGE/Downloads/';
// ================= Youtube =================
static final YOUTUBE_MAIN_DIRECTORY = '$USER_DATA/Youtube';
static final YT_PLAYLISTS = '$YOUTUBE_MAIN_DIRECTORY/Youtube Playlists/';
static final YT_HISTORY_PLAYLIST = '$YOUTUBE_MAIN_DIRECTORY/Youtube History/';
static final YT_THUMBNAILS = '$YOUTUBE_MAIN_DIRECTORY/YTThumbnails/';
static final YT_THUMBNAILS_CHANNELS = '$YOUTUBE_MAIN_DIRECTORY/YTThumbnails Channels/';
static final YT_METADATA = '$YOUTUBE_MAIN_DIRECTORY/Metadata Videos/';
static final YT_METADATA_TEMP = '$YOUTUBE_MAIN_DIRECTORY/Metadata Videos Temp/';
static final YT_METADATA_CHANNELS = '$YOUTUBE_MAIN_DIRECTORY/Metadata Channels/';
static final YT_METADATA_COMMENTS = '$YOUTUBE_MAIN_DIRECTORY/Metadata Comments/';
static final YT_STATS = '$YOUTUBE_MAIN_DIRECTORY/Youtube Stats/';
static final YT_PALETTES = '$YOUTUBE_MAIN_DIRECTORY/Palettes/';
static final YT_DOWNLOAD_TASKS = '$YOUTUBE_MAIN_DIRECTORY/Download Tasks/';
// ===========================================
static final List<String> values = [
// -- User Data
HISTORY_PLAYLIST,
PLAYLISTS,
QUEUES,
ARTWORKS,
PALETTES,
VIDEOS_CACHE,
VIDEOS_CACHE_TEMP,
AUDIOS_CACHE,
THUMBNAILS,
LYRICS,
M3UBackup,
// -- Youtube
YOUTUBE_MAIN_DIRECTORY,
YT_PLAYLISTS,
YT_HISTORY_PLAYLIST,
YT_THUMBNAILS,
YT_THUMBNAILS_CHANNELS,
YT_METADATA,
YT_METADATA_TEMP,
YT_METADATA_CHANNELS,
YT_METADATA_COMMENTS,
YT_STATS,
YT_PALETTES,
YT_DOWNLOAD_TASKS,
// Internal Storage Directories are created on demand
];
}
class AppSocial {
static const APP_VERSION = 'v1.8.5-release';
static const DONATE_KOFI = 'https://ko-fi.com/namidaco';
static const DONATE_BUY_ME_A_COFFEE = 'https://www.buymeacoffee.com/namidaco';
static const GITHUB = 'https://github.com/namidaco/namida';
static const GITHUB_ISSUES = '$GITHUB/issues';
static const GITHUB_RELEASES = '$GITHUB/releases/';
static const EMAIL = 'namida.coo@gmail.com';
static const TRANSLATION_REPO = 'https://github.com/namidaco/namida-translations';
}
/// Default Playlists IDs
const k_PLAYLIST_NAME_FAV = '_FAVOURITES_';
const k_PLAYLIST_NAME_HISTORY = '_HISTORY_';
const k_PLAYLIST_NAME_MOST_PLAYED = '_MOST_PLAYED_';
const k_PLAYLIST_NAME_AUTO_GENERATED = '_AUTO_GENERATED_';
List<Track> get allTracksInLibrary => UnmodifiableListView(Indexer.inst.tracksInfoList);
bool get shouldAlbumBeSquared =>
(settings.albumGridCount.value > 1 && !settings.useAlbumStaggeredGridView.value) || (settings.albumGridCount.value == 1 && settings.forceSquaredAlbumThumbnail.value);
/// Stock Video Qualities List
final List<String> kStockVideoQualities = [
'144p',
'240p',
'360p',
'480p',
'720p',
'1080p',
'2k',
'4k',
'8k',
];
/// Default values available for setting the Date Time Format.
const kDefaultDateTimeStrings = {
'yyyyMMdd': '20220413',
'dd/MM/yyyy': '13/04/2022',
'MM/dd/yyyy': '04/13/2022',
'yyyy/MM/dd': '2022/04/13',
'yyyy/dd/MM': '2022/13/04',
'dd-MM-yyyy': '13-04-2022',
'MM-dd-yyyy': '04-13-2022',
'MMMM dd, yyyy': 'April 13, 2022',
'MMM dd, yyyy': 'Apr 13, 2022',
'[dd | MM]': '[13 | 04]',
'[dd.MM.yyyy]': '[13.04.2022]',
};
/// Extensions used to filter audio files
const Set<String> kAudioFileExtensions = {
'.m4a',
'.mp3',
'.webm',
'.ogg',
'.wav',
'.flac',
'.aac',
'.3gp',
'.ac3',
'.opus',
'.m4b',
'.pk',
'.8svx',
'.aa',
'.aax',
'.act',
'.aiff',
'.alac',
'.amr',
'.ape',
'.au',
'.awb',
'.cda',
'.dss',
'.dts',
'.dvf',
'.gsm',
'.iklax',
'.ivs',
'.m4p',
'.mmf',
'.movpkg',
'.mid',
'.mpc',
'.msv',
'.nmf',
'.oga',
'.mogg',
'.ra',
'.rm',
'.raw',
'.rf64',
'.sln',
'.tak',
'.tta',
'.voc',
'.vox',
'.wma',
'.wv',
'.aif',
'.aifc',
'.amz',
'.awc',
'.bwf',
'.caf',
'.dct',
'.dff',
'.dsf',
'.fap',
'.flp',
'.its',
'.kar',
'.kfn',
'.m4r',
'.mac',
'.mka',
'.mlp',
'.mp2',
'.mpp',
'.oma',
'.qcp',
'.rmi',
'.snd',
'.spx',
'.ts',
'.uax',
'.xmz',
};
/// Extensions used to filter video files
const Set<String> kVideoFilesExtensions = {
'mp4',
'mkv',
'avi',
'wmv',
'flv',
'mov',
'3gp',
'ogv',
'webm',
'mpg',
'mpeg',
'm4v',
'ts',
'vob',
'asf',
'rm',
'swf',
'f4v',
'divx',
'm2ts',
'mts',
'mpv',
'mp2',
'mpe',
'mpa',
'mxf',
'm2v',
'mpeg1',
'mpeg2',
'mpeg4'
};
/// Extensions used to filter m3u files
const Set<String> kM3UPlaylistsExtensions = {'m3u', 'm3u8', 'M3U', 'M3U8'};
const kDefaultOrientations = <DeviceOrientation>[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown];
const kDefaultLang = NamidaLanguage(
code: "en_US",
name: "English",
country: "United States",
);
const kDummyTrack = Track('');
const kDummyExtendedTrack = TrackExtended(
title: "",
originalArtist: "",
artistsList: [],
album: "",
albumArtist: "",
originalGenre: "",
genresList: [],
originalMood: "",
moodList: [],
composer: "",
trackNo: 0,
duration: 0,
year: 0,
size: 0,
dateAdded: 0,
dateModified: 0,
path: "",
comment: "",
bitrate: 0,
sampleRate: 0,
format: "",
channels: "",
discNo: 0,
language: "",
lyrics: "",
);
/// Unknown Tag Fields
class UnknownTags {
static const TITLE = '';
static const ALBUM = 'Unknown Album';
static const ALBUMARTIST = '';
static const ARTIST = 'Unknown Artist';
static const GENRE = 'Unknown Genre';
static const MOOD = '';
static const COMPOSER = 'Unknown Composer';
}
int get currentTimeMS => DateTime.now().millisecondsSinceEpoch;
const kThemeAnimationDurationMS = 350;
const kMaximumSleepTimerTracks = 40;
const kMaximumSleepTimerMins = 180;