~repos /only-bible-app

#kotlin#android#ios

git clone https://pyrossh.dev/repos/only-bible-app.git

The only bible app you will ever need. No ads. No in-app purchases. No distractions.


7c0a3865 pyrossh

2 years ago
add script
Files changed (5) hide show
  1. README.md +9 -2
  2. pubspec.lock +61 -0
  3. pubspec.yaml +29 -141
  4. scripts/convertVerses.js +0 -102
  5. scripts/generate_audio.dart +39 -6
README.md CHANGED
@@ -5,8 +5,7 @@ A new Flutter project.
5
5
  ## Setup
6
6
 
7
7
  ```agsl
8
- brew install fluttter
9
- brew install cocoapods
8
+ brew install fluttter cocoapods firebase-cli
10
9
  ```
11
10
 
12
11
  ## Lint
@@ -15,6 +14,14 @@ dart fix --apply
15
14
  dart format lib
16
15
  ```
17
16
 
17
+ ## Build
18
+ ```agsl
19
+ dart pub global activate flutterfire_cli
20
+ flutterfire configure --project=only-bible-app
21
+ flutter pub run flutter_launcher_icons
22
+ flutter pub run change_app_package_name:main com.new.package.name
23
+ ```
24
+
18
25
  ## Run
19
26
  ```agsl
20
27
  flutter clean
pubspec.lock CHANGED
@@ -129,6 +129,14 @@ packages:
129
129
  url: "https://pub.dev"
130
130
  source: hosted
131
131
  version: "8.6.1"
132
+ change_app_package_name:
133
+ dependency: "direct dev"
134
+ description:
135
+ name: change_app_package_name
136
+ sha256: f9ebaf68a4b5a68c581492579bb68273c523ef325fbf9ce2f1b57fb136ad023b
137
+ url: "https://pub.dev"
138
+ source: hosted
139
+ version: "1.1.0"
132
140
  characters:
133
141
  dependency: transitive
134
142
  description:
@@ -145,6 +153,14 @@ packages:
145
153
  url: "https://pub.dev"
146
154
  source: hosted
147
155
  version: "2.0.3"
156
+ cli_util:
157
+ dependency: transitive
158
+ description:
159
+ name: cli_util
160
+ sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7
161
+ url: "https://pub.dev"
162
+ source: hosted
163
+ version: "0.4.0"
148
164
  clock:
149
165
  dependency: transitive
150
166
  description:
@@ -241,6 +257,30 @@ packages:
241
257
  url: "https://pub.dev"
242
258
  source: hosted
243
259
  version: "6.1.4"
260
+ firebase_core:
261
+ dependency: "direct main"
262
+ description:
263
+ name: firebase_core
264
+ sha256: "2e9324f719e90200dc7d3c4f5d2abc26052f9f2b995d3b6626c47a0dfe1c8192"
265
+ url: "https://pub.dev"
266
+ source: hosted
267
+ version: "2.15.0"
268
+ firebase_core_platform_interface:
269
+ dependency: transitive
270
+ description:
271
+ name: firebase_core_platform_interface
272
+ sha256: b63e3be6c96ef5c33bdec1aab23c91eb00696f6452f0519401d640938c94cba2
273
+ url: "https://pub.dev"
274
+ source: hosted
275
+ version: "4.8.0"
276
+ firebase_core_web:
277
+ dependency: transitive
278
+ description:
279
+ name: firebase_core_web
280
+ sha256: "0fd5c4b228de29b55fac38aed0d9e42514b3d3bd47675de52bf7f8fccaf922fa"
281
+ url: "https://pub.dev"
282
+ source: hosted
283
+ version: "2.6.0"
244
284
  fixnum:
245
285
  dependency: transitive
246
286
  description:
@@ -299,6 +339,14 @@ packages:
299
339
  description: flutter
300
340
  source: sdk
301
341
  version: "0.0.0"
342
+ flutter_launcher_icons:
343
+ dependency: "direct dev"
344
+ description:
345
+ name: flutter_launcher_icons
346
+ sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
347
+ url: "https://pub.dev"
348
+ source: hosted
349
+ version: "0.13.1"
302
350
  flutter_lints:
303
351
  dependency: "direct dev"
304
352
  description:
@@ -307,6 +355,11 @@ packages:
307
355
  url: "https://pub.dev"
308
356
  source: hosted
309
357
  version: "2.0.2"
358
+ flutter_localizations:
359
+ dependency: "direct main"
360
+ description: flutter
361
+ source: sdk
362
+ version: "0.0.0"
310
363
  flutter_native_splash:
311
364
  dependency: "direct main"
312
365
  description:
@@ -431,6 +484,14 @@ packages:
431
484
  description: flutter
432
485
  source: sdk
433
486
  version: "0.0.0"
487
+ intl:
488
+ dependency: "direct main"
489
+ description:
490
+ name: intl
491
+ sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6
492
+ url: "https://pub.dev"
493
+ source: hosted
494
+ version: "0.18.0"
434
495
  io:
435
496
  dependency: transitive
436
497
  description:
pubspec.yaml CHANGED
@@ -20,6 +20,10 @@ dependencies:
20
20
  one_context: ^2.1.0
21
21
  flutter_swipe_detector: ^2.0.0
22
22
  cupertino_icons: ^1.0.5
23
+ firebase_core: ^2.15.0
24
+ flutter_localizations:
25
+ sdk: flutter
26
+ intl: any
23
27
 
24
28
  dev_dependencies:
25
29
  flutter_test:
@@ -28,8 +32,11 @@ dev_dependencies:
28
32
  sdk: flutter
29
33
  flutter_lints: ^2.0.0
30
34
  flutter_azure_tts: ^0.1.6
35
+ flutter_launcher_icons: ^0.13.1
36
+ change_app_package_name: ^1.1.0
31
37
 
32
38
  flutter:
39
+ generate: true
33
40
  uses-material-design: true
34
41
  assets:
35
42
  - assets/images/
@@ -43,150 +50,31 @@ flutter:
43
50
  weight: 500
44
51
  - asset: assets/fonts/Roboto/Roboto-Bold.ttf
45
52
  weight: 700
46
- # An image asset can refer to one or more resolution-specific "variants", see
47
- # https://flutter.dev/assets-and-images/#resolution-aware
48
53
 
54
+ flutter_launcher_icons:
49
- # For details regarding adding assets from package dependencies, see
55
+ android: "launcher_icon"
56
+ ios: true
50
- # https://flutter.dev/assets-and-images/#from-packages
57
+ image_path: "assets/images/logo.png"
58
+ min_sdk_android: 21
59
+ remove_alpha_ios: true
60
+ web:
61
+ generate: true
62
+ image_path: "assets/images/logo.png"
63
+ background_color: "#hexcode"
64
+ theme_color: "#hexcode"
65
+ windows:
66
+ generate: true
67
+ image_path: "assets/images/logo.png"
68
+ icon_size: 48 # min:48, max:256, default: 48
69
+ macos:
70
+ generate: true
71
+ image_path: "assets/images/logo.png"
51
72
 
52
- # To add custom fonts to your application, add a fonts section here,
53
- # in this "flutter" section. Each entry in this list should have a
54
- # "family" key with the font family name, and a "fonts" key with a
55
- # list giving the asset and other descriptors for the font. For
56
- # example:
57
- # fonts:
58
- # - family: Schyler
59
- # fonts:
60
- # - asset: fonts/Schyler-Regular.ttf
61
- # - asset: fonts/Schyler-Italic.ttf
62
- # style: italic
63
- # - family: Trajan Pro
64
- # fonts:
65
- # - asset: fonts/TrajanPro.ttf
66
- # - asset: fonts/TrajanPro_Bold.ttf
67
- # weight: 700
68
- #
69
- # For details regarding fonts from package dependencies,
70
- # see https://flutter.dev/custom-fonts/#from-packages
71
73
  flutter_native_splash:
72
74
  color: "#FFFFFF"
73
- # The image parameter allows you to specify an image used in the splash screen. It must be a
74
- # png file and should be sized for 4x pixel density.
75
- image: assets/app_icon_1024.png
76
-
77
- # The branding property allows you to specify an image used as branding in the splash screen.
78
- # It must be a png file. It is supported for Android, iOS and the Web. For Android 12,
79
- # see the Android 12 section below.
80
- #branding: assets/dart.png
81
-
82
- # To position the branding image at the bottom of the screen you can use bottom, bottomRight,
83
- # and bottomLeft. The default values is bottom if not specified or specified something else.
84
- #branding_mode: bottom
85
-
86
- # The color_dark, background_image_dark, image_dark, branding_dark are parameters that set the background
87
- # and image when the device is in dark mode. If they are not specified, the app will use the
88
- # parameters from above. If the image_dark parameter is specified, color_dark or
89
- # background_image_dark must be specified. color_dark and background_image_dark cannot both be
90
- # set.
91
- #color_dark: "#042a49"
92
- #background_image_dark: "assets/dark-background.png"
93
- #image_dark: assets/splash-invert.png
94
- #branding_dark: assets/dart_dark.png
95
-
96
- # Android 12 handles the splash screen differently than previous versions. Please visit
97
- # https://developer.android.com/guide/topics/ui/splash-screen
98
- # Following are Android 12 specific parameter.
99
- android_12:
100
- # The image parameter sets the splash screen icon image. If this parameter is not specified,
101
- # the app's launcher icon will be used instead.
102
- # Please note that the splash screen will be clipped to a circle on the center of the screen.
103
- # App icon with an icon background: This should be 960×960 pixels, and fit within a circle
104
- # 640 pixels in diameter.
105
- # App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
106
- # 768 pixels in diameter.
107
- #image: assets/android12splash.png
75
+ image: assets/images/logo.png
108
-
109
- # Splash screen background color.
110
- #color: "#42a5f5"
111
-
112
- # App icon background color.
113
- #icon_background_color: "#111111"
114
-
115
- # The branding property allows you to specify an image used as branding in the splash screen.
116
- #branding: assets/dart.png
117
-
118
- # The image_dark, color_dark, icon_background_color_dark, and branding_dark set values that
119
- # apply when the device is in dark mode. If they are not specified, the app will use the
120
- # parameters from above.
121
- #image_dark: assets/android12splash-invert.png
122
- #color_dark: "#042a49"
123
- #icon_background_color_dark: "#eeeeee"
124
-
125
76
  # The android, ios and web parameters can be used to disable generating a splash screen on a given
126
77
  # platform.
127
- #android: false
78
+ android: false
128
- #ios: false
79
+ ios: false
129
- #web: false
80
+ web: false
130
-
131
- # Platform specific images can be specified with the following parameters, which will override
132
- # the respective parameter. You may specify all, selected, or none of these parameters:
133
- #color_android: "#42a5f5"
134
- #color_dark_android: "#042a49"
135
- #color_ios: "#42a5f5"
136
- #color_dark_ios: "#042a49"
137
- #color_web: "#42a5f5"
138
- #color_dark_web: "#042a49"
139
- #image_android: assets/splash-android.png
140
- #image_dark_android: assets/splash-invert-android.png
141
- #image_ios: assets/splash-ios.png
142
- #image_dark_ios: assets/splash-invert-ios.png
143
- #image_web: assets/splash-web.gif
144
- #image_dark_web: assets/splash-invert-web.gif
145
- #background_image_android: "assets/background-android.png"
146
- #background_image_dark_android: "assets/dark-background-android.png"
147
- #background_image_ios: "assets/background-ios.png"
148
- #background_image_dark_ios: "assets/dark-background-ios.png"
149
- #background_image_web: "assets/background-web.png"
150
- #background_image_dark_web: "assets/dark-background-web.png"
151
- #branding_android: assets/brand-android.png
152
- #branding_dark_android: assets/dart_dark-android.png
153
- #branding_ios: assets/brand-ios.gif
154
- #branding_dark_ios: assets/dart_dark-ios.gif
155
-
156
- # The position of the splash image can be set with android_gravity, ios_content_mode, and
157
- # web_image_mode parameters. All default to center.
158
- #
159
- # android_gravity can be one of the following Android Gravity (see
160
- # https://developer.android.com/reference/android/view/Gravity): bottom, center,
161
- # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
162
- # fill_vertical, left, right, start, or top.
163
- #android_gravity: center
164
- #
165
- # ios_content_mode can be one of the following iOS UIView.ContentMode (see
166
- # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
167
- # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
168
- # bottomLeft, or bottomRight.
169
- #ios_content_mode: center
170
- #
171
- # web_image_mode can be one of the following modes: center, contain, stretch, and cover.
172
- #web_image_mode: center
173
-
174
- # The screen orientation can be set in Android with the android_screen_orientation parameter.
175
- # Valid parameters can be found here:
176
- # https://developer.android.com/guide/topics/manifest/activity-element#screen
177
- #android_screen_orientation: sensorLandscape
178
-
179
- # To hide the notification bar, use the fullscreen parameter. Has no effect in web since web
180
- # has no notification bar. Defaults to false.
181
- # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
182
- # To show the notification bar, add the following code to your Flutter app:
183
- # WidgetsFlutterBinding.ensureInitialized();
184
- # SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom, SystemUiOverlay.top], );
185
- #fullscreen: true
186
-
187
- # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
188
- # with the info_plist_files parameter. Remove only the # characters in the three lines below,
189
- # do not remove any spaces:
190
- #info_plist_files:
191
- # - 'ios/Runner/Info-Debug.plist'
192
- # - 'ios/Runner/Info-Release.plist'
scripts/convertVerses.js DELETED
@@ -1,102 +0,0 @@
1
- import fs from "fs";
2
- import sdk from "microsoft-cognitiveservices-speech-sdk";
3
-
4
- const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5
-
6
- const speechConfig = sdk.SpeechConfig.fromSubscription(
7
- "cbc860f2564b4869b922c17dfb100b1d",
8
- "eastus"
9
- );
10
- speechConfig.speechSynthesisOutputFormat =
11
- sdk.SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3;
12
-
13
- const createSSML = ({ voice, rate, text }) => {
14
- return `<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="en-GB">
15
- <voice name="${voice}">
16
- <prosody rate="${rate}">${text}</prosody>
17
- </voice>
18
- </speak>
19
- `;
20
- };
21
- //kn-IN-SapnaNeural 0.85
22
- //kn-IN-GaganNeural 0.85
23
-
24
- //HemkalaNeural 0.9
25
- //SagarNeural 0.9
26
- const tts = (synthesizer, data) => {
27
- return new Promise((resolve, reject) => {
28
- synthesizer.speakSsmlAsync(
29
- data,
30
- function (result) {
31
- if (result.reason === sdk.ResultReason.SynthesizingAudioCompleted) {
32
- resolve(result);
33
- } else {
34
- reject(result.errorDetails);
35
- }
36
- },
37
- function (err) {
38
- reject(err);
39
- }
40
- );
41
- });
42
- };
43
-
44
- class PushAudioOutputStreamTestCallback extends sdk.PushAudioOutputStreamCallback {
45
- constructor() {
46
- super();
47
- this.output = fs.createWriteStream("./scripts/output.mp3");
48
- this.output.on("error", (error) => {
49
- console.log("error", error);
50
- throw error;
51
- });
52
- }
53
-
54
- write(dataBuffer) {
55
- this.output.write(new Uint8Array(dataBuffer));
56
- }
57
-
58
- close() {
59
- this.output.close();
60
- }
61
- }
62
-
63
- const main = async () => {
64
- const pushStream = new PushAudioOutputStreamTestCallback();
65
- const audioConfig = sdk.AudioConfig.fromStreamOutput(pushStream);
66
- const synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);
67
- const arr = fs
68
- .readFileSync("./scripts/kannada.csv", "utf-8")
69
- .split("\n")
70
- .map((v) => v.split("|"));
71
- let durationAcc = 0;
72
- const books = {};
73
- for (const item of arr) {
74
- const book = item[0];
75
- const chapter = parseInt(item[1]);
76
- const verse = parseInt(item[2]);
77
- books[book] = { chapters: [] }
78
- // const result = await tts(
79
- // synthesizer,
80
- // createSSML({
81
- // voice: "kn-IN-GaganNeural",
82
- // rate: 0.85,
83
- // text: item[3],
84
- // })
85
- // );
86
- // const start = durationAcc;
87
- // const end = durationAcc + result.privAudioDuration / 10000000;
88
- // durationAcc = end;
89
- // item.push(start.toFixed(4), end.toFixed(4));
90
- if (chapter === 2) {
91
- break;
92
- }
93
- await sleep(20);
94
- }
95
- synthesizer.close();
96
- pushStream.close();
97
- fs.writeFileSync(
98
- "./src/data/new_kannada.csv",
99
- arr.map((v) => v.join("|")).join("\n")
100
- );
101
- };
102
- main();
scripts/generate_audio.dart CHANGED
@@ -1,14 +1,47 @@
1
1
  import "dart:io";
2
- import 'package:only_bible_app/utils.dart';
2
+ import 'package:flutter_azure_tts/flutter_azure_tts.dart';
3
+
4
+ Future<void> convertText(Voice v, String fileName, String text) async {
5
+ final ttsResponse = await AzureTts.getTts(TtsParams(
6
+ voice: v,
7
+ audioFormat: AudioOutputFormat.audio48khz96kBitrateMonoMp3,
8
+ rate: 0.80,
9
+ text: text,
10
+ ));
11
+ await File(fileName).writeAsBytes(ttsResponse.audio.buffer.asUint8List(), flush: true);
12
+ }
3
13
 
4
14
  void main() async {
5
15
  print("starting");
16
+ AzureTts.init(subscriptionKey: Platform.environment["SUB_KEY"]!, region: "centralindia", withLogs: false);
17
+ final voice = Voice(
18
+ name: "",
19
+ displayName: "",
20
+ localName: "",
21
+ shortName: "kn-IN-GaganNeural",
22
+ gender: "Male",
23
+ locale: "kn-IN",
24
+ sampleRateHertz: AudioOutputFormat.audio24khz48kBitrateMonoMp3,
25
+ voiceType: "",
26
+ status: "",
27
+ );
6
- final bibleTxt = await File("./assets/bibles/KJV.txt").readAsString();
28
+ final bibleTxt = await File("./assets/bibles/Kannada.txt").readAsString();
7
- final books = getBibleFromText(bibleTxt);
29
+ final lines = bibleTxt.split("\n");
8
- for (var book in books) {
30
+ for (final line in lines) {
31
+ if (line.isEmpty) {
32
+ continue;
33
+ }
34
+ final book = line.substring(0, 2);
9
- for (var (chapterIndex, chapter) in book.chapters.indexed) {
35
+ final chapter = line.substring(3, 6);
36
+ final verseNo = line.substring(7, 10);
37
+ final verseText = line.substring(11);
38
+ print("${book}-${chapter}-${verseNo}.mp3");
39
+ final outputFilename = "./scripts/audio/${book}-${chapter}-${verseNo}.mp3";
10
- // final outputFile = File(outputFilename).openWrite();
40
+ final outFile = File(outputFilename);
41
+ if (outFile.existsSync() && outFile.lengthSync() > 100) {
42
+ continue;
11
43
  }
44
+ await convertText(voice, outputFilename, verseText);
12
45
  }
13
46
  print("finished");
14
47
  }