Skip to content

Commit

Permalink
Merge branch 'main' into feat/external-video-player
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaoMint committed Aug 25, 2023
2 parents bd48e8a + 0078c7a commit 614ccdb
Show file tree
Hide file tree
Showing 17 changed files with 923 additions and 185 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/prbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is a basic workflow to help you get started with Actions

name: prbuild

on:
pull_request:
branches: ["main"]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# This workflow contains a single job called "build"
build-and-release-android:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: 3.13.0
channel: stable
- name: Decode keystore
run: |
echo $ENCODED_KEYSTORE | base64 -di > android/app/keystore.jks
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}

- run: flutter pub get
# 打包apk
- name: Collect Apks
run: flutter build apk --release --split-per-abi
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}

# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: "build/app/outputs/flutter-apk/app-*.apk"

build-and-release-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: 3.13.0
channel: stable
- name: Install project dependencies
run: flutter pub get
- name: Build artifacts
run: flutter build windows --release
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
type: "zip"
filename: Miru-${{github.ref_name}}-windows.zip
directory: build/windows/runner/Release
# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: "build/windows/runner/Release/Miru-${{github.ref_name}}-windows.zip"
5 changes: 4 additions & 1 deletion assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@
"overview": "Overview",
"cast": "Cast",
"additional-info": "Additional Info",
"get-lastest-data-error": "Failed to get latest data"
"get-lastest-data-error": "Failed to get latest data",
"modify-tmdb-binding": "Modify TMDB Binding",
"no-tmdb-data": "No TMDB data matched, please bind the data yourself",
"tmdb-key-missing": "TMDB API Key missing, please fill in the settings"
},

"video": {
Expand Down
5 changes: 4 additions & 1 deletion assets/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@
"overview": "概览",
"cast": "演员",
"additional-info": "附加信息",
"get-lastest-data-error": "获取最新数据失败"
"get-lastest-data-error": "获取最新数据失败",
"modify-tmdb-binding": "修改 TMDB 绑定",
"no-tmdb-data": "未匹配到 TMDB 数据,请自行绑定数据",
"tmdb-key-missing": "TMDB API Key 丢失,请前往设置填写"
},

"video": {
Expand Down
28 changes: 19 additions & 9 deletions lib/api/tmdb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ class TmdbApi {
defaultLanguage: MiruStorage.getSetting(SettingKey.language),
);

static Future<tmdb_model.TMDBDetail?> getDetail(String keyword,
{int page = 1}) async {
final result = await tmdb.v3.search.queryMulti(
static Future<tmdb_model.TMDBDetail?> getDetailBySearch(
String keyword, {
int page = 1,
}) async {
final result = await search(
keyword,
page: page,
);
Expand All @@ -19,20 +21,28 @@ class TmdbApi {
if (results.isEmpty) {
return null;
}
return getDetail(
results.first["id"],
results.first["media_type"],
);
}

static Future<tmdb_model.TMDBDetail> getDetail(
int id,
String mediaType,
) async {
late Map data;
final mediaType = results[0]["media_type"];
if (mediaType == "movie") {
data = await tmdb.v3.movies.getDetails(
results[0]["id"],
id,
appendToResponse: "credits,images",
);
} else {
data = await tmdb.v3.tv.getDetails(
results[0]["id"],
id,
appendToResponse: "credits,images",
);
}

return tmdb_model.TMDBDetail(
id: data["id"],
mediaType: mediaType,
Expand Down Expand Up @@ -69,7 +79,7 @@ class TmdbApi {
);
}

static String? getImageUrl(String path) {
return tmdb.images.getUrl(path);
static String? getImageUrl(String path, {size = ImageSizes.ORIGINAL}) {
return tmdb.images.getUrl(path, size: size);
}
}
1 change: 1 addition & 0 deletions lib/models/tmdb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TMDB {
@Index(unique: true)
late int tmdbID;
late String data;
late String mediaType;
}

@JsonSerializable()
Expand Down
Loading

0 comments on commit 614ccdb

Please sign in to comment.