Skip to content

Commit

Permalink
Merge pull request #515 from EstrellaXD/3.1-dev
Browse files Browse the repository at this point in the history
3.1.5
  • Loading branch information
EstrellaXD authored Oct 4, 2023
2 parents 354dc8f + 53bd85f commit 47ad299
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 7 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Download artifact
- name: Download artifact webui
uses: actions/download-artifact@v3
with:
name: dist
Expand All @@ -236,6 +236,22 @@ jobs:
run: |
cd webui && ls -al && tree && zip -r dist.zip dist
- name: Download artifact app
uses: actions/download-artifact@v3
with:
name: dist
path: backend/src/dist

- name: Create Version info via tag
working-directory: ./backend/src
run: |
echo ${{ needs.version-info.outputs.version }}
echo "VERSION='${{ needs.version-info.outputs.version }}'" >> module/__version__.py
- name: Zip app
run: |
cd backend && zip -r app-v${{ needs.version-info.outputs.version }}.zip src
- name: Generate Release info
id: release-info
run: |
Expand All @@ -257,6 +273,7 @@ jobs:
prerelease: ${{ steps.release-info.outputs.pre_release == 'true' }}
files: |
webui/dist.zip
backend/app-v${{ needs.version-info.outputs.version }}.zip
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ COPY backend/requirements.txt .
RUN set -ex && \
apk add --no-cache \
bash \
busybox-suid \
python3 \
py3-aiohttp \
py3-bcrypt \
py3-pip \
py3-aiohttp \
su-exec \
shadow \
tini \
Expand Down
3 changes: 3 additions & 0 deletions backend/src/module/network/request_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def post_json(self, _url, data: dict) -> dict:
def post_data(self, _url, data: dict) -> dict:
return self.post_url(_url, data)

def post_form(self, _url, data: dict, files: dict) -> dict:
return self.post_form(_url, data, files)

def get_html(self, _url):
return self.get_url(_url).text

Expand Down
4 changes: 2 additions & 2 deletions backend/src/module/network/request_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def check_url(self, url: str):
logger.debug(f"[Network] Cannot connect to {url}.")
return False

def post_form(self, url: str, data: dict):
def post_form(self, url: str, data: dict, files):
try:
req = self.session.post(
url=url, headers=self.header, data=data, timeout=5
url=url, headers=self.header, data=data, files=files, timeout=5
)
req.raise_for_status()
return req
Expand Down
10 changes: 8 additions & 2 deletions backend/src/module/notification/plugin/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from module.models import Notification
from module.network import RequestContent
from module.utils import load_image

logger = logging.getLogger(__name__)

Expand All @@ -24,9 +25,14 @@ def post_msg(self, notify: Notification) -> bool:
data = {
"chat_id": self.chat_id,
"caption": text,
"photo": notify.poster_path,
"disable_notification": True,
}
resp = self.post_data(self.notification_url, data)
photo = load_image(notify.poster_path)
if photo:
resp = self.post_form(
self.notification_url, data, files={"photo": photo}
)
else:
resp = self.post_data(self.notification_url, data)
logger.debug(f"Telegram notification: {resp.status_code}")
return resp.status_code == 200
2 changes: 1 addition & 1 deletion backend/src/module/utils/cache_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ def save_image(img, suffix):


def load_image(img_path):
with open(f"data/images/{img_path}", "rb") as f:
with open(f"data/{img_path}", "rb") as f:
return f.read()
30 changes: 30 additions & 0 deletions docs/resource/unraid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>

<Container version="2">
<Name Default="AutoBangumi">AutoBangumi</Name>
<Repository>estrellaxd/auto_bangumi:latest</Repository>
<Registry>https://registry.hub.docker.com/r/estrellaxd/auto_bangumi</Registry>
<Network Default="bridge">bridge</Network>
<Category>MediaServer:Video Tools Productivity</Category>
<MyIP/>
<Shell>sh</Shell>
<Privileged>false</Privileged>
<Support>https://github.com/EstrellaXD/Auto_Bangumi/issues</Support>
<Project/>
<Overview>
AutoBangumi 是基于 Mikan Project、qBittorrent 的全自动追番整理下载工具。只需要在 Mikan Project 上订阅番剧,就可以全自动追番。并且整理完成的名称和目录可以直接被 Plex、Jellyfin 等媒体库软件识别,无需二次刮削。
</Overview>
<Category/>
<WebUI>http://[IP]:[PORT:7892]/</WebUI>
<TemplateURL/>
<Icon>https://quantil.jsdelivr.net/gh/9bingyin/static@main/images/AutoBangumi.png</Icon>
<ExtraParams>--dns 8.8.8.8 --dns 223.5.5.5</ExtraParams>
<PostArgs/>
<CPUset/>
<DonateText/>
<DonateLink/>
<Requires/>
<Config Name="WebUI" Target="7892" Default="7892" Mode="tcp" Description="" Type="Port" Display="always" Required="false" Mask="false">7892</Config>
<Config Name="Config" Target="/app/config" Default="" Mode="rw" Description="" Type="Path" Display="always" Required="false" Mask="false">/mnt/user/appdata/AutoBangumi/config</Config>
<Config Name="Data" Target="/app/data" Default="" Mode="rw" Description="" Type="Path" Display="always" Required="false" Mask="false">/mnt/user/appdata/AutoBangumi/data</Config>
</Container>

0 comments on commit 47ad299

Please sign in to comment.