Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

releases/iib_app_cli #723

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/tauri_app_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:

- name: Install Dependencies
run: |

pip install -r requirements.txt

- name: Build Executable
Expand All @@ -43,7 +44,22 @@ jobs:
script-name: app.py
output-file: iib_api_server
output-dir: out
include-data-dir: |
vue/dist=vue/dist

- run: cp out/iib_api_server out/iib_app_cli-${{ env.VERSION }}-${{ runner.os }}
if: matrix.os == 'ubuntu-20.04'
- run: cp out/iib_api_server.exe out/iib_app_cli-${{ env.VERSION }}-${{ runner.os }}.exe
if: matrix.os == 'windows-latest'

- name: Upload Server Artifacts
uses: actions/upload-artifact@v3
with:
name: iib_app_cli_${{ runner.os }}
path: |
out/iib_app_cli-${{ env.VERSION }}-${{ runner.os }}
out/iib_app_cli-${{ env.VERSION }}-${{ runner.os }}.exe

- name: Upload Server Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -195,6 +211,16 @@ jobs:
with:
name: bundle-${{ env.VERSION }}-Linux
path: artifacts

- uses: actions/download-artifact@v3
with:
name: iib_app_cli_Windows
path: artifacts

- uses: actions/download-artifact@v3
with:
name: iib_app_cli_Linux
path: artifacts

- name: Release
uses: softprops/action-gh-release@v1
Expand Down
7 changes: 4 additions & 3 deletions scripts/iib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
get_current_commit_hash,
get_current_tag,
get_file_info_by_path,
get_frame_at_second
get_data_file_path
)
from fastapi import FastAPI, HTTPException, Header, Response
from fastapi.staticfiles import StaticFiles
Expand Down Expand Up @@ -73,7 +73,8 @@
except Exception as e:
logger.error(e)

index_html_path = os.path.join(cwd, "vue/dist/index.html") # 在app.py也被使用

index_html_path = get_data_file_path("vue/dist/index.html") if is_exe_ver else os.path.join(cwd, "vue/dist/index.html") # 在app.py也被使用


send_img_path = {"value": ""}
Expand Down Expand Up @@ -746,7 +747,7 @@ def index_bd():
return Response(content=content, media_type="text/html")
return FileResponse(index_html_path)

static_dir = f"{cwd}/vue/dist"
static_dir = get_data_file_path("vue/dist") if is_exe_ver else f"{cwd}/vue/dist"
@app.get(api_base + "/fe-static/{file_path:path}")
async def serve_static_file(file_path: str):
file_full_path = f"{static_dir}/{file_path}"
Expand Down
2 changes: 2 additions & 0 deletions scripts/iib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from scripts.iib.tool import cwd

def load_plugins(plugin_dir):
if not os.path.exists(plugin_dir):
return []
plugins = []
for filename in os.listdir(plugin_dir):
main_module_path = os.path.join(plugin_dir, filename, 'main.py')
Expand Down
12 changes: 11 additions & 1 deletion scripts/iib/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,4 +723,14 @@ def get_frame_at_second(video_path, second):

container.seek(frame_container_pts, backward=True, stream=container.streams.video[0])
frame = next(container.decode(video=0))
return frame
return frame

def get_data_file_path(filename):
if hasattr(sys, '_MEIPASS'):
# Running in a PyInstaller bundle
base_path = os.path.join(sys._MEIPASS)
else:
# Running in a normal Python environment
base_path = os.path.join(os.path.dirname(__file__))

return os.path.normpath(os.path.join(base_path, "../../", filename))
2 changes: 1 addition & 1 deletion vue/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "Infinite Image Browsing",
"version": "1.0.0"
"version": "1.1.0"
},
"tauri": {
"allowlist": {
Expand Down
Loading