Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
joeblow25 committed Feb 13, 2024
1 parent b47ca30 commit ad20734
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 76 deletions.
60 changes: 0 additions & 60 deletions plugins/rsync-library/main.py

This file was deleted.

4 changes: 2 additions & 2 deletions plugins/tv_calendar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from plugins.tv_calendar.event import *
from plugins.tv_calendar.command import *
from .event import *
from .command import *
4 changes: 3 additions & 1 deletion plugins/tv_calendar/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from mbot.openapi import mbot_api
import logging

from plugins.tv_calendar.event import save_json, change_banner
from .event import save_json
from .event import push_message
from .event import change_banner

server = mbot_api
_LOGGER = logging.getLogger(__name__)
Expand Down
28 changes: 16 additions & 12 deletions plugins/tv_calendar/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,7 @@ def on_subscribe_new_media(ctx: PluginContext, event_type: str, data: Dict):
@plugin.task('tv_calendar_save_json', '剧集更新', cron_expression='10 0 * * *')
def task():
# 怕并发太高,衣总服务器撑不住
time.sleep(random.randint(1, 3600))
save_json()


@plugin.task('tv_calendar_save_json', '剧集更新', cron_expression='10 0 * * *')
def task():
# 怕并发太高,衣总服务器撑不住
time.sleep(random.randint(1, 3600))
time.sleep(random.randint(1, 7200))
save_json()


Expand Down Expand Up @@ -260,8 +253,13 @@ def get_date_timestamp(air_date):


def get_tmdb_info(tv_id, season_number):
return server.tmdb.request_api(api_url % {'tv_id': tv_id, 'season_number': season_number}, param)

for i in range(5):
try:
return server.tmdb.request_api(api_url % {'tv_id': tv_id, 'season_number': season_number}, param)
except:
time.sleep(5)
continue
return None;

def get_after_day(day, n):
offset = datetime.timedelta(days=n)
Expand All @@ -270,7 +268,13 @@ def get_after_day(day, n):


def get_tv_info(tv_id):
return server.tmdb.request_api(tv_api_url % {'tv_id': tv_id}, param)
for i in range(5):
try:
return server.tmdb.request_api(tv_api_url % {'tv_id': tv_id}, param)
except:
time.sleep(5)
continue
return None;


def find_season_poster(seasons, season_number):
Expand Down Expand Up @@ -438,7 +442,7 @@ def grab_ssd_banner(cookies, ua):


def save_web_img(url, path, ua):
headers = {'Referer': "https://springsunday.net"}
headers = {}
if ua:
headers['User-Agent'] = ua
res = requests.get(url, headers=headers)
Expand Down
2 changes: 1 addition & 1 deletion plugins/tv_calendar/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "oreki",
"description": "每日更新推送;追剧日历",
"_comment_start": "x-release-please-start-version",
"version": "1.3.4",
"version": "1.3.5",
"_comment_end": "x-release-please-end",
"requirements": [],
"configField": [
Expand Down

0 comments on commit ad20734

Please sign in to comment.