mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-04-21 11:01:56 +00:00
Project import generated by Copybara.
GitOrigin-RevId: aa7a2fadfab104fd54c1507c3c4446357e176e70
This commit is contained in:
parent
b816d78d98
commit
d0dc2c2410
4 changed files with 85 additions and 12 deletions
57
.github/workflows/build-deploy.yaml
vendored
57
.github/workflows/build-deploy.yaml
vendored
|
|
@ -108,6 +108,63 @@ jobs:
|
||||||
source-dir: build/app/outputs/flutter-apk
|
source-dir: build/app/outputs/flutter-apk
|
||||||
destination-dir: nightly/${{ github.run_id }}/android
|
destination-dir: nightly/${{ github.run_id }}/android
|
||||||
|
|
||||||
|
build_android_tv:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: prod
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Flutter
|
||||||
|
uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
channel: 'stable'
|
||||||
|
|
||||||
|
- uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'zulu'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: flutter pub get
|
||||||
|
|
||||||
|
- name: Set up environment variables
|
||||||
|
run: |
|
||||||
|
touch .env
|
||||||
|
dart run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
|
- name: Create key.properties file
|
||||||
|
run: |
|
||||||
|
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
|
||||||
|
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
|
||||||
|
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
|
||||||
|
echo "storeFile=key.jks" >> android/key.properties
|
||||||
|
|
||||||
|
- name: Decode and save keystore file
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.STORE_FILE_BASE64 }}" | base64 --decode > android/app/key.jks
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
sudo apt install ninja-build
|
||||||
|
name: install ninja
|
||||||
|
|
||||||
|
- name: Build Android
|
||||||
|
run: make build_android_tv
|
||||||
|
|
||||||
|
- name: Upload Android artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: android-build
|
||||||
|
path: build/app/outputs/flutter-apk/app-release-tv.apk
|
||||||
|
|
||||||
|
- uses: ryand56/r2-upload-action@v1.4
|
||||||
|
with:
|
||||||
|
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||||
|
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||||
|
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||||
|
r2-bucket: ${{ secrets.R2_BUCKET }}
|
||||||
|
source-dir: build/app/outputs/flutter-apk
|
||||||
|
destination-dir: nightly/${{ github.run_id }}/android-tv
|
||||||
|
|
||||||
build_ipa:
|
build_ipa:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
environment: prod
|
environment: prod
|
||||||
|
|
|
||||||
5
Makefile
5
Makefile
|
|
@ -1,4 +1,4 @@
|
||||||
.PHONY: build schema build_web build_mac build_android build_windows build_ipa build_linux
|
.PHONY: build schema build_web build_mac build_android build_windows build_ipa build_linux build_android_tv
|
||||||
|
|
||||||
BUILD_ID := $(or $(GITHUB_RUN_ID),dev)
|
BUILD_ID := $(or $(GITHUB_RUN_ID),dev)
|
||||||
|
|
||||||
|
|
@ -17,6 +17,9 @@ build_mac:
|
||||||
build_android:
|
build_android:
|
||||||
flutter build apk --release --dart-define=BUILD_ID=$(BUILD_ID)
|
flutter build apk --release --dart-define=BUILD_ID=$(BUILD_ID)
|
||||||
|
|
||||||
|
build_android_tv:
|
||||||
|
flutter build apk --release --dart-define=BUILD_ID=$(BUILD_ID) --dart-define=IS_TV=true
|
||||||
|
|
||||||
build_windows:
|
build_windows:
|
||||||
flutter build windows --release --dart-define=BUILD_ID=$(BUILD_ID)
|
flutter build windows --release --dart-define=BUILD_ID=$(BUILD_ID)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,16 +74,17 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
if (player.state.playing) {
|
if (player.state.playing) {
|
||||||
TraktService.instance!.startScrobbling(
|
TraktService.instance!.startScrobbling(
|
||||||
meta: widget.meta as types.Meta,
|
meta: widget.meta as types.Meta,
|
||||||
progress: progress.toDouble(),
|
progress: currentProgressInPercentage,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
TraktService.instance!.stopScrobbling(
|
TraktService.instance!.stopScrobbling(
|
||||||
meta: widget.meta as types.Meta,
|
meta: widget.meta as types.Meta,
|
||||||
progress: progress.toDouble(),
|
progress: currentProgressInPercentage,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
TraktService.instance!.debugLogs.add(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,11 +164,19 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool canCallOnce = false;
|
||||||
|
|
||||||
setDurationFromTrakt() async {
|
setDurationFromTrakt() async {
|
||||||
if (player.state.duration.inSeconds < 2) {
|
if (player.state.duration.inSeconds < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (canCallOnce) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
canCallOnce = true;
|
||||||
|
|
||||||
if (!TraktService.instance!.isEnabled() || traktProgress == null) {
|
if (!TraktService.instance!.isEnabled() || traktProgress == null) {
|
||||||
player.play();
|
player.play();
|
||||||
return;
|
return;
|
||||||
|
|
@ -287,7 +296,7 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_timer = Timer.periodic(const Duration(minutes: 1), (timer) {
|
_timer = Timer.periodic(const Duration(seconds: 30), (timer) {
|
||||||
saveWatchHistory();
|
saveWatchHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -389,13 +398,6 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (traktIntegration && widget.meta is types.Meta) {
|
|
||||||
TraktService.instance!.stopScrobbling(
|
|
||||||
meta: widget.meta as types.Meta,
|
|
||||||
progress: currentProgressInPercentage,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemChrome.setPreferredOrientations([
|
SystemChrome.setPreferredOrientations([
|
||||||
DeviceOrientation.portraitUp,
|
DeviceOrientation.portraitUp,
|
||||||
DeviceOrientation.portraitDown,
|
DeviceOrientation.portraitDown,
|
||||||
|
|
@ -414,7 +416,16 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
_streamComplete.cancel();
|
_streamComplete.cancel();
|
||||||
_streamListen.cancel();
|
_streamListen.cancel();
|
||||||
_duration.cancel();
|
_duration.cancel();
|
||||||
|
|
||||||
|
if (traktIntegration && widget.meta is types.Meta) {
|
||||||
|
TraktService.instance!.stopScrobbling(
|
||||||
|
meta: widget.meta as types.Meta,
|
||||||
|
progress: currentProgressInPercentage,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
player.dispose();
|
player.dispose();
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class TraktService {
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
debugLogs.add(
|
debugLogs.add(
|
||||||
"Failed to fetch data from ${url.replaceFirst("https://api.trakt.tv/", "")} ${response.statusCode}");
|
"Failed to fetch data from ${url.replaceFirst("https://api.trakt.tv/", "")} ${response.statusCode}");
|
||||||
throw Exception('Failed to fetch data from $url');
|
throw Exception('Failed to fetch data from $url ${response.statusCode}');
|
||||||
}
|
}
|
||||||
|
|
||||||
debugLogs.add(
|
debugLogs.add(
|
||||||
|
|
@ -319,6 +319,8 @@ class TraktService {
|
||||||
}).toList();
|
}).toList();
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
print('Error fetching up next movies: $e');
|
print('Error fetching up next movies: $e');
|
||||||
|
debugLogs.add('Error fetching up next movies: $e');
|
||||||
|
debugLogs.add(stack.toString());
|
||||||
print(stack);
|
print(stack);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue