index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36,877 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/plugindata.py | 32,35 | 7,37 | get_plugin_data_by_plugin_id | PluginData | 35,37 | 35,37 | class PluginData(Base):
"""
插件数据表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
plugin_id = Column(String, nullable=False, index=True)
key = Column(String, index=True, nullable=False)
value = Column(String)
@staticmethod
@db_query
def get_plugin_data(db:... | class PluginData(Base):
"""
插件数据表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
plugin_id = Column(String, nullable=False, index=True)
key = Column(String, index=True, nullable=False)
value = Column(String)
@staticmethod
@db_query
def get_plugin_data(db:... | result = db.query(PluginData).filter(PluginData.plugin_id == plugin_id).all()
return list(result)
| result = db.query(PluginData).filter(PluginData.plugin_id == plugin_id).all()
return list(result)
| 7 | 342 | 35 | 377 | from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class PluginData(Base):
"""
插件数据表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
plugin_id = Column(String, nullable=False, index=True)
... | from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class PluginData(Base):
"""
插件数据表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
plugin_id = Column(String, nullable=False, index=True)
... |
36,878 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/site.py | 53,56 | 9,74 | get_by_domain | Site | 56,58 | 56,58 | class Site(Base):
"""
站点表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名
name = Column(String, nullable=False)
# 域名Key
domain = Column(String, index=True)
# 站点地址
url = Column(String, nullable=False)
# 站点优先级
pri = Column(Integer, default=1)
... | class Site(Base):
"""
站点表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名
name = Column(String, nullable=False)
# 域名Key
domain = Column(String, index=True)
# 站点地址
url = Column(String, nullable=False)
# 站点优先级
pri = Column(Integer, default=1)
... | return db.query(Site).filter(Site.domain == domain).first()
| return db.query(Site).filter(Site.domain == domain).first()
| 4 | 588 | 22 | 610 | from datetime import datetime
from sqlalchemy import Boolean, Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class Site(Base):
"""
站点表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名
name = Column... | from datetime import datetime
from sqlalchemy import Boolean, Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class Site(Base):
"""
站点表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名
name = Column... |
36,879 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/siteicon.py | 21,24 | 7,25 | get_by_domain | SiteIcon | 24,25 | 24,25 | class SiteIcon(Base):
"""
站点图标表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名称
name = Column(String, nullable=False)
# 域名Key
domain = Column(String, index=True)
# 图标地址
url = Column(String, nullable=False)
# 图标Base64
base64 = Column(String)
... | class SiteIcon(Base):
"""
站点图标表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名称
name = Column(String, nullable=False)
# 域名Key
domain = Column(String, index=True)
# 图标地址
url = Column(String, nullable=False)
# 图标Base64
base64 = Column(String)
... | return db.query(SiteIcon).filter(SiteIcon.domain == domain).first()
| return db.query(SiteIcon).filter(SiteIcon.domain == domain).first()
| 4 | 162 | 22 | 184 | from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, Base
class SiteIcon(Base):
"""
站点图标表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名称
name = Column(String, nullable=False)
# 域名Key
dom... | from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, Base
class SiteIcon(Base):
"""
站点图标表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 站点名称
name = Column(String, nullable=False)
# 域名Key
dom... |
36,880 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/sitestatistic.py | 29,32 | 9,38 | get_by_domain | SiteStatistic | 32,34 | 32,34 | class SiteStatistic(Base):
"""
站点统计表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 域名Key
domain = Column(String, index=True)
# 成功次数
success = Column(Integer)
# 失败次数
fail = Column(Integer)
# 平均耗时 秒
seconds = Column(Integer)
# 最后一次访问状态 0-成功 1-... | class SiteStatistic(Base):
"""
站点统计表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 域名Key
domain = Column(String, index=True)
# 成功次数
success = Column(Integer)
# 失败次数
fail = Column(Integer)
# 平均耗时 秒
seconds = Column(Integer)
# 最后一次访问状态 0-成功 1-... | return db.query(SiteStatistic).filter(SiteStatistic.domain == domain).first()
| return db.query(SiteStatistic).filter(SiteStatistic.domain == domain).first()
| 4 | 272 | 26 | 298 | from datetime import datetime
from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class SiteStatistic(Base):
"""
站点统计表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 域名Key
domain = ... | from datetime import datetime
from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class SiteStatistic(Base):
"""
站点统计表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 域名Key
domain = ... |
36,881 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/subscribe.py | 138,141 | 9,166 | list_by_username | Subscribe | 141,157 | 141,157 | class Subscribe(Base):
"""
订阅表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullable=False, index=True)
# 年份
year = Column(String)
# 类型
type = Column(String)
# 搜索关键字
keyword = Column(String)
tmdbid = Column(Integer,... | class Subscribe(Base):
"""
订阅表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullable=False, index=True)
# 年份
year = Column(String)
# 类型
type = Column(String)
# 搜索关键字
keyword = Column(String)
tmdbid = Column(Integer,... | if mtype:
if state:
result = db.query(Subscribe).filter(Subscribe.state == state,
Subscribe.username == username,
Subscribe.type == mtype).all()
else:
r... | if mtype:
if state:
result = db.query(Subscribe).filter(Subscribe.state == state,
Subscribe.username == username,
Subscribe.type == mtype).all()
else:
r... | 43 | 1,513 | 182 | 1,695 | import time
from sqlalchemy import Column, Integer, String, Sequence, Float
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class Subscribe(Base):
"""
订阅表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullabl... | import time
from sqlalchemy import Column, Integer, String, Sequence, Float
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class Subscribe(Base):
"""
订阅表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullabl... |
36,882 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/subscribehistory.py | 64,67 | 7,73 | list_by_type | SubscribeHistory | 67,73 | 67,73 | class SubscribeHistory(Base):
"""
订阅历史表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullable=False, index=True)
# 年份
year = Column(String)
# 类型
type = Column(String)
# 搜索关键字
keyword = Column(String)
tmdbid = Column... | class SubscribeHistory(Base):
"""
订阅历史表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullable=False, index=True)
# 年份
year = Column(String)
# 类型
type = Column(String)
# 搜索关键字
keyword = Column(String)
tmdbid = Column... | result = db.query(SubscribeHistory).filter(
SubscribeHistory.type == mtype
).order_by(
SubscribeHistory.date.desc()
).offset((page - 1) * count).limit(count).all()
return list(result)
| result = db.query(SubscribeHistory).filter(
SubscribeHistory.type == mtype
).order_by(
SubscribeHistory.date.desc()
).offset((page - 1) * count).limit(count).all()
return list(result)
| 15 | 533 | 73 | 606 | from sqlalchemy import Column, Integer, String, Sequence, Float
from sqlalchemy.orm import Session
from app.db import db_query, Base
class SubscribeHistory(Base):
"""
订阅历史表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullable=False, index=... | from sqlalchemy import Column, Integer, String, Sequence, Float
from sqlalchemy.orm import Session
from app.db import db_query, Base
class SubscribeHistory(Base):
"""
订阅历史表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 标题
name = Column(String, nullable=False, index=... |
36,883 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/systemconfig.py | 17,20 | 7,28 | get_by_key | SystemConfig | 20,22 | 20,22 | class SystemConfig(Base):
"""
配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 主键
key = Column(String, index=True)
# 值
value = Column(String, nullable=True)
@staticmethod
@db_query
def get_by_key(db: Session, key: str):
FILL_FUNC_BODY @db_updat... | class SystemConfig(Base):
"""
配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 主键
key = Column(String, index=True)
# 值
value = Column(String, nullable=True)
@staticmethod
@db_query
def get_by_key(db: Session, key: str):
FILL_FUNC_BODY @db_updat... | return db.query(SystemConfig).filter(SystemConfig.key == key).first()
| return db.query(SystemConfig).filter(SystemConfig.key == key).first()
| 4 | 182 | 24 | 206 | from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class SystemConfig(Base):
"""
配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 主键
key = Column(String, index=True)
# 值
v... | from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class SystemConfig(Base):
"""
配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 主键
key = Column(String, index=True)
# 值
v... |
36,884 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/models/userconfig.py | 25,28 | 7,39 | get_by_key | UserConfig | 28,33 | 28,33 | class UserConfig(Base):
"""
用户配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 用户名
username = Column(String, index=True)
# 配置键
key = Column(String)
# 值
value = Column(String, nullable=True)
__table_args__ = (
# 用户名和配置键联合唯一
UniqueCo... | class UserConfig(Base):
"""
用户配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 用户名
username = Column(String, index=True)
# 配置键
key = Column(String)
# 值
value = Column(String, nullable=True)
__table_args__ = (
# 用户名和配置键联合唯一
UniqueCo... | return db.query(UserConfig) \
.filter(UserConfig.username == username) \
.filter(UserConfig.key == key) \
.first()
| return db.query(UserConfig) \
.filter(UserConfig.username == username) \
.filter(UserConfig.key == key) \
.first()
| 12 | 271 | 48 | 319 | from sqlalchemy import Column, Integer, String, Sequence, UniqueConstraint, Index
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class UserConfig(Base):
"""
用户配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 用户名
username = Column(St... | from sqlalchemy import Column, Integer, String, Sequence, UniqueConstraint, Index
from sqlalchemy.orm import Session
from app.db import db_query, db_update, Base
class UserConfig(Base):
"""
用户配置表
"""
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 用户名
username = Column(St... |
36,885 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/plugindata_oper.py | 31,32 | 9,67 | get_data | PluginDataOper | 37,47 | 32,47 | class PluginDataOper(DbOper):
"""
插件数据管理
"""
def save(self, plugin_id: str, key: str, value: Any):
"""
保存插件数据
:param plugin_id: 插件id
:param key: 数据key
:param value: 数据值
"""
if ObjectUtils.is_obj(value):
value = json.dumps(value)
... | class PluginDataOper(DbOper):
"""
插件数据管理
"""
def save(self, plugin_id: str, key: str, value: Any):
"""
保存插件数据
:param plugin_id: 插件id
:param key: 数据key
:param value: 数据值
"""
if ObjectUtils.is_obj(value):
value = json.dumps(value)
... | if key:
data = PluginData.get_plugin_data_by_key(self._db, plugin_id, key)
if not data:
return None
if ObjectUtils.is_obj(data.value):
return json.loads(data.value)
return data.value
else:
return PluginData.get_p... | """
获取插件数据
:param plugin_id: 插件id
:param key: 数据key
"""
if key:
data = PluginData.get_plugin_data_by_key(self._db, plugin_id, key)
if not data:
return None
if ObjectUtils.is_obj(data.value):
return json.l... | 22 | 463 | 111 | 574 | import json
from typing import Any
from app.db import DbOper
from app.db.models.plugindata import PluginData
from app.utils.object import ObjectUtils
class PluginDataOper(DbOper):
"""
插件数据管理
"""
def save(self, plugin_id: str, key: str, value: Any):
"""
保存插件数据
:param plugin_id... | import json
from typing import Any
from app.db import DbOper
from app.db.models.plugindata import PluginData
from app.utils.object import ObjectUtils
class PluginDataOper(DbOper):
"""
插件数据管理
"""
def save(self, plugin_id: str, key: str, value: Any):
"""
保存插件数据
:param plugin_id... |
36,886 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/site_oper.py | 84,85 | 7,95 | update_rss | SiteOper | 88,95 | 85,95 | class SiteOper(DbOper):
"""
站点管理
"""
def add(self, **kwargs) -> Tuple[bool, str]:
"""
新增站点
"""
site = Site(**kwargs)
if not site.get_by_domain(self._db, kwargs.get("domain")):
site.create(self._db)
return True, "新增站点成功"
return Fals... | class SiteOper(DbOper):
"""
站点管理
"""
def add(self, **kwargs) -> Tuple[bool, str]:
"""
新增站点
"""
site = Site(**kwargs)
if not site.get_by_domain(self._db, kwargs.get("domain")):
site.create(self._db)
return True, "新增站点成功"
return Fals... | site = Site.get_by_domain(self._db, domain)
if not site:
return False, "站点不存在"
site.update(self._db, {
"rss": rss
})
return True, "更新站点RSS地址成功"
| """
更新站点rss
"""
site = Site.get_by_domain(self._db, domain)
if not site:
return False, "站点不存在"
site.update(self._db, {
"rss": rss
})
return True, "更新站点RSS地址成功"
| 18 | 669 | 78 | 747 | from typing import Tuple, List
from app.db import DbOper
from app.db.models.site import Site
class SiteOper(DbOper):
"""
站点管理
"""
def add(self, **kwargs) -> Tuple[bool, str]:
"""
新增站点
"""
site = Site(**kwargs)
if not site.get_by_domain(self._db, kwargs.get("do... | from typing import Tuple, List
from app.db import DbOper
from app.db.models.site import Site
class SiteOper(DbOper):
"""
站点管理
"""
def add(self, **kwargs) -> Tuple[bool, str]:
"""
新增站点
"""
site = Site(**kwargs)
if not site.get_by_domain(self._db, kwargs.get("do... |
36,887 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/siteicon_oper.py | 24,25 | 7,38 | update_icon | SiteIconOper | 28,38 | 25,38 | class SiteIconOper(DbOper):
"""
站点管理
"""
def list(self) -> List[SiteIcon]:
"""
获取站点图标列表
"""
return SiteIcon.list(self._db)
def get_by_domain(self, domain: str) -> SiteIcon:
"""
按域名获取站点图标
"""
return SiteIcon.get_by_domain(self._db, dom... | class SiteIconOper(DbOper):
"""
站点管理
"""
def list(self) -> List[SiteIcon]:
"""
获取站点图标列表
"""
return SiteIcon.list(self._db)
def get_by_domain(self, domain: str) -> SiteIcon:
"""
按域名获取站点图标
"""
return SiteIcon.get_by_domain(self._db, dom... | icon_base64 = f"data:image/ico;base64,{icon_base64}" if icon_base64 else ""
siteicon = self.get_by_domain(domain)
if not siteicon:
SiteIcon(name=name, domain=domain, url=icon_url, base64=icon_base64).create(self._db)
elif icon_base64:
siteicon.update(self._db, {
... | """
更新站点图标
"""
icon_base64 = f"data:image/ico;base64,{icon_base64}" if icon_base64 else ""
siteicon = self.get_by_domain(domain)
if not siteicon:
SiteIcon(name=name, domain=domain, url=icon_url, base64=icon_base64).create(self._db)
elif icon_base64:
... | 28 | 180 | 151 | 331 | from typing import List
from app.db import DbOper
from app.db.models.siteicon import SiteIcon
class SiteIconOper(DbOper):
"""
站点管理
"""
def list(self) -> List[SiteIcon]:
"""
获取站点图标列表
"""
return SiteIcon.list(self._db)
def get_by_domain(self, domain: str) -> SiteIc... | from typing import List
from app.db import DbOper
from app.db.models.siteicon import SiteIcon
class SiteIconOper(DbOper):
"""
站点管理
"""
def list(self) -> List[SiteIcon]:
"""
获取站点图标列表
"""
return SiteIcon.list(self._db)
def get_by_domain(self, domain: str) -> SiteIc... |
36,888 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/sitestatistic_oper.py | 13,14 | 8,71 | success | SiteStatisticOper | 17,51 | 14,51 | class SiteStatisticOper(DbOper):
"""
站点统计管理
"""
def success(self, domain: str, seconds: int = None):
FILL_FUNC_BODY def fail(self, domain: str):
"""
站点访问失败
"""
lst_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
sta = SiteStatistic.get_by_domain(self._db, ... | class SiteStatisticOper(DbOper):
"""
站点统计管理
"""
def success(self, domain: str, seconds: int = None):
"""
站点访问成功
"""
FILL_FUNC_BODY def fail(self, domain: str):
"""
站点访问失败
"""
lst_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
sta =... | lst_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
sta = SiteStatistic.get_by_domain(self._db, domain)
if sta:
avg_seconds, note = None, {}
if seconds is not None:
note: dict = json.loads(sta.note or "{}")
note[lst_date] = seconds or 1... | """
站点访问成功
"""
lst_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
sta = SiteStatistic.get_by_domain(self._db, domain)
if sta:
avg_seconds, note = None, {}
if seconds is not None:
note: dict = json.loads(sta.note or "{}")
... | 103 | 259 | 421 | 680 | import json
from datetime import datetime
from app.db import DbOper
from app.db.models.sitestatistic import SiteStatistic
class SiteStatisticOper(DbOper):
"""
站点统计管理
"""
def success(self, domain: str, seconds: int = None):
FILL_FUNC_BODY def fail(self, domain: str):
"""
站点访问失败
... | import json
from datetime import datetime
from app.db import DbOper
from app.db.models.sitestatistic import SiteStatistic
class SiteStatisticOper(DbOper):
"""
站点统计管理
"""
def success(self, domain: str, seconds: int = None):
"""
站点访问成功
"""
FILL_FUNC_BODY def fail(self, domai... |
36,889 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/subscribe_oper.py | 51,52 | 10,109 | exists | SubscribeOper | 55,64 | 52,64 | class SubscribeOper(DbOper):
"""
订阅管理
"""
def add(self, mediainfo: MediaInfo, **kwargs) -> Tuple[int, str]:
"""
新增订阅
"""
subscribe = Subscribe.exists(self._db,
tmdbid=mediainfo.tmdb_id,
doubanid=me... | class SubscribeOper(DbOper):
"""
订阅管理
"""
def add(self, mediainfo: MediaInfo, **kwargs) -> Tuple[int, str]:
"""
新增订阅
"""
subscribe = Subscribe.exists(self._db,
tmdbid=mediainfo.tmdb_id,
doubanid=me... | if tmdbid:
if season:
return True if Subscribe.exists(self._db, tmdbid=tmdbid, season=season) else False
else:
return True if Subscribe.exists(self._db, tmdbid=tmdbid) else False
elif doubanid:
return True if Subscribe.exists(self._db, ... | """
判断是否存在
"""
if tmdbid:
if season:
return True if Subscribe.exists(self._db, tmdbid=tmdbid, season=season) else False
else:
return True if Subscribe.exists(self._db, tmdbid=tmdbid) else False
elif doubanid:
ret... | 31 | 995 | 117 | 1,112 | import json
import time
from typing import Tuple, List
from app.core.context import MediaInfo
from app.db import DbOper
from app.db.models.subscribe import Subscribe
class SubscribeOper(DbOper):
"""
订阅管理
"""
def add(self, mediainfo: MediaInfo, **kwargs) -> Tuple[int, str]:
"""
新增订阅
... | import json
import time
from typing import Tuple, List
from app.core.context import MediaInfo
from app.db import DbOper
from app.db.models.subscribe import Subscribe
class SubscribeOper(DbOper):
"""
订阅管理
"""
def add(self, mediainfo: MediaInfo, **kwargs) -> Tuple[int, str]:
"""
新增订阅
... |
36,890 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/subscribehistory_oper.py | 12,13 | 7,31 | add | SubscribeHistoryOper | 16,26 | 13,26 | class SubscribeHistoryOper(DbOper):
"""
订阅历史管理
"""
def add(self, **kwargs):
FILL_FUNC_BODY def list_by_type(self, mtype: str, page: int = 1, count: int = 30) -> SubscribeHistory:
"""
获取指定类型的订阅
"""
return SubscribeHistory.list_by_type(self._db, mtype=mtype, page=page, ... | class SubscribeHistoryOper(DbOper):
"""
订阅历史管理
"""
def add(self, **kwargs):
"""
新增订阅
"""
FILL_FUNC_BODY def list_by_type(self, mtype: str, page: int = 1, count: int = 30) -> SubscribeHistory:
"""
获取指定类型的订阅
"""
return SubscribeHistory.list_by_ty... | # 去除kwargs中 SubscribeHistory 没有的字段
kwargs = {k: v for k, v in kwargs.items() if hasattr(SubscribeHistory, k)}
# 更新完成订阅时间
kwargs.update({"date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())})
# 去掉主键
if "id" in kwargs:
kwargs.pop("id")
subscribe ... | """
新增订阅
"""
# 去除kwargs中 SubscribeHistory 没有的字段
kwargs = {k: v for k, v in kwargs.items() if hasattr(SubscribeHistory, k)}
# 更新完成订阅时间
kwargs.update({"date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())})
# 去掉主键
if "id" in kwargs:
... | 33 | 138 | 157 | 295 | import time
from app.db import DbOper
from app.db.models.subscribehistory import SubscribeHistory
class SubscribeHistoryOper(DbOper):
"""
订阅历史管理
"""
def add(self, **kwargs):
FILL_FUNC_BODY def list_by_type(self, mtype: str, page: int = 1, count: int = 30) -> SubscribeHistory:
"""
... | import time
from app.db import DbOper
from app.db.models.subscribehistory import SubscribeHistory
class SubscribeHistoryOper(DbOper):
"""
订阅历史管理
"""
def add(self, **kwargs):
"""
新增订阅
"""
FILL_FUNC_BODY def list_by_type(self, mtype: str, page: int = 1, count: int = 30) -> S... |
36,891 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/systemconfig_oper.py | 49,50 | 11,82 | get | SystemConfigOper | 53,59 | 50,59 | class SystemConfigOper(DbOper, metaclass=Singleton):
# 配置对象
__SYSTEMCONF: dict = {}
def __init__(self):
"""
加载配置到内存
"""
super().__init__()
for item in SystemConfig.list(self._db):
if ObjectUtils.is_obj(item.value):
self.__SYSTEMCONF[item.k... | class SystemConfigOper(DbOper, metaclass=Singleton):
# 配置对象
__SYSTEMCONF: dict = {}
def __init__(self):
"""
加载配置到内存
"""
super().__init__()
for item in SystemConfig.list(self._db):
if ObjectUtils.is_obj(item.value):
self.__SYSTEMCONF[item.k... | if isinstance(key, SystemConfigKey):
key = key.value
if not key:
return self.__SYSTEMCONF
return self.__SYSTEMCONF.get(key)
| """
获取系统设置
"""
if isinstance(key, SystemConfigKey):
key = key.value
if not key:
return self.__SYSTEMCONF
return self.__SYSTEMCONF.get(key)
| 13 | 569 | 55 | 624 | import json
from typing import Any, Union
from app.db import DbOper
from app.db.models.systemconfig import SystemConfig
from app.schemas.types import SystemConfigKey
from app.utils.object import ObjectUtils
from app.utils.singleton import Singleton
class SystemConfigOper(DbOper, metaclass=Singleton):
# 配置对象
... | import json
from typing import Any, Union
from app.db import DbOper
from app.db.models.systemconfig import SystemConfig
from app.schemas.types import SystemConfigKey
from app.utils.object import ObjectUtils
from app.utils.singleton import Singleton
class SystemConfigOper(DbOper, metaclass=Singleton):
# 配置对象
... |
36,892 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/transferhistory_oper.py | 115,118 | 13,187 | add_success | TransferHistoryOper | 121,141 | 118,141 | class TransferHistoryOper(DbOper):
"""
转移历史管理
"""
def get(self, historyid: int) -> TransferHistory:
"""
获取转移历史
:param historyid: 转移历史id
"""
return TransferHistory.get(self._db, historyid)
def get_by_title(self, title: str) -> List[TransferHistory]:
"... | class TransferHistoryOper(DbOper):
"""
转移历史管理
"""
def get(self, historyid: int) -> TransferHistory:
"""
获取转移历史
:param historyid: 转移历史id
"""
return TransferHistory.get(self._db, historyid)
def get_by_title(self, title: str) -> List[TransferHistory]:
"... | self.add_force(
src=str(src_path),
dest=str(transferinfo.target_path or ''),
mode=mode,
type=mediainfo.type.value,
category=mediainfo.category,
title=mediainfo.title,
year=mediainfo.year,
tmdbid=mediainfo.tmdb_id,
... | """
新增转移成功历史记录
"""
self.add_force(
src=str(src_path),
dest=str(transferinfo.target_path or ''),
mode=mode,
type=mediainfo.type.value,
category=mediainfo.category,
title=mediainfo.title,
year=mediainfo.yea... | 21 | 1,537 | 233 | 1,770 | import json
import time
from pathlib import Path
from typing import Any, List
from app.core.context import MediaInfo
from app.core.meta import MetaBase
from app.db import DbOper
from app.db.models.transferhistory import TransferHistory
from app.schemas import TransferInfo
class TransferHistoryOper(DbOper):
"""
... | import json
import time
from pathlib import Path
from typing import Any, List
from app.core.context import MediaInfo
from app.core.meta import MetaBase
from app.db import DbOper
from app.db.models.transferhistory import TransferHistory
from app.schemas import TransferInfo
class TransferHistoryOper(DbOper):
"""
... |
36,893 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/userauth.py | 28,31 | 1,36 | get_current_active_superuser | 31,36 | 31,36 | from fastapi import Depends, HTTPException
from sqlalchemy.orm import Session
from app import schemas
from app.core.security import verify_token
from app.db import get_db
from app.db.models.user import User
def get_current_user(
db: Session = Depends(get_db),
token_data: schemas.TokenPayload = Depend... | from fastapi import Depends, HTTPException
from sqlalchemy.orm import Session
from app import schemas
from app.core.security import verify_token
from app.db import get_db
from app.db.models.user import User
def get_current_user(
db: Session = Depends(get_db),
token_data: schemas.TokenPayload = Depend... | if not current_user.is_superuser:
raise HTTPException(
status_code=400, detail="用户权限不足"
)
return current_user
| if not current_user.is_superuser:
raise HTTPException(
status_code=400, detail="用户权限不足"
)
return current_user
| 10 | 273 | 51 | 324 | from fastapi import Depends, HTTPException
from sqlalchemy.orm import Session
from app import schemas
from app.core.security import verify_token
from app.db import get_db
from app.db.models.user import User
def get_current_user(
db: Session = Depends(get_db),
token_data: schemas.TokenPayload = Depend... | from fastapi import Depends, HTTPException
from sqlalchemy.orm import Session
from app import schemas
from app.core.security import verify_token
from app.db import get_db
from app.db.models.user import User
def get_current_user(
db: Session = Depends(get_db),
token_data: schemas.TokenPayload = Depend... | |
36,894 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/db/userconfig_oper.py | 87,88 | 11,97 | __get_config_cache | UserConfigOper | 91,97 | 88,97 | class UserConfigOper(DbOper, metaclass=Singleton):
# 配置缓存
__USERCONF: Dict[str, Dict[str, Any]] = {}
def __init__(self):
"""
加载配置到内存
"""
super().__init__()
for item in UserConfig.list(self._db):
value = json.loads(item.value) if ObjectUtils.is_obj(item.va... | class UserConfigOper(DbOper, metaclass=Singleton):
# 配置缓存
__USERCONF: Dict[str, Dict[str, Any]] = {}
def __init__(self):
"""
加载配置到内存
"""
super().__init__()
for item in UserConfig.list(self._db):
value = json.loads(item.value) if ObjectUtils.is_obj(item.va... | if not username or not key or not self.__USERCONF:
return None
user_cache = self.__get_config_caches(username)
if not user_cache:
return None
return user_cache.get(key)
| """
获取配置缓存
"""
if not username or not key or not self.__USERCONF:
return None
user_cache = self.__get_config_caches(username)
if not user_cache:
return None
return user_cache.get(key)
| 21 | 763 | 66 | 829 | import json
from typing import Any, Union, Dict, Optional
from app.db import DbOper
from app.db.models.userconfig import UserConfig
from app.schemas.types import UserConfigKey
from app.utils.object import ObjectUtils
from app.utils.singleton import Singleton
class UserConfigOper(DbOper, metaclass=Singleton):
# 配... | import json
from typing import Any, Union, Dict, Optional
from app.db import DbOper
from app.db.models.userconfig import UserConfig
from app.schemas.types import UserConfigKey
from app.utils.object import ObjectUtils
from app.utils.singleton import Singleton
class UserConfigOper(DbOper, metaclass=Singleton):
# 配... |
36,895 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/browser.py | 21,28 | 8,98 | action | PlaywrightHelper | 38,59 | 28,59 | class PlaywrightHelper:
def __init__(self, browser_type="chromium"):
self.browser_type = browser_type
@staticmethod
def __pass_cloudflare(url: str, page: Page) -> bool:
"""
尝试跳过cloudfare验证
"""
sync_stealth(page, pure=True)
page.goto(url)
return sync_c... | class PlaywrightHelper:
def __init__(self, browser_type="chromium"):
self.browser_type = browser_type
@staticmethod
def __pass_cloudflare(url: str, page: Page) -> bool:
"""
尝试跳过cloudfare验证
"""
sync_stealth(page, pure=True)
page.goto(url)
return sync_c... | try:
with sync_playwright() as playwright:
browser = playwright[self.browser_type].launch(headless=headless)
context = browser.new_context(user_agent=ua, proxy=proxies)
page = context.new_page()
if cookies:
page.set_... | """
访问网页,接收Page对象并执行操作
:param url: 网页地址
:param callback: 回调函数,需要接收page对象
:param cookies: cookies
:param ua: user-agent
:param proxies: 代理
:param headless: 是否无头模式
:param timeout: 超时时间
"""
try:
with sync_playwright() as pl... | 51 | 676 | 258 | 934 | from typing import Callable, Any
from playwright.sync_api import sync_playwright, Page
from cf_clearance import sync_cf_retry, sync_stealth
from app.log import logger
class PlaywrightHelper:
def __init__(self, browser_type="chromium"):
self.browser_type = browser_type
@staticmethod
def __pass_cl... | from typing import Callable, Any
from playwright.sync_api import sync_playwright, Page
from cf_clearance import sync_cf_retry, sync_stealth
from app.log import logger
class PlaywrightHelper:
def __init__(self, browser_type="chromium"):
self.browser_type = browser_type
@staticmethod
def __pass_cl... |
36,896 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/cloudflare.py | 26,27 | 1,45 | under_challenge | 32,45 | 27,45 | import os
from pyquery import PyQuery
from app.log import logger
CHALLENGE_TITLES = [
# Cloudflare
'Just a moment...',
'请稍候…',
# DDoS-GUARD
'DDOS-GUARD',
]
CHALLENGE_SELECTORS = [
# Cloudflare
'#cf-challenge-running', '.ray_id', '.attack-box', '#cf-please-wait', '#challenge-spinner', '#tr... | import os
from pyquery import PyQuery
from app.log import logger
CHALLENGE_TITLES = [
# Cloudflare
'Just a moment...',
'请稍候…',
# DDoS-GUARD
'DDOS-GUARD',
]
CHALLENGE_SELECTORS = [
# Cloudflare
'#cf-challenge-running', '.ray_id', '.attack-box', '#cf-please-wait', '#challenge-spinner', '#tr... | # get the page title
if not html_text:
return False
page_title = PyQuery(html_text)('title').text()
logger.debug("under_challenge page_title=" + page_title)
for title in CHALLENGE_TITLES:
if page_title.lower() == title.lower():
return True
for selector in CHALLENGE_SE... | """
Check if the page is under challenge
:param html_text:
:return:
"""
# get the page title
if not html_text:
return False
page_title = PyQuery(html_text)('title').text()
logger.debug("under_challenge page_title=" + page_title)
for title in CHALLENGE_TITLES:
if p... | 40 | 301 | 148 | 449 | import os
from pyquery import PyQuery
from app.log import logger
CHALLENGE_TITLES = [
# Cloudflare
'Just a moment...',
'请稍候…',
# DDoS-GUARD
'DDOS-GUARD',
]
CHALLENGE_SELECTORS = [
# Cloudflare
'#cf-challenge-running', '.ray_id', '.attack-box', '#cf-please-wait', '#challenge-spinner', '#tr... | import os
from pyquery import PyQuery
from app.log import logger
CHALLENGE_TITLES = [
# Cloudflare
'Just a moment...',
'请稍候…',
# DDoS-GUARD
'DDOS-GUARD',
]
CHALLENGE_SELECTORS = [
# Cloudflare
'#cf-challenge-running', '.ray_id', '.attack-box', '#cf-please-wait', '#challenge-spinner', '#tr... | |
36,898 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/cookiecloud.py | 25,26 | 11,127 | download | CookieCloudHelper | 30,108 | 26,108 | class CookieCloudHelper:
_ignore_cookies: list = ["CookieAutoDeleteBrowsingDataCleanup", "CookieAutoDeleteCleaningDiscarded"]
def __init__(self):
self._sync_setting()
self._req = RequestUtils(content_type="application/json")
def _sync_setting(self):
self._server = settings.COOKIECL... | class CookieCloudHelper:
_ignore_cookies: list = ["CookieAutoDeleteBrowsingDataCleanup", "CookieAutoDeleteCleaningDiscarded"]
def __init__(self):
self._sync_setting()
self._req = RequestUtils(content_type="application/json")
def _sync_setting(self):
self._server = settings.COOKIECL... | # 更新为最新设置
self._sync_setting()
if ((not self._server and not self._enable_local)
or not self._key
or not self._password):
return None, "CookieCloud参数不正确"
if self._enable_local:
# 开启本地服务时,从本地直接读取数据
result = self._load_l... | """
从CookieCloud下载数据
:return: Cookie数据、错误信息
"""
# 更新为最新设置
self._sync_setting()
if ((not self._server and not self._enable_local)
or not self._key
or not self._password):
return None, "CookieCloud参数不正确"
if self.... | 203 | 474 | 930 | 1,404 | import json
from hashlib import md5
from typing import Any, Dict, Tuple, Optional
from app.core.config import settings
from app.utils.common import decrypt
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
class CookieCloudHelper:
_ignore_cookies: list = ["CookieAutoDeleteBrowsingD... | import json
from hashlib import md5
from typing import Any, Dict, Tuple, Optional
from app.core.config import settings
from app.utils.common import decrypt
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
class CookieCloudHelper:
_ignore_cookies: list = ["CookieAutoDeleteBrowsingD... |
36,899 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/display.py | 20,21 | 8,23 | stop | DisplayHelper | 21,23 | 21,23 | class DisplayHelper(metaclass=Singleton):
_display: Display = None
def __init__(self):
if not SystemUtils.is_docker():
return
try:
self._display = Display(visible=False, size=(1024, 768))
self._display.start()
except Exception as err:
logg... | class DisplayHelper(metaclass=Singleton):
_display: Display = None
def __init__(self):
if not SystemUtils.is_docker():
return
try:
self._display = Display(visible=False, size=(1024, 768))
self._display.start()
except Exception as err:
logg... | if self._display:
self._display.stop()
| if self._display:
self._display.stop()
| 3 | 124 | 17 | 141 | from pyvirtualdisplay import Display
from app.log import logger
from app.utils.singleton import Singleton
from app.utils.system import SystemUtils
class DisplayHelper(metaclass=Singleton):
_display: Display = None
def __init__(self):
if not SystemUtils.is_docker():
return
try:
... | from pyvirtualdisplay import Display
from app.log import logger
from app.utils.singleton import Singleton
from app.utils.system import SystemUtils
class DisplayHelper(metaclass=Singleton):
_display: Display = None
def __init__(self):
if not SystemUtils.is_docker():
return
try:
... |
36,900 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/format.py | 90,91 | 7,109 | __handle_single | FormatParser | 94,109 | 91,109 | class FormatParser(object):
_key = ""
_split_chars = r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~"
def __init__(self, eformat: str, details: str = None, part: str = None,
offset: int = None, key: str = "ep"):
"""
:params eformat: 格式化字符串
:params details: 格式化详情
... | class FormatParser(object):
_key = ""
_split_chars = r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~"
def __init__(self, eformat: str, details: str = None, part: str = None,
offset: int = None, key: str = "ep"):
"""
:params eformat: 格式化字符串
:params details: 格式化详情
... | if not self._format:
return None, None
ret = parse.parse(self._format, file)
if not ret or not ret.__contains__(self._key):
return None, None
episodes = ret.__getitem__(self._key)
if not re.compile(r"^(EP)?(\d{1,4})(-(EP)?(\d{1,4}))?$", re.IGNORECASE).matc... | """
处理单集,返回单集的开始和结束集数
"""
if not self._format:
return None, None
ret = parse.parse(self._format, file)
if not ret or not ret.__contains__(self._key):
return None, None
episodes = ret.__getitem__(self._key)
if not re.compile(r"^(EP)?... | 57 | 902 | 338 | 1,240 | import re
from typing import Tuple, Optional
import parse
class FormatParser(object):
_key = ""
_split_chars = r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~"
def __init__(self, eformat: str, details: str = None, part: str = None,
offset: int = None, key: str = "ep"):
"""
... | import re
from typing import Tuple, Optional
import parse
class FormatParser(object):
_key = ""
_split_chars = r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~"
def __init__(self, eformat: str, details: str = None, part: str = None,
offset: int = None, key: str = "ep"):
"""
... |
36,901 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/message.py | 35,36 | 9,47 | get | MessageHelper | 40,47 | 36,47 | class MessageHelper(metaclass=Singleton):
"""
消息队列管理器,包括系统消息和用户消息
"""
def __init__(self):
self.sys_queue = queue.Queue()
self.user_queue = queue.Queue()
def put(self, message: Any, role: str = "sys", note: Union[list, dict] = None):
"""
存消息
:param message: 消息... | class MessageHelper(metaclass=Singleton):
"""
消息队列管理器,包括系统消息和用户消息
"""
def __init__(self):
self.sys_queue = queue.Queue()
self.user_queue = queue.Queue()
def put(self, message: Any, role: str = "sys", note: Union[list, dict] = None):
"""
存消息
:param message: 消息... | if role == "sys":
if not self.sys_queue.empty():
return self.sys_queue.get(block=False)
else:
if not self.user_queue.empty():
return self.user_queue.get(block=False)
return None
| """
取消息
:param role: 消息通道 sys/user
"""
if role == "sys":
if not self.sys_queue.empty():
return self.sys_queue.get(block=False)
else:
if not self.user_queue.empty():
return self.user_queue.get(block=False)
ret... | 17 | 330 | 77 | 407 | import json
import queue
import time
from typing import Optional, Any, Union
from app.utils.singleton import Singleton
class MessageHelper(metaclass=Singleton):
"""
消息队列管理器,包括系统消息和用户消息
"""
def __init__(self):
self.sys_queue = queue.Queue()
self.user_queue = queue.Queue()
def put(... | import json
import queue
import time
from typing import Optional, Any, Union
from app.utils.singleton import Singleton
class MessageHelper(metaclass=Singleton):
"""
消息队列管理器,包括系统消息和用户消息
"""
def __init__(self):
self.sys_queue = queue.Queue()
self.user_queue = queue.Queue()
def put(... |
36,902 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/module.py | 15,17 | 10,56 | load | ModuleHelper | 23,43 | 17,43 | class ModuleHelper:
"""
模块动态加载
"""
@classmethod
def load(cls, package_path, filter_func=lambda name, obj: True):
FILL_FUNC_BODY @staticmethod
def dynamic_import_all_modules(base_path: Path, package_name: str):
"""
动态导入目录下所有模块
"""
modules = []
# 遍历文件夹,找... | class ModuleHelper:
"""
模块动态加载
"""
@classmethod
def load(cls, package_path, filter_func=lambda name, obj: True):
"""
导入子模块
:param package_path: 父包名
:param filter_func: 子模块过滤函数,入参为模块名和模块对象,返回True则导入,否则不导入
:return:
"""
FILL_FUNC_BODY @staticmethod
... |
submodules: list = []
packages = importlib.import_module(package_path)
for importer, package_name, _ in pkgutil.iter_modules(packages.__path__):
try:
if package_name.startswith('_'):
continue
full_package_name = f'{package_path}.{p... | """
导入子模块
:param package_path: 父包名
:param filter_func: 子模块过滤函数,入参为模块名和模块对象,返回True则导入,否则不导入
:return:
"""
submodules: list = []
packages = importlib.import_module(package_path)
for importer, package_name, _ in pkgutil.iter_modules(packages.__path__)... | 50 | 276 | 245 | 521 | # -*- coding: utf-8 -*-
import importlib
import pkgutil
import traceback
from pathlib import Path
from app.log import logger
class ModuleHelper:
"""
模块动态加载
"""
@classmethod
def load(cls, package_path, filter_func=lambda name, obj: True):
FILL_FUNC_BODY @staticmethod
def dynamic_import_all... | # -*- coding: utf-8 -*-
import importlib
import pkgutil
import traceback
from pathlib import Path
from app.log import logger
class ModuleHelper:
"""
模块动态加载
"""
@classmethod
def load(cls, package_path, filter_func=lambda name, obj: True):
"""
导入子模块
:param package_path: 父包名... |
36,903 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/nfo.py | 12,13 | 6,18 | get_element_value | NfoReader | 13,16 | 13,16 | class NfoReader:
def __init__(self, xml_file_path: Path):
self.xml_file_path = xml_file_path
self.tree = ET.parse(xml_file_path)
self.root = self.tree.getroot()
def get_element_value(self, element_path) -> Optional[str]:
FILL_FUNC_BODY def get_elements(self, element_path) -> List[ET.... | class NfoReader:
def __init__(self, xml_file_path: Path):
self.xml_file_path = xml_file_path
self.tree = ET.parse(xml_file_path)
self.root = self.tree.getroot()
def get_element_value(self, element_path) -> Optional[str]:
FILL_FUNC_BODY def get_elements(self, element_path) -> List[ET.... | element = self.root.find(element_path)
return element.text if element is not None else None
| element = self.root.find(element_path)
return element.text if element is not None else None
| 12 | 133 | 31 | 164 | import xml.etree.ElementTree as ET
from pathlib import Path
from typing import List, Optional
class NfoReader:
def __init__(self, xml_file_path: Path):
self.xml_file_path = xml_file_path
self.tree = ET.parse(xml_file_path)
self.root = self.tree.getroot()
def get_element_value(self, el... | import xml.etree.ElementTree as ET
from pathlib import Path
from typing import List, Optional
class NfoReader:
def __init__(self, xml_file_path: Path):
self.xml_file_path = xml_file_path
self.tree = ET.parse(xml_file_path)
self.root = self.tree.getroot()
def get_element_value(self, el... |
36,904 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/ocr.py | 11,12 | 7,35 | get_captcha_text | OcrHelper | 19,35 | 12,35 | class OcrHelper:
_ocr_b64_url = f"{settings.OCR_HOST}/captcha/base64"
def get_captcha_text(self, image_url=None, image_b64=None, cookie=None, ua=None):
FILL_FUNC_BODY | class OcrHelper:
_ocr_b64_url = f"{settings.OCR_HOST}/captcha/base64"
def get_captcha_text(self, image_url=None, image_b64=None, cookie=None, ua=None):
"""
根据图片地址,获取验证码图片,并识别内容
:param image_url: 图片地址
:param image_b64: 图片base64,跳过图片地址下载
:param cookie: 下载图片使用的cookie
... | if image_url:
ret = RequestUtils(ua=ua,
cookies=cookie).get_res(image_url)
if ret is not None:
image_bin = ret.content
if not image_bin:
return ""
image_b64 = base64.b64encode(image_bin).de... | """
根据图片地址,获取验证码图片,并识别内容
:param image_url: 图片地址
:param image_b64: 图片base64,跳过图片地址下载
:param cookie: 下载图片使用的cookie
:param ua: 下载图片使用的ua
"""
if image_url:
ret = RequestUtils(ua=ua,
cookies=cookie).get_res(image_url)
... | 39 | 165 | 186 | 351 | import base64
from app.core.config import settings
from app.utils.http import RequestUtils
class OcrHelper:
_ocr_b64_url = f"{settings.OCR_HOST}/captcha/base64"
def get_captcha_text(self, image_url=None, image_b64=None, cookie=None, ua=None):
FILL_FUNC_BODY | import base64
from app.core.config import settings
from app.utils.http import RequestUtils
class OcrHelper:
_ocr_b64_url = f"{settings.OCR_HOST}/captcha/base64"
def get_captcha_text(self, image_url=None, image_b64=None, cookie=None, ua=None):
"""
根据图片地址,获取验证码图片,并识别内容
:param image_ur... |
36,906 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/progress.py | 39,40 | 8,53 | update | ProgressHelper | 40,49 | 40,49 | class ProgressHelper(metaclass=Singleton):
_process_detail: Dict[str, dict] = {}
def __init__(self):
self._process_detail = {}
def init_config(self):
pass
def __reset(self, key: Union[ProgressKey, str]):
if isinstance(key, Enum):
key = key.value
self._proce... | class ProgressHelper(metaclass=Singleton):
_process_detail: Dict[str, dict] = {}
def __init__(self):
self._process_detail = {}
def init_config(self):
pass
def __reset(self, key: Union[ProgressKey, str]):
if isinstance(key, Enum):
key = key.value
self._proce... | if isinstance(key, Enum):
key = key.value
if not self._process_detail.get(key, {}).get('enable'):
return
if value:
self._process_detail[key]['value'] = value
if text:
self._process_detail[key]['text'] = text
| if isinstance(key, Enum):
key = key.value
if not self._process_detail.get(key, {}).get('enable'):
return
if value:
self._process_detail[key]['value'] = value
if text:
self._process_detail[key]['text'] = text
| 21 | 353 | 92 | 445 | from enum import Enum
from typing import Union, Dict
from app.schemas.types import ProgressKey
from app.utils.singleton import Singleton
class ProgressHelper(metaclass=Singleton):
_process_detail: Dict[str, dict] = {}
def __init__(self):
self._process_detail = {}
def init_config(self):
... | from enum import Enum
from typing import Union, Dict
from app.schemas.types import ProgressKey
from app.utils.singleton import Singleton
class ProgressHelper(metaclass=Singleton):
_process_detail: Dict[str, dict] = {}
def __init__(self):
self._process_detail = {}
def init_config(self):
... |
36,908 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/subscribe.py | 92,93 | 14,123 | sub_report | SubscribeHelper | 96,123 | 93,123 | class SubscribeHelper(metaclass=Singleton):
"""
订阅数据统计
"""
_sub_reg = "https://movie-pilot.org/subscribe/add"
_sub_done = "https://movie-pilot.org/subscribe/done"
_sub_report = "https://movie-pilot.org/subscribe/report"
_sub_statistic = "https://movie-pilot.org/subscribe/statistic"
... | class SubscribeHelper(metaclass=Singleton):
"""
订阅数据统计
"""
_sub_reg = "https://movie-pilot.org/subscribe/add"
_sub_done = "https://movie-pilot.org/subscribe/done"
_sub_report = "https://movie-pilot.org/subscribe/report"
_sub_statistic = "https://movie-pilot.org/subscribe/statistic"
... | if not settings.SUBSCRIBE_STATISTIC_SHARE:
return False
subscribes = SubscribeOper().list()
if not subscribes:
return True
res = RequestUtils(content_type="application/json",
timeout=10).post(self._sub_report,
... | """
上报存量订阅统计
"""
if not settings.SUBSCRIBE_STATISTIC_SHARE:
return False
subscribes = SubscribeOper().list()
if not subscribes:
return True
res = RequestUtils(content_type="application/json",
timeout=10).post(self... | 60 | 799 | 304 | 1,103 | from threading import Thread
from typing import List
from cachetools import TTLCache, cached
from app.core.config import settings
from app.db.subscribe_oper import SubscribeOper
from app.db.systemconfig_oper import SystemConfigOper
from app.schemas.types import SystemConfigKey
from app.utils.http import RequestUtils
... | from threading import Thread
from typing import List
from cachetools import TTLCache, cached
from app.core.config import settings
from app.db.subscribe_oper import SubscribeOper
from app.db.systemconfig_oper import SystemConfigOper
from app.schemas.types import SystemConfigKey
from app.utils.http import RequestUtils
... |
36,909 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/thread.py | 13,14 | 6,32 | submit | ThreadHelper | 21,23 | 14,23 | class ThreadHelper(metaclass=Singleton):
"""
线程池管理
"""
def __init__(self, max_workers=50):
self.pool = ThreadPoolExecutor(max_workers=max_workers)
def submit(self, func, *args, **kwargs):
FILL_FUNC_BODY def shutdown(self):
"""
关闭线程池
:return:
"""
se... | class ThreadHelper(metaclass=Singleton):
"""
线程池管理
"""
def __init__(self, max_workers=50):
self.pool = ThreadPoolExecutor(max_workers=max_workers)
def submit(self, func, *args, **kwargs):
"""
提交任务
:param func: 函数
:param args: 参数
:param kwargs: 参数
... | return self.pool.submit(func, *args, **kwargs)
| """
提交任务
:param func: 函数
:param args: 参数
:param kwargs: 参数
:return: future
"""
return self.pool.submit(func, *args, **kwargs)
| 4 | 184 | 20 | 204 | from concurrent.futures import ThreadPoolExecutor
from app.utils.singleton import Singleton
class ThreadHelper(metaclass=Singleton):
"""
线程池管理
"""
def __init__(self, max_workers=50):
self.pool = ThreadPoolExecutor(max_workers=max_workers)
def submit(self, func, *args, **kwargs):
FILL_FUN... | from concurrent.futures import ThreadPoolExecutor
from app.utils.singleton import Singleton
class ThreadHelper(metaclass=Singleton):
"""
线程池管理
"""
def __init__(self, max_workers=50):
self.pool = ThreadPoolExecutor(max_workers=max_workers)
def submit(self, func, *args, **kwargs):
... |
36,911 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/helper/twofa.py | 20,22 | 11,44 | __calc | TwoFactorAuth | 22,42 | 22,42 | class TwoFactorAuth:
def __init__(self, code_or_secret: str):
if code_or_secret and len(code_or_secret) > 16:
self.code = None
self.secret = code_or_secret
else:
self.code = code_or_secret
self.secret = None
@staticmethod
def __calc(secret_key... | class TwoFactorAuth:
def __init__(self, code_or_secret: str):
if code_or_secret and len(code_or_secret) > 16:
self.code = None
self.secret = code_or_secret
else:
self.code = code_or_secret
self.secret = None
@staticmethod
def __calc(secret_key... | if not secret_key:
return ""
try:
input_time = int(time.time()) // 30
key = base64.b32decode(secret_key)
msg = struct.pack(">Q", input_time)
google_code = hmac.new(key, msg, hashlib.sha1).digest()
o = (
google_code[1... | if not secret_key:
return ""
try:
input_time = int(time.time()) // 30
key = base64.b32decode(secret_key)
msg = struct.pack(">Q", input_time)
google_code = hmac.new(key, msg, hashlib.sha1).digest()
o = (
google_code[1... | 67 | 146 | 273 | 419 | import base64
import hashlib
import hmac
import struct
import sys
import time
from app.log import logger
class TwoFactorAuth:
def __init__(self, code_or_secret: str):
if code_or_secret and len(code_or_secret) > 16:
self.code = None
self.secret = code_or_secret
else:
... | import base64
import hashlib
import hmac
import struct
import sys
import time
from app.log import logger
class TwoFactorAuth:
def __init__(self, code_or_secret: str):
if code_or_secret and len(code_or_secret) > 16:
self.code = None
self.secret = code_or_secret
else:
... |
36,912 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/log.py | 28,29 | 23,34 | format | CustomFormatter | 29,34 | 29,34 | class CustomFormatter(logging.Formatter):
"""
定义日志输出格式
"""
def format(self, record):
FILL_FUNC_BODY | class CustomFormatter(logging.Formatter):
"""
定义日志输出格式
"""
def format(self, record):
FILL_FUNC_BODY | seperator = " " * (8 - len(record.levelname))
record.leveltext = level_name_colors[record.levelno](record.levelname + ":") + seperator
return super().format(record)
| seperator = " " * (8 - len(record.levelname))
record.leveltext = level_name_colors[record.levelno](record.levelname + ":") + seperator
return super().format(record)
| 17 | 47 | 66 | 113 | import inspect
import logging
from logging.handlers import RotatingFileHandler
from pathlib import Path
from typing import Dict, Any
import click
from app.core.config import settings
# 日志级别颜色
level_name_colors = {
logging.DEBUG: lambda level_name: click.style(str(level_name), fg="cyan"),
logging.INFO: lambda... | import inspect
import logging
from logging.handlers import RotatingFileHandler
from pathlib import Path
from typing import Dict, Any
import click
from app.core.config import settings
# 日志级别颜色
level_name_colors = {
logging.DEBUG: lambda level_name: click.style(str(level_name), fg="cyan"),
logging.INFO: lambda... |
36,913 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/log.py | 119,120 | 34,183 | logger | LoggerManager | 125,145 | 120,145 | class LoggerManager:
"""
日志管理
"""
# 管理所有的Logger
_loggers: Dict[str, Any] = {}
# 默认日志文件
_default_log_file = "moviepilot.log"
@staticmethod
def __get_caller():
"""
获取调用者的文件名称与插件名称(如果是插件调用内置的模块, 也能写入到插件日志文件中)
"""
# 调用者文件名称
caller_name = None
... | class LoggerManager:
"""
日志管理
"""
# 管理所有的Logger
_loggers: Dict[str, Any] = {}
# 默认日志文件
_default_log_file = "moviepilot.log"
@staticmethod
def __get_caller():
"""
获取调用者的文件名称与插件名称(如果是插件调用内置的模块, 也能写入到插件日志文件中)
"""
# 调用者文件名称
caller_name = None
... |
# 获取调用者文件名和插件名
caller_name, plugin_name = self.__get_caller()
# 区分插件日志
if plugin_name:
# 使用插件日志文件
logfile = Path("plugins") / f"{plugin_name}.log"
else:
# 使用默认日志文件
logfile = self._default_log_file
# 获取调用者的模块的logger
... | """
获取模块的logger
:param method: 日志方法
:param msg: 日志信息
"""
# 获取调用者文件名和插件名
caller_name, plugin_name = self.__get_caller()
# 区分插件日志
if plugin_name:
# 使用插件日志文件
logfile = Path("plugins") / f"{plugin_name}.log"
else:
... | 49 | 1,201 | 232 | 1,433 | import inspect
import logging
from logging.handlers import RotatingFileHandler
from pathlib import Path
from typing import Dict, Any
import click
from app.core.config import settings
# 日志级别颜色
level_name_colors = {
logging.DEBUG: lambda level_name: click.style(str(level_name), fg="cyan"),
logging.INFO: lambda... | import inspect
import logging
from logging.handlers import RotatingFileHandler
from pathlib import Path
from typing import Dict, Any
import click
from app.core.config import settings
# 日志级别颜色
level_name_colors = {
logging.DEBUG: lambda level_name: click.style(str(level_name), fg="cyan"),
logging.INFO: lambda... |
36,918 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/filter/RuleParser.py | 29,30 | 4,42 | parse | RuleParser | 39,42 | 30,42 | class RuleParser:
def __init__(self):
"""
定义语法规则
"""
# 表达式
expr: Forward = Forward()
# 原子
atom: Combine = Combine(Word(alphas, alphanums) | Word(nums) + Word(alphas, alphanums))
# 逻辑非操作符
operator_not: Literal = Literal('!').setParseAction(lamb... | class RuleParser:
def __init__(self):
"""
定义语法规则
"""
# 表达式
expr: Forward = Forward()
# 原子
atom: Combine = Combine(Word(alphas, alphanums) | Word(nums) + Word(alphas, alphanums))
# 逻辑非操作符
operator_not: Literal = Literal('!').setParseAction(lamb... | return self.expr.parseString(expression)
| """
解析给定的表达式。
参数:
expression -- 要解析的表达式
返回:
解析结果
"""
return self.expr.parseString(expression)
| 2 | 372 | 17 | 389 | from pyparsing import Forward, Literal, Word, alphas, infixNotation, opAssoc, alphanums, Combine, nums, ParseResults
class RuleParser:
def __init__(self):
"""
定义语法规则
"""
# 表达式
expr: Forward = Forward()
# 原子
atom: Combine = Combine(Word(alphas, alphanums) | ... | from pyparsing import Forward, Literal, Word, alphas, infixNotation, opAssoc, alphanums, Combine, nums, ParseResults
class RuleParser:
def __init__(self):
"""
定义语法规则
"""
# 表达式
expr: Forward = Forward()
# 原子
atom: Combine = Combine(Word(alphas, alphanums) | ... |
36,919 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/indexer/mtorrent.py | 180,181 | 16,202 | __get_download_url | MTorrentSpider | 184,202 | 181,202 | class MTorrentSpider:
"""
mTorrent API,需要缓存ApiKey
"""
_indexerid = None
_domain = None
_name = ""
_proxy = None
_cookie = None
_ua = None
_size = 100
_searchurl = "%sapi/torrent/search"
_downloadurl = "%sapi/torrent/genDlToken"
_pageurl = "%sdetail/%s"
# 电影分类
... | class MTorrentSpider:
"""
mTorrent API,需要缓存ApiKey
"""
_indexerid = None
_domain = None
_name = ""
_proxy = None
_cookie = None
_ua = None
_size = 100
_searchurl = "%sapi/torrent/search"
_downloadurl = "%sapi/torrent/genDlToken"
_pageurl = "%sdetail/%s"
# 电影分类
... | url = self._downloadurl % self._domain
params = {
'method': 'post',
'cookie': False,
'params': {
'id': torrent_id
},
'header': {
'Content-Type': 'application/json',
'User-Agent': f'{self._ua}',
... | """
获取下载链接,返回base64编码的json字符串及URL
"""
url = self._downloadurl % self._domain
params = {
'method': 'post',
'cookie': False,
'params': {
'id': torrent_id
},
'header': {
'Content-Type': 'appl... | 40 | 1,772 | 206 | 1,978 | import base64
import json
import re
from typing import Tuple, List
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.db.systemconfig_oper import SystemConfigOper
from app.log import logger
from app.schemas import MediaType
from app.utils.http import RequestUtils
from app.utils.string ... | import base64
import json
import re
from typing import Tuple, List
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.db.systemconfig_oper import SystemConfigOper
from app.log import logger
from app.schemas import MediaType
from app.utils.http import RequestUtils
from app.utils.string ... |
36,921 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/indexer/tnode.py | 52,53 | 12,108 | search | TNodeSpider | 53,108 | 53,108 | class TNodeSpider:
_indexerid = None
_domain = None
_name = ""
_proxy = None
_cookie = None
_ua = None
_token = None
_size = 100
_searchurl = "%sapi/torrent/advancedSearch"
_downloadurl = "%sapi/torrent/download/%s"
_pageurl = "%storrent/info/%s"
def __init__(self, index... | class TNodeSpider:
_indexerid = None
_domain = None
_name = ""
_proxy = None
_cookie = None
_ua = None
_token = None
_size = 100
_searchurl = "%sapi/torrent/advancedSearch"
_downloadurl = "%sapi/torrent/download/%s"
_pageurl = "%storrent/info/%s"
def __init__(self, index... | if not self._token:
logger.warn(f"{self._name} 未获取到token,无法搜索")
return True, []
search_type = "imdbid" if (keyword and keyword.startswith('tt')) else "title"
params = {
"page": int(page) + 1,
"size": self._size,
"type": search_type,
... | if not self._token:
logger.warn(f"{self._name} 未获取到token,无法搜索")
return True, []
search_type = "imdbid" if (keyword and keyword.startswith('tt')) else "title"
params = {
"page": int(page) + 1,
"size": self._size,
"type": search_type,
... | 145 | 454 | 693 | 1,147 | import re
from typing import Tuple, List
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
class TNodeSpider:
_indexerid = None
_domain = None
_name = ""
_proxy = None
... | import re
from typing import Tuple, List
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
class TNodeSpider:
_indexerid = None
_domain = None
_name = ""
_proxy = None
... |
36,922 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/indexer/torrentleech.py | 26,27 | 12,71 | search | TorrentLeech | 27,71 | 27,71 | class TorrentLeech:
_indexer = None
_proxy = None
_size = 100
_searchurl = "%storrents/browse/list/query/%s"
_browseurl = "%storrents/browse/list/page/2%s"
_downloadurl = "%sdownload/%s/%s"
_pageurl = "%storrent/%s"
def __init__(self, indexer: CommentedMap):
self._indexer = inde... | class TorrentLeech:
_indexer = None
_proxy = None
_size = 100
_searchurl = "%storrents/browse/list/query/%s"
_browseurl = "%storrents/browse/list/page/2%s"
_downloadurl = "%sdownload/%s/%s"
_pageurl = "%storrent/%s"
def __init__(self, indexer: CommentedMap):
self._indexer = inde... |
if StringUtils.is_chinese(keyword):
# 不支持中文
return True, []
if keyword:
url = self._searchurl % (self._indexer.get('domain'), quote(keyword))
else:
url = self._browseurl % (self._indexer.get('domain'), int(page) + 1)
res = RequestUtils(
... |
if StringUtils.is_chinese(keyword):
# 不支持中文
return True, []
if keyword:
url = self._searchurl % (self._indexer.get('domain'), quote(keyword))
else:
url = self._browseurl % (self._indexer.get('domain'), int(page) + 1)
res = RequestUtils(
... | 110 | 191 | 585 | 776 | from typing import List, Tuple
from urllib.parse import quote
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
class TorrentLeech:
_indexer = None
_proxy = None
_size = 10... | from typing import List, Tuple
from urllib.parse import quote
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.log import logger
from app.utils.http import RequestUtils
from app.utils.string import StringUtils
class TorrentLeech:
_indexer = None
_proxy = None
_size = 10... |
36,927 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/category.py | 24,25 | 11,156 | init | CategoryHelper | 28,50 | 25,50 | class CategoryHelper(metaclass=Singleton):
"""
二级分类
"""
_categorys = {}
_movie_categorys = {}
_tv_categorys = {}
_anime_categorys = {}
def __init__(self):
self._category_path: Path = settings.CONFIG_PATH / "category.yaml"
self.init()
def init(self):
FILL_FUNC_BODY ... | class CategoryHelper(metaclass=Singleton):
"""
二级分类
"""
_categorys = {}
_movie_categorys = {}
_tv_categorys = {}
_anime_categorys = {}
def __init__(self):
self._category_path: Path = settings.CONFIG_PATH / "category.yaml"
self.init()
def init(self):
"""
... | # 二级分类策略关闭
if not settings.LIBRARY_CATEGORY:
return
try:
if not self._category_path.exists():
shutil.copy(settings.INNER_CONFIG_PATH / "category.yaml", self._category_path)
with open(self._category_path, mode='r', encoding='utf-8') as f:
... | """
初始化
"""
# 二级分类策略关闭
if not settings.LIBRARY_CATEGORY:
return
try:
if not self._category_path.exists():
shutil.copy(settings.INNER_CONFIG_PATH / "category.yaml", self._category_path)
with open(self._category_path, mode... | 53 | 1,066 | 319 | 1,385 | import shutil
from pathlib import Path
import ruamel.yaml
from app.core.config import settings
from app.log import logger
from app.utils.singleton import Singleton
class CategoryHelper(metaclass=Singleton):
"""
二级分类
"""
_categorys = {}
_movie_categorys = {}
_tv_categorys = {}
_anime_cate... | import shutil
from pathlib import Path
import ruamel.yaml
from app.core.config import settings
from app.log import logger
from app.utils.singleton import Singleton
class CategoryHelper(metaclass=Singleton):
"""
二级分类
"""
_categorys = {}
_movie_categorys = {}
_tv_categorys = {}
_anime_cate... |
36,931 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/as_obj.py | 101,102 | 5,106 | update | AsObj | 102,104 | 102,104 | class AsObj:
def __init__(self, json=None, key=None, dict_key=False, dict_key_name=None):
self._json = json if json else {}
self._key = key
self._dict_key = dict_key
self._dict_key_name = dict_key_name
self._obj_list = []
self._list_only = False
if isinstance(... | class AsObj:
def __init__(self, json=None, key=None, dict_key=False, dict_key_name=None):
self._json = json if json else {}
self._key = key
self._dict_key = dict_key
self._dict_key_name = dict_key_name
self._obj_list = []
self._list_only = False
if isinstance(... | return self.__dict__.update(entries)
| return self.__dict__.update(entries)
| 2 | 1,017 | 16 | 1,033 | # encoding: utf-8
import sys
class AsObj:
def __init__(self, json=None, key=None, dict_key=False, dict_key_name=None):
self._json = json if json else {}
self._key = key
self._dict_key = dict_key
self._dict_key_name = dict_key_name
self._obj_list = []
self._list_only... | # encoding: utf-8
import sys
class AsObj:
def __init__(self, json=None, key=None, dict_key=False, dict_key_name=None):
self._json = json if json else {}
self._key = key
self._dict_key = dict_key
self._dict_key_name = dict_key_name
self._obj_list = []
self._list_only... |
36,932 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/account.py | 115,116 | 7,178 | rated_tv_shows | Account | 122,124 | 116,124 | class Account(TMDb):
_urls = {
"details": "/account",
"created_lists": "/account/%s/lists",
"favorite_movies": "/account/%s/favorite/movies",
"favorite_tv": "/account/%s/favorite/tv",
"favorite": "/account/%s/favorite",
"rated_movies": "/account/%s/rated/movies",
... | class Account(TMDb):
_urls = {
"details": "/account",
"created_lists": "/account/%s/lists",
"favorite_movies": "/account/%s/favorite/movies",
"favorite_tv": "/account/%s/favorite/tv",
"favorite": "/account/%s/favorite",
"rated_movies": "/account/%s/rated/movies",
... | return self._get_list("rated_tv", asc_sort=asc_sort, page=page)
| """
Get a list of all the TV shows you have rated.
:param asc_sort: bool
:param page: int
:return:
"""
return self._get_list("rated_tv", asc_sort=asc_sort, page=page)
| 4 | 1,770 | 28 | 1,798 | import os
from ..tmdb import TMDb
from ..exceptions import TMDbException
class Account(TMDb):
_urls = {
"details": "/account",
"created_lists": "/account/%s/lists",
"favorite_movies": "/account/%s/favorite/movies",
"favorite_tv": "/account/%s/favorite/tv",
"favorite": "/ac... | import os
from ..tmdb import TMDb
from ..exceptions import TMDbException
class Account(TMDb):
_urls = {
"details": "/account",
"created_lists": "/account/%s/lists",
"favorite_movies": "/account/%s/favorite/movies",
"favorite_tv": "/account/%s/favorite/tv",
"favorite": "/ac... |
36,933 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/auth.py | 21,22 | 4,65 | _create_request_token | Authentication | 25,29 | 22,29 | class Authentication(TMDb):
_urls = {
"create_request_token": "/authentication/token/new",
"validate_with_login": "/authentication/token/validate_with_login",
"create_session": "/authentication/session/new",
"delete_session": "/authentication/session",
}
def __init__(self, u... | class Authentication(TMDb):
_urls = {
"create_request_token": "/authentication/token/new",
"validate_with_login": "/authentication/token/validate_with_login",
"create_session": "/authentication/session/new",
"delete_session": "/authentication/session",
}
def __init__(self, u... | response = self._request_obj(self._urls["create_request_token"])
self.expires_at = response.expires_at
return response.request_token
| """
Create a temporary request token that can be used to validate a TMDb user login.
"""
response = self._request_obj(self._urls["create_request_token"])
self.expires_at = response.expires_at
return response.request_token
| 8 | 536 | 50 | 586 | from ..tmdb import TMDb
class Authentication(TMDb):
_urls = {
"create_request_token": "/authentication/token/new",
"validate_with_login": "/authentication/token/validate_with_login",
"create_session": "/authentication/session/new",
"delete_session": "/authentication/session",
}... | from ..tmdb import TMDb
class Authentication(TMDb):
_urls = {
"create_request_token": "/authentication/token/new",
"validate_with_login": "/authentication/token/validate_with_login",
"create_session": "/authentication/session/new",
"delete_session": "/authentication/session",
}... |
36,934 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/certification.py | 17,18 | 4,23 | tv_list | Certification | 22,23 | 18,23 | class Certification(TMDb):
_urls = {
"movie_list": "/certification/movie/list",
"tv_list": "/certification/tv/list",
}
def movie_list(self):
"""
Get an up to date list of the officially supported movie certifications on TMDB.
:return:
"""
return self.... | class Certification(TMDb):
_urls = {
"movie_list": "/certification/movie/list",
"tv_list": "/certification/tv/list",
}
def movie_list(self):
"""
Get an up to date list of the officially supported movie certifications on TMDB.
:return:
"""
return self.... | return self._request_obj(self._urls["tv_list"], key="certifications")
| """
Get an up to date list of the officially supported TV show certifications on TMDB.
:return:
"""
return self._request_obj(self._urls["tv_list"], key="certifications")
| 3 | 169 | 25 | 194 | from ..tmdb import TMDb
class Certification(TMDb):
_urls = {
"movie_list": "/certification/movie/list",
"tv_list": "/certification/tv/list",
}
def movie_list(self):
"""
Get an up to date list of the officially supported movie certifications on TMDB.
:return:
... | from ..tmdb import TMDb
class Certification(TMDb):
_urls = {
"movie_list": "/certification/movie/list",
"tv_list": "/certification/tv/list",
}
def movie_list(self):
"""
Get an up to date list of the officially supported movie certifications on TMDB.
:return:
... |
36,935 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/change.py | 23,24 | 4,55 | movie_change_list | Change | 32,34 | 24,34 | class Change(TMDb):
_urls = {
"movie": "/movie/changes",
"tv": "/tv/changes",
"person": "/person/changes"
}
def _change_list(self, change_type, start_date="", end_date="", page=1):
params = "page=%s" % page
if start_date:
params += "&start_date=%s" % star... | class Change(TMDb):
_urls = {
"movie": "/movie/changes",
"tv": "/tv/changes",
"person": "/person/changes"
}
def _change_list(self, change_type, start_date="", end_date="", page=1):
params = "page=%s" % page
if start_date:
params += "&start_date=%s" % star... | return self._change_list("movie", start_date=start_date, end_date=end_date, page=page)
| """
Get the changes for a movie. By default only the last 24 hours are returned.
You can query up to 14 days in a single query by using the start_date and end_date query parameters.
:param start_date: str
:param end_date: str
:param page: int
:return:
"""
... | 5 | 594 | 35 | 629 | from ..tmdb import TMDb
class Change(TMDb):
_urls = {
"movie": "/movie/changes",
"tv": "/tv/changes",
"person": "/person/changes"
}
def _change_list(self, change_type, start_date="", end_date="", page=1):
params = "page=%s" % page
if start_date:
params ... | from ..tmdb import TMDb
class Change(TMDb):
_urls = {
"movie": "/movie/changes",
"tv": "/tv/changes",
"person": "/person/changes"
}
def _change_list(self, change_type, start_date="", end_date="", page=1):
params = "page=%s" % page
if start_date:
params ... |
36,936 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/collection.py | 27,28 | 4,34 | translations | Collection | 33,34 | 28,34 | class Collection(TMDb):
_urls = {
"details": "/collection/%s",
"images": "/collection/%s/images",
"translations": "/collection/%s/translations"
}
def details(self, collection_id):
"""
Get collection details by id.
:param collection_id: int
:return:
... | class Collection(TMDb):
_urls = {
"details": "/collection/%s",
"images": "/collection/%s/images",
"translations": "/collection/%s/translations"
}
def details(self, collection_id):
"""
Get collection details by id.
:param collection_id: int
:return:
... | return self._request_obj(self._urls["translations"] % collection_id, key="translations")
| """
Get the list translations for a collection by id.
:param collection_id: int
:return:
"""
return self._request_obj(self._urls["translations"] % collection_id, key="translations")
| 5 | 246 | 31 | 277 | from ..tmdb import TMDb
class Collection(TMDb):
_urls = {
"details": "/collection/%s",
"images": "/collection/%s/images",
"translations": "/collection/%s/translations"
}
def details(self, collection_id):
"""
Get collection details by id.
:param collection_... | from ..tmdb import TMDb
class Collection(TMDb):
_urls = {
"details": "/collection/%s",
"images": "/collection/%s/images",
"translations": "/collection/%s/translations"
}
def details(self, collection_id):
"""
Get collection details by id.
:param collection_... |
36,937 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/company.py | 20,21 | 4,48 | alternative_names | Company | 26,28 | 21,28 | class Company(TMDb):
_urls = {
"details": "/company/%s",
"alternative_names": "/company/%s/alternative_names",
"images": "/company/%s/images",
"movies": "/company/%s/movies"
}
def details(self, company_id):
"""
Get a companies details by id.
:param c... | class Company(TMDb):
_urls = {
"details": "/company/%s",
"alternative_names": "/company/%s/alternative_names",
"images": "/company/%s/images",
"movies": "/company/%s/movies"
}
def details(self, company_id):
"""
Get a companies details by id.
:param c... | return self._request_obj(self._urls["alternative_names"] % company_id, key="results")
| """
Get the alternative names of a company.
:param company_id: int
:return:
"""
return self._request_obj(self._urls["alternative_names"] % company_id, key="results")
| 5 | 362 | 32 | 394 | from ..tmdb import TMDb
class Company(TMDb):
_urls = {
"details": "/company/%s",
"alternative_names": "/company/%s/alternative_names",
"images": "/company/%s/images",
"movies": "/company/%s/movies"
}
def details(self, company_id):
"""
Get a companies detai... | from ..tmdb import TMDb
class Company(TMDb):
_urls = {
"details": "/company/%s",
"alternative_names": "/company/%s/alternative_names",
"images": "/company/%s/images",
"movies": "/company/%s/movies"
}
def details(self, company_id):
"""
Get a companies detai... |
36,938 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/configuration.py | 38,39 | 5,55 | languages | Configuration | 42,44 | 39,44 | class Configuration(TMDb):
_urls = {
"api_configuration": "/configuration",
"countries": "/configuration/countries",
"jobs": "/configuration/jobs",
"languages": "/configuration/languages",
"primary_translations": "/configuration/primary_translations",
"timezones": "/c... | class Configuration(TMDb):
_urls = {
"api_configuration": "/configuration",
"countries": "/configuration/countries",
"jobs": "/configuration/jobs",
"languages": "/configuration/languages",
"primary_translations": "/configuration/primary_translations",
"timezones": "/c... | return self._request_obj(self._urls["languages"])
| """
Get the list of languages (ISO 639-1 tags) used throughout TMDb.
"""
return self._request_obj(self._urls["languages"])
| 2 | 446 | 21 | 467 | import warnings
from ..tmdb import TMDb
class Configuration(TMDb):
_urls = {
"api_configuration": "/configuration",
"countries": "/configuration/countries",
"jobs": "/configuration/jobs",
"languages": "/configuration/languages",
"primary_translations": "/configuration/prima... | import warnings
from ..tmdb import TMDb
class Configuration(TMDb):
_urls = {
"api_configuration": "/configuration",
"countries": "/configuration/countries",
"jobs": "/configuration/jobs",
"languages": "/configuration/languages",
"primary_translations": "/configuration/prima... |
36,939 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/credit.py | 9,10 | 4,16 | details | Credit | 15,16 | 10,16 | class Credit(TMDb):
_urls = {
"details": "/credit/%s"
}
def details(self, credit_id):
FILL_FUNC_BODY | class Credit(TMDb):
_urls = {
"details": "/credit/%s"
}
def details(self, credit_id):
"""
Get a movie or TV credit details by id.
:param credit_id: int
:return:
"""
FILL_FUNC_BODY | return self._request_obj(self._urls["details"] % credit_id)
| """
Get a movie or TV credit details by id.
:param credit_id: int
:return:
"""
return self._request_obj(self._urls["details"] % credit_id)
| 4 | 84 | 22 | 106 | from ..tmdb import TMDb
class Credit(TMDb):
_urls = {
"details": "/credit/%s"
}
def details(self, credit_id):
FILL_FUNC_BODY | from ..tmdb import TMDb
class Credit(TMDb):
_urls = {
"details": "/credit/%s"
}
def details(self, credit_id):
"""
Get a movie or TV credit details by id.
:param credit_id: int
:return:
"""
FILL_FUNC_BODY |
36,940 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/discover.py | 15,16 | 9,31 | discover_movies | Discover | 21,23 | 16,23 | class Discover(TMDb):
_urls = {
"movies": "/discover/movie",
"tv": "/discover/tv"
}
def discover_movies(self, params):
FILL_FUNC_BODY def discover_tv_shows(self, params):
"""
Discover TV shows by different types of data like average rating, number of votes, genres,
... | class Discover(TMDb):
_urls = {
"movies": "/discover/movie",
"tv": "/discover/tv"
}
def discover_movies(self, params):
"""
Discover movies by different types of data like average rating, number of votes, genres and certifications.
:param params: dict
:return:... | return self._request_obj(self._urls["movies"], urlencode(params), key="results")
| """
Discover movies by different types of data like average rating, number of votes, genres and certifications.
:param params: dict
:return:
"""
return self._request_obj(self._urls["movies"], urlencode(params), key="results")
| 4 | 200 | 30 | 230 | from ..tmdb import TMDb
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
class Discover(TMDb):
_urls = {
"movies": "/discover/movie",
"tv": "/discover/tv"
}
def discover_movies(self, params):
FILL_FUNC_BODY def discover_tv_shows(self, pa... | from ..tmdb import TMDb
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
class Discover(TMDb):
_urls = {
"movies": "/discover/movie",
"tv": "/discover/tv"
}
def discover_movies(self, params):
"""
Discover movies by different... |
36,941 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/episode.py | 18,19 | 4,158 | details | Episode | 27,32 | 19,32 | class Episode(TMDb):
_urls = {
"details": "/tv/%s/season/%s/episode/%s",
"account_states": "/tv/%s/season/%s/episode/%s/account_states",
"changes": "/tv/episode/%s/changes",
"credits": "/tv/%s/season/%s/episode/%s/credits",
"external_ids": "/tv/%s/season/%s/episode/%s/externa... | class Episode(TMDb):
_urls = {
"details": "/tv/%s/season/%s/episode/%s",
"account_states": "/tv/%s/season/%s/episode/%s/account_states",
"changes": "/tv/episode/%s/changes",
"credits": "/tv/%s/season/%s/episode/%s/credits",
"external_ids": "/tv/%s/season/%s/episode/%s/externa... | return self._request_obj(
self._urls["details"] % (tv_id, season_num, episode_num),
params="append_to_response=%s" % append_to_response
)
| """
Get the TV episode details by id.
:param tv_id: int
:param season_num: int
:param episode_num: int
:param append_to_response: str
:return:
"""
return self._request_obj(
self._urls["details"] % (tv_id, season_num, episode_num),
... | 11 | 1,647 | 61 | 1,708 | from ..tmdb import TMDb
class Episode(TMDb):
_urls = {
"details": "/tv/%s/season/%s/episode/%s",
"account_states": "/tv/%s/season/%s/episode/%s/account_states",
"changes": "/tv/episode/%s/changes",
"credits": "/tv/%s/season/%s/episode/%s/credits",
"external_ids": "/tv/%s/se... | from ..tmdb import TMDb
class Episode(TMDb):
_urls = {
"details": "/tv/%s/season/%s/episode/%s",
"account_states": "/tv/%s/season/%s/episode/%s/account_states",
"changes": "/tv/episode/%s/changes",
"credits": "/tv/%s/season/%s/episode/%s/credits",
"external_ids": "/tv/%s/se... |
36,942 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/find.py | 45,46 | 4,84 | find_by_freebase_id | Find | 51,53 | 46,53 | class Find(TMDb):
_urls = {
"find": "/find/%s"
}
def find(self, external_id, external_source):
"""
The find method makes it easy to search for objects in our database by an external id. For example, an IMDB ID.
:param external_id: str
:param external_source str
... | class Find(TMDb):
_urls = {
"find": "/find/%s"
}
def find(self, external_id, external_source):
"""
The find method makes it easy to search for objects in our database by an external id. For example, an IMDB ID.
:param external_id: str
:param external_source str
... | return self.find(freebase_id, "freebase_id")
| """
The find method makes it easy to search for objects in our database by a Freebase ID.
:param freebase_id: str
:return:
"""
return self.find(freebase_id, "freebase_id")
| 3 | 772 | 21 | 793 | from ..tmdb import TMDb
class Find(TMDb):
_urls = {
"find": "/find/%s"
}
def find(self, external_id, external_source):
"""
The find method makes it easy to search for objects in our database by an external id. For example, an IMDB ID.
:param external_id: str
:param... | from ..tmdb import TMDb
class Find(TMDb):
_urls = {
"find": "/find/%s"
}
def find(self, external_id, external_source):
"""
The find method makes it easy to search for objects in our database by an external id. For example, an IMDB ID.
:param external_id: str
:param... |
36,943 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/genre.py | 17,18 | 4,23 | tv_list | Genre | 22,23 | 18,23 | class Genre(TMDb):
_urls = {
"movie_list": "/genre/movie/list",
"tv_list": "/genre/tv/list"
}
def movie_list(self):
"""
Get the list of official genres for movies.
:return:
"""
return self._request_obj(self._urls["movie_list"], key="genres")
def ... | class Genre(TMDb):
_urls = {
"movie_list": "/genre/movie/list",
"tv_list": "/genre/tv/list"
}
def movie_list(self):
"""
Get the list of official genres for movies.
:return:
"""
return self._request_obj(self._urls["movie_list"], key="genres")
def ... | return self._request_obj(self._urls["tv_list"], key="genres")
| """
Get the list of official genres for TV shows.
:return:
"""
return self._request_obj(self._urls["tv_list"], key="genres")
| 3 | 153 | 25 | 178 | from ..tmdb import TMDb
class Genre(TMDb):
_urls = {
"movie_list": "/genre/movie/list",
"tv_list": "/genre/tv/list"
}
def movie_list(self):
"""
Get the list of official genres for movies.
:return:
"""
return self._request_obj(self._urls["movie_list"... | from ..tmdb import TMDb
class Genre(TMDb):
_urls = {
"movie_list": "/genre/movie/list",
"tv_list": "/genre/tv/list"
}
def movie_list(self):
"""
Get the list of official genres for movies.
:return:
"""
return self._request_obj(self._urls["movie_list"... |
36,944 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/group.py | 9,10 | 4,16 | details | Group | 15,16 | 10,16 | class Group(TMDb):
_urls = {
"details": "/tv/episode_group/%s"
}
def details(self, group_id):
FILL_FUNC_BODY | class Group(TMDb):
_urls = {
"details": "/tv/episode_group/%s"
}
def details(self, group_id):
"""
Get the details of a TV episode group.
:param group_id: int
:return:
"""
FILL_FUNC_BODY | return self._request_obj(self._urls["details"] % group_id, key="groups")
| """
Get the details of a TV episode group.
:param group_id: int
:return:
"""
return self._request_obj(self._urls["details"] % group_id, key="groups")
| 5 | 87 | 27 | 114 | from ..tmdb import TMDb
class Group(TMDb):
_urls = {
"details": "/tv/episode_group/%s"
}
def details(self, group_id):
FILL_FUNC_BODY | from ..tmdb import TMDb
class Group(TMDb):
_urls = {
"details": "/tv/episode_group/%s"
}
def details(self, group_id):
"""
Get the details of a TV episode group.
:param group_id: int
:return:
"""
FILL_FUNC_BODY |
36,945 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/keyword.py | 18,19 | 4,25 | movies | Keyword | 24,25 | 19,25 | class Keyword(TMDb):
_urls = {
"details": "/keyword/%s",
"movies": "/keyword/%s/movies"
}
def details(self, keyword_id):
"""
Get a keywords details by id.
:param keyword_id: int
:return:
"""
return self._request_obj(self._urls["details"] % key... | class Keyword(TMDb):
_urls = {
"details": "/keyword/%s",
"movies": "/keyword/%s/movies"
}
def details(self, keyword_id):
"""
Get a keywords details by id.
:param keyword_id: int
:return:
"""
return self._request_obj(self._urls["details"] % key... | return self._request_obj(self._urls["movies"] % keyword_id, key="results")
| """
Get the movies of a keyword by id.
:param keyword_id: int
:return:
"""
return self._request_obj(self._urls["movies"] % keyword_id, key="results")
| 5 | 160 | 28 | 188 | from ..tmdb import TMDb
class Keyword(TMDb):
_urls = {
"details": "/keyword/%s",
"movies": "/keyword/%s/movies"
}
def details(self, keyword_id):
"""
Get a keywords details by id.
:param keyword_id: int
:return:
"""
return self._request_obj(s... | from ..tmdb import TMDb
class Keyword(TMDb):
_urls = {
"details": "/keyword/%s",
"movies": "/keyword/%s/movies"
}
def details(self, keyword_id):
"""
Get a keywords details by id.
:param keyword_id: int
:return:
"""
return self._request_obj(s... |
36,946 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/list.py | 63,64 | 4,97 | remove_movie | List | 69,76 | 64,76 | class List(TMDb):
_urls = {
"details": "/list/%s",
"check_status": "/list/%s/item_status",
"create": "/list",
"add_movie": "/list/%s/add_item",
"remove_movie": "/list/%s/remove_item",
"clear_list": "/list/%s/clear",
"delete_list": "/list/%s",
}
def de... | class List(TMDb):
_urls = {
"details": "/list/%s",
"check_status": "/list/%s/item_status",
"create": "/list",
"add_movie": "/list/%s/add_item",
"remove_movie": "/list/%s/remove_item",
"clear_list": "/list/%s/clear",
"delete_list": "/list/%s",
}
def de... | self._request_obj(
self._urls["remove_movie"] % list_id,
params="session_id=%s" % self.session_id,
method="POST",
json={"media_id": movie_id}
)
| """
Remove a movie from a list.
:param list_id: int
:param movie_id: int
"""
self._request_obj(
self._urls["remove_movie"] % list_id,
params="session_id=%s" % self.session_id,
method="POST",
json={"media_id": movie_id}
... | 11 | 803 | 75 | 878 | from ..tmdb import TMDb
class List(TMDb):
_urls = {
"details": "/list/%s",
"check_status": "/list/%s/item_status",
"create": "/list",
"add_movie": "/list/%s/add_item",
"remove_movie": "/list/%s/remove_item",
"clear_list": "/list/%s/clear",
"delete_list": "/l... | from ..tmdb import TMDb
class List(TMDb):
_urls = {
"details": "/list/%s",
"check_status": "/list/%s/item_status",
"create": "/list",
"add_movie": "/list/%s/add_item",
"remove_movie": "/list/%s/remove_item",
"clear_list": "/list/%s/clear",
"delete_list": "/l... |
36,948 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/network.py | 11,12 | 4,40 | details | Network | 17,19 | 12,19 | class Network(TMDb):
_urls = {
"details": "/network/%s",
"alternative_names": "/network/%s/alternative_names",
"images": "/network/%s/images"
}
def details(self, network_id):
FILL_FUNC_BODY def alternative_names(self, network_id):
"""
Get the alternative names of ... | class Network(TMDb):
_urls = {
"details": "/network/%s",
"alternative_names": "/network/%s/alternative_names",
"images": "/network/%s/images"
}
def details(self, network_id):
"""
Get a networks details by id.
:param network_id: int
:return:
""... | return self._request_obj(self._urls["details"] % network_id)
| """
Get a networks details by id.
:param network_id: int
:return:
"""
return self._request_obj(self._urls["details"] % network_id)
| 4 | 268 | 24 | 292 | from ..tmdb import TMDb
class Network(TMDb):
_urls = {
"details": "/network/%s",
"alternative_names": "/network/%s/alternative_names",
"images": "/network/%s/images"
}
def details(self, network_id):
FILL_FUNC_BODY def alternative_names(self, network_id):
"""
Get... | from ..tmdb import TMDb
class Network(TMDb):
_urls = {
"details": "/network/%s",
"alternative_names": "/network/%s/alternative_names",
"images": "/network/%s/images"
}
def details(self, network_id):
"""
Get a networks details by id.
:param network_id: int
... |
36,949 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/person.py | 19,20 | 4,138 | details | Person | 26,31 | 20,31 | class Person(TMDb):
_urls = {
"details": "/person/%s",
"changes": "/person/%s/changes",
"movie_credits": "/person/%s/movie_credits",
"tv_credits": "/person/%s/tv_credits",
"combined_credits": "/person/%s/combined_credits",
"external_ids": "/person/%s/external_ids",
... | class Person(TMDb):
_urls = {
"details": "/person/%s",
"changes": "/person/%s/changes",
"movie_credits": "/person/%s/movie_credits",
"tv_credits": "/person/%s/tv_credits",
"combined_credits": "/person/%s/combined_credits",
"external_ids": "/person/%s/external_ids",
... | return self._request_obj(
self._urls["details"] % person_id,
params="append_to_response=%s" % append_to_response
)
| """
Get the primary person details by id.
:param append_to_response: str
:param person_id: int
:return:
"""
return self._request_obj(
self._urls["details"] % person_id,
params="append_to_response=%s" % append_to_response
)
| 9 | 1,216 | 52 | 1,268 | from ..tmdb import TMDb
class Person(TMDb):
_urls = {
"details": "/person/%s",
"changes": "/person/%s/changes",
"movie_credits": "/person/%s/movie_credits",
"tv_credits": "/person/%s/tv_credits",
"combined_credits": "/person/%s/combined_credits",
"external_ids": "/p... | from ..tmdb import TMDb
class Person(TMDb):
_urls = {
"details": "/person/%s",
"changes": "/person/%s/changes",
"movie_credits": "/person/%s/movie_credits",
"tv_credits": "/person/%s/tv_credits",
"combined_credits": "/person/%s/combined_credits",
"external_ids": "/p... |
36,950 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/provider.py | 32,33 | 4,42 | tv_providers | Provider | 37,42 | 33,42 | class Provider(TMDb):
_urls = {
"regions": "/watch/providers/regions", # TODO:
"movie": "/watch/providers/movie", # TODO:
"tv": "/watch/providers/tv", # TODO:
}
def available_regions(self):
"""
Returns a list of all of the countries we have watch provider (OTT/str... | class Provider(TMDb):
_urls = {
"regions": "/watch/providers/regions", # TODO:
"movie": "/watch/providers/movie", # TODO:
"tv": "/watch/providers/tv", # TODO:
}
def available_regions(self):
"""
Returns a list of all of the countries we have watch provider (OTT/str... | return self._request_obj(
self._urls["tv"],
params="watch_region=%s" % region if region else "",
key="results"
)
| """
Returns a list of the watch provider (OTT/streaming) data we have available for TV series.
:return:
"""
return self._request_obj(
self._urls["tv"],
params="watch_region=%s" % region if region else "",
key="results"
)
| 12 | 302 | 51 | 353 | from ..tmdb import TMDb
class Provider(TMDb):
_urls = {
"regions": "/watch/providers/regions", # TODO:
"movie": "/watch/providers/movie", # TODO:
"tv": "/watch/providers/tv", # TODO:
}
def available_regions(self):
"""
Returns a list of all of the countries we ha... | from ..tmdb import TMDb
class Provider(TMDb):
_urls = {
"regions": "/watch/providers/regions", # TODO:
"movie": "/watch/providers/movie", # TODO:
"tv": "/watch/providers/tv", # TODO:
}
def available_regions(self):
"""
Returns a list of all of the countries we ha... |
36,951 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/review.py | 9,10 | 4,16 | details | Review | 15,16 | 10,16 | class Review(TMDb):
_urls = {
"details": "/review/%s",
}
def details(self, review_id):
FILL_FUNC_BODY | class Review(TMDb):
_urls = {
"details": "/review/%s",
}
def details(self, review_id):
"""
Get the primary person details by id.
:param review_id: int
:return:
"""
FILL_FUNC_BODY | return self._request_obj(self._urls["details"] % review_id)
| """
Get the primary person details by id.
:param review_id: int
:return:
"""
return self._request_obj(self._urls["details"] % review_id)
| 4 | 81 | 22 | 103 | from ..tmdb import TMDb
class Review(TMDb):
_urls = {
"details": "/review/%s",
}
def details(self, review_id):
FILL_FUNC_BODY | from ..tmdb import TMDb
class Review(TMDb):
_urls = {
"details": "/review/%s",
}
def details(self, review_id):
"""
Get the primary person details by id.
:param review_id: int
:return:
"""
FILL_FUNC_BODY |
36,952 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/search.py | 85,86 | 9,145 | multi | Search | 95,106 | 86,106 | class Search(TMDb):
_urls = {
"companies": "/search/company",
"collections": "/search/collection",
"keywords": "/search/keyword",
"movies": "/search/movie",
"multi": "/search/multi",
"people": "/search/person",
"tv_shows": "/search/tv",
}
def companie... | class Search(TMDb):
_urls = {
"companies": "/search/company",
"collections": "/search/collection",
"keywords": "/search/keyword",
"movies": "/search/movie",
"multi": "/search/multi",
"people": "/search/person",
"tv_shows": "/search/tv",
}
def companie... | params = "query=%s&page=%s" % (quote(term), page)
if adult is not None:
params += "&include_adult=%s" % "true" if adult else "false"
if region is not None:
params += "®ion=%s" % quote(region)
return self._request_obj(
self._urls["multi"],
... | """
Search multiple models in a single request.
Multi search currently supports searching for movies, tv shows and people in a single request.
:param term: str
:param adult: bool
:param region: str
:param page: int
:return:
"""
params = "qu... | 36 | 1,123 | 125 | 1,248 | from ..tmdb import TMDb
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
class Search(TMDb):
_urls = {
"companies": "/search/company",
"collections": "/search/collection",
"keywords": "/search/keyword",
"movies": "/search/movie",
"mu... | from ..tmdb import TMDb
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
class Search(TMDb):
_urls = {
"companies": "/search/company",
"collections": "/search/collection",
"keywords": "/search/keyword",
"movies": "/search/movie",
"mu... |
36,953 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/season.py | 84,85 | 4,134 | external_ids | Season | 91,93 | 85,93 | class Season(TMDb):
_urls = {
"details": "/tv/%s/season/%s",
"account_states": "/tv/%s/season/%s/account_states",
"aggregate_credits": "/tv/%s/season/%s/aggregate_credits",
"changes": "/tv/season/%s/changes",
"credits": "/tv/%s/season/%s/credits",
"external_ids": "/tv... | class Season(TMDb):
_urls = {
"details": "/tv/%s/season/%s",
"account_states": "/tv/%s/season/%s/account_states",
"aggregate_credits": "/tv/%s/season/%s/aggregate_credits",
"changes": "/tv/season/%s/changes",
"credits": "/tv/%s/season/%s/credits",
"external_ids": "/tv... | return self._request_obj(self._urls["external_ids"] % (tv_id, season_num))
| """
Get the external ids for a TV season.
:param tv_id: int
:param season_num: int
:return:
"""
return self._request_obj(self._urls["external_ids"] % (tv_id, season_num))
| 5 | 1,377 | 31 | 1,408 | from ..tmdb import TMDb
class Season(TMDb):
_urls = {
"details": "/tv/%s/season/%s",
"account_states": "/tv/%s/season/%s/account_states",
"aggregate_credits": "/tv/%s/season/%s/aggregate_credits",
"changes": "/tv/season/%s/changes",
"credits": "/tv/%s/season/%s/credits",
... | from ..tmdb import TMDb
class Season(TMDb):
_urls = {
"details": "/tv/%s/season/%s",
"account_states": "/tv/%s/season/%s/account_states",
"aggregate_credits": "/tv/%s/season/%s/aggregate_credits",
"changes": "/tv/season/%s/changes",
"credits": "/tv/%s/season/%s/credits",
... |
36,954 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/themoviedb/tmdbv3api/objs/trending.py | 38,39 | 4,77 | movie_week | Trending | 44,46 | 39,46 | class Trending(TMDb):
_urls = {"trending": "/trending/%s/%s"}
def _trending(self, media_type="all", time_window="day", page=1):
return self._request_obj(
self._urls["trending"] % (media_type, time_window),
params="page=%s" % page,
key="results",
)
def al... | class Trending(TMDb):
_urls = {"trending": "/trending/%s/%s"}
def _trending(self, media_type="all", time_window="day", page=1):
return self._request_obj(
self._urls["trending"] % (media_type, time_window),
params="page=%s" % page,
key="results",
)
def al... | return self._trending(media_type="movie", time_window="week", page=page)
| """
Get movie weekly trending
:param page: int
:return:
"""
return self._trending(media_type="movie", time_window="week", page=page)
| 4 | 625 | 31 | 656 | from ..tmdb import TMDb
class Trending(TMDb):
_urls = {"trending": "/trending/%s/%s"}
def _trending(self, media_type="all", time_window="day", page=1):
return self._request_obj(
self._urls["trending"] % (media_type, time_window),
params="page=%s" % page,
key="resul... | from ..tmdb import TMDb
class Trending(TMDb):
_urls = {"trending": "/trending/%s/%s"}
def _trending(self, media_type="all", time_window="day", page=1):
return self._request_obj(
self._urls["trending"] % (media_type, time_window),
params="page=%s" % page,
key="resul... |
36,957 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/vocechat/vocechat.py | 93,94 | 16,192 | send_medias_msg | VoceChat | 97,129 | 94,129 | class VoceChat:
# host
_host = None
# apikey
_apikey = None
# 频道ID
_channel_id = None
# 请求对象
_client = None
def __init__(self):
"""
初始化
"""
self._host = settings.VOCECHAT_HOST
if self._host:
if not self._host.endswith("/"):
... | class VoceChat:
# host
_host = None
# apikey
_apikey = None
# 频道ID
_channel_id = None
# 请求对象
_client = None
def __init__(self):
"""
初始化
"""
self._host = settings.VOCECHAT_HOST
if self._host:
if not self._host.endswith("/"):
... | if not self._client:
return None
try:
index, caption = 1, "**%s**" % title
for media in medias:
if media.vote_average:
caption = "%s\n%s. [%s](%s)\n_%s,%s_" % (caption,
i... | """
发送列表类消息
"""
if not self._client:
return None
try:
index, caption = 1, "**%s**" % title
for media in medias:
if media.vote_average:
caption = "%s\n%s. [%s](%s)\n_%s,%s_" % (caption,
... | 63 | 1,406 | 344 | 1,750 | import re
import threading
from typing import Optional, List
from app.core.config import settings
from app.core.context import MediaInfo, Context
from app.core.metainfo import MetaInfo
from app.log import logger
from app.utils.common import retry
from app.utils.http import RequestUtils
from app.utils.string import Str... | import re
import threading
from typing import Optional, List
from app.core.config import settings
from app.core.context import MediaInfo, Context
from app.core.metainfo import MetaInfo
from app.log import logger
from app.utils.common import retry
from app.utils.http import RequestUtils
from app.utils.string import Str... |
36,959 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/wechat/WXBizMsgCrypt3.py | 124,125 | 119,150 | encode | PKCS7Encoder | 129,138 | 125,138 | class PKCS7Encoder:
"""提供基于PKCS7算法的加解密接口"""
block_size = 32
def encode(self, text):
FILL_FUNC_BODY @staticmethod
def decode(decrypted):
"""删除解密后明文的补位字符
@param decrypted: 解密后的明文
@return: 删除补位字符后的明文
"""
pad = ord(decrypted[-1])
if pad < 1 or pad > 32:
... | class PKCS7Encoder:
"""提供基于PKCS7算法的加解密接口"""
block_size = 32
def encode(self, text):
""" 对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
"""
FILL_FUNC_BODY @staticmethod
def decode(decrypted):
"""删除解密后明文的补位字符
@param decrypted: 解密后的明文
... | text_length = len(text)
# 计算需要填充的位数
amount_to_pad = self.block_size - (text_length % self.block_size)
if amount_to_pad == 0:
amount_to_pad = self.block_size
# 获得补位所用的字符
pad = chr(amount_to_pad)
return text + (pad * amount_to_pad).encode()
| """ 对需要加密的明文进行填充补位
@param text: 需要进行填充补位操作的明文
@return: 补齐明文字符串
"""
text_length = len(text)
# 计算需要填充的位数
amount_to_pad = self.block_size - (text_length % self.block_size)
if amount_to_pad == 0:
amount_to_pad = self.block_size
# 获得补位所用的字符
... | 30 | 201 | 120 | 321 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... |
36,960 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/wechat/WXBizMsgCrypt3.py | 184,185 | 150,225 | decrypt | Prpcrypt | 190,217 | 185,217 | class Prpcrypt(object):
"""提供接收和推送给企业微信消息的加解密接口"""
def __init__(self, key):
# self.key = base64.b64decode(key+"=")
self.key = key
# 设置加解密模式为AES的CBC模式
self.mode = AES.MODE_CBC
def encrypt(self, text, receiveid):
"""对明文进行加密
@param text: 需要加密的明文
@param... | class Prpcrypt(object):
"""提供接收和推送给企业微信消息的加解密接口"""
def __init__(self, key):
# self.key = base64.b64decode(key+"=")
self.key = key
# 设置加解密模式为AES的CBC模式
self.mode = AES.MODE_CBC
def encrypt(self, text, receiveid):
"""对明文进行加密
@param text: 需要加密的明文
@param... | try:
cryptor = AES.new(self.key, self.mode, self.key[:16])
# 使用BASE64对密文进行解码,然后AES-CBC解密
plain_text = cryptor.decrypt(base64.b64decode(text))
except Exception as e:
logger = logging.getLogger()
logger.error(e)
return WXBizMsgCrypt_D... | """对解密后的明文进行补位删除
@param text: 密文
@param receiveid: receiveid
@return: 删除填充补位后的明文
"""
try:
cryptor = AES.new(self.key, self.mode, self.key[:16])
# 使用BASE64对密文进行解码,然后AES-CBC解密
plain_text = cryptor.decrypt(base64.b64decode(text))
e... | 78 | 570 | 377 | 947 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... |
36,961 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/wechat/WXBizMsgCrypt3.py | 54,56 | 51,75 | getSHA1 | SHA1 | 63,75 | 56,75 | class SHA1:
"""计算企业微信的消息签名接口"""
@staticmethod
def getSHA1(token, timestamp, nonce, encrypt):
FILL_FUNC_BODY | class SHA1:
"""计算企业微信的消息签名接口"""
@staticmethod
def getSHA1(token, timestamp, nonce, encrypt):
"""用SHA1算法生成安全签名
@param token: 票据
@param timestamp: 时间戳
@param encrypt: 密文
@param nonce: 随机字符串
@return: 安全签名
"""
FILL_FUNC_BODY | try:
sortlist = [token, timestamp, nonce, encrypt]
sortlist.sort()
sha = hashlib.sha1()
sha.update("".join(sortlist).encode())
return WXBizMsgCrypt_OK, sha.hexdigest()
except Exception as e:
logger = logging.getLogger()
... | """用SHA1算法生成安全签名
@param token: 票据
@param timestamp: 时间戳
@param encrypt: 密文
@param nonce: 随机字符串
@return: 安全签名
"""
try:
sortlist = [token, timestamp, nonce, encrypt]
sortlist.sort()
sha = hashlib.sha1()
sha.up... | 26 | 122 | 126 | 248 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... |
36,962 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/wechat/WXBizMsgCrypt3.py | 257,258 | 225,301 | EncryptMsg | WXBizMsgCrypt | 258,279 | 258,279 | class WXBizMsgCrypt(object):
# 构造函数
def __init__(self, sToken, sEncodingAESKey, sReceiveId):
try:
self.key = base64.b64decode(sEncodingAESKey + "=")
assert len(self.key) == 32
except Exception as err:
print(str(err))
throw_exception("[error]: Encod... | class WXBizMsgCrypt(object):
# 构造函数
def __init__(self, sToken, sEncodingAESKey, sReceiveId):
try:
self.key = base64.b64decode(sEncodingAESKey + "=")
assert len(self.key) == 32
except Exception as err:
print(str(err))
throw_exception("[error]: Encod... | # 将企业回复用户的消息加密打包
# @param sReplyMsg: 企业号待回复用户的消息,xml格式的字符串
# @param sTimeStamp: 时间戳,可以自己生成,也可以用URL参数的timestamp,如为None则自动用当前时间
# @param sNonce: 随机串,可以自己生成,也可以用URL参数的nonce
# sEncryptMsg: 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串,
# return:成功0,sEnc... | # 将企业回复用户的消息加密打包
# @param sReplyMsg: 企业号待回复用户的消息,xml格式的字符串
# @param sTimeStamp: 时间戳,可以自己生成,也可以用URL参数的timestamp,如为None则自动用当前时间
# @param sNonce: 随机串,可以自己生成,也可以用URL参数的nonce
# sEncryptMsg: 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串,
# return:成功0,sEnc... | 75 | 847 | 363 | 1,210 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... |
36,963 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/modules/wechat/WXBizMsgCrypt3.py | 86,88 | 75,119 | extract | XMLParse | 92,101 | 88,101 | class XMLParse:
"""提供提取消息格式中的密文及生成回复消息格式的接口"""
# xml消息模板
AES_TEXT_RESPONSE_TEMPLATE = """<xml>
<Encrypt><![CDATA[%(msg_encrypt)s]]></Encrypt>
<MsgSignature><![CDATA[%(msg_signaturet)s]]></MsgSignature>
<TimeStamp>%(timestamp)s</TimeStamp>
<Nonce><![CDATA[%(nonce)s]]></Nonce>
</xml>"""
@staticmethod
... | class XMLParse:
"""提供提取消息格式中的密文及生成回复消息格式的接口"""
# xml消息模板
AES_TEXT_RESPONSE_TEMPLATE = """<xml>
<Encrypt><![CDATA[%(msg_encrypt)s]]></Encrypt>
<MsgSignature><![CDATA[%(msg_signaturet)s]]></MsgSignature>
<TimeStamp>%(timestamp)s</TimeStamp>
<Nonce><![CDATA[%(nonce)s]]></Nonce>
</xml>"""
@staticmethod
... | try:
xml_tree = ET.fromstring(xmltext)
encrypt = xml_tree.find("Encrypt")
return WXBizMsgCrypt_OK, encrypt.text
except Exception as e:
logger = logging.getLogger()
logger.error(e)
return WXBizMsgCrypt_ParseXml_Error, None
| """提取出xml数据包中的加密消息
@param xmltext: 待提取的xml字符串
@return: 提取出的加密消息字符串
"""
try:
xml_tree = ET.fromstring(xmltext)
encrypt = xml_tree.find("Encrypt")
return WXBizMsgCrypt_OK, encrypt.text
except Exception as e:
logger = logging.g... | 21 | 385 | 100 | 485 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
""" 对企业微信发送给企业后台的消息加解密示例代码.
@copyright: Copyright (c) 1998-2014 Tencent Inc.
"""
import base64
import hashlib
# ------------------------------------------------------------------------
import logging
import random
import socket
import struct
import time
import xml.etree.... |
36,965 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/common.py | 42,43 | 1,85 | bytes_to_key | 43,54 | 43,54 | import base64
import time
from hashlib import md5
from typing import Any
from Crypto import Random
from Crypto.Cipher import AES
def retry(ExceptionToCheck: Any,
tries: int = 3, delay: int = 3, backoff: int = 2, logger: Any = None):
"""
:param ExceptionToCheck: 需要捕获的异常
:param tries: 重试次数
:p... | import base64
import time
from hashlib import md5
from typing import Any
from Crypto import Random
from Crypto.Cipher import AES
def retry(ExceptionToCheck: Any,
tries: int = 3, delay: int = 3, backoff: int = 2, logger: Any = None):
"""
:param ExceptionToCheck: 需要捕获的异常
:param tries: 重试次数
:p... | # extended from https://gist.github.com/gsakkis/4546068
assert len(salt) == 8, len(salt)
data += salt
key = md5(data).digest()
final_key = key
while len(final_key) < output:
key = md5(key + data).digest()
final_key += key
return final_key[:output]
| # extended from https://gist.github.com/gsakkis/4546068
assert len(salt) == 8, len(salt)
data += salt
key = md5(data).digest()
final_key = key
while len(final_key) < output:
key = md5(key + data).digest()
final_key += key
return final_key[:output]
| 32 | 785 | 121 | 906 | import base64
import time
from hashlib import md5
from typing import Any
from Crypto import Random
from Crypto.Cipher import AES
def retry(ExceptionToCheck: Any,
tries: int = 3, delay: int = 3, backoff: int = 2, logger: Any = None):
"""
:param ExceptionToCheck: 需要捕获的异常
:param tries: 重试次数
:p... | import base64
import time
from hashlib import md5
from typing import Any
from Crypto import Random
from Crypto.Cipher import AES
def retry(ExceptionToCheck: Any,
tries: int = 3, delay: int = 3, backoff: int = 2, logger: Any = None):
"""
:param ExceptionToCheck: 需要捕获的异常
:param tries: 重试次数
:p... | |
36,966 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/dom.py | 6,8 | 4,34 | tag_value | DomUtils | 11,23 | 8,23 | class DomUtils:
@staticmethod
def tag_value(tag_item, tag_name: str, attname: str = "", default: Union[str, int] = None):
FILL_FUNC_BODY @staticmethod
def add_node(doc, parent, name: str, value: str = None):
"""
添加一个DOM节点
"""
node = doc.createElement(name)
parent.... | class DomUtils:
@staticmethod
def tag_value(tag_item, tag_name: str, attname: str = "", default: Union[str, int] = None):
"""
解析XML标签值
"""
FILL_FUNC_BODY @staticmethod
def add_node(doc, parent, name: str, value: str = None):
"""
添加一个DOM节点
"""
node ... | tagNames = tag_item.getElementsByTagName(tag_name)
if tagNames:
if attname:
attvalue = tagNames[0].getAttribute(attname)
if attvalue:
return attvalue
else:
firstChild = tagNames[0].firstChild
if f... | """
解析XML标签值
"""
tagNames = tag_item.getElementsByTagName(tag_name)
if tagNames:
if attname:
attvalue = tagNames[0].getAttribute(attname)
if attvalue:
return attvalue
else:
firstChild = ta... | 24 | 164 | 104 | 268 | from typing import Union
class DomUtils:
@staticmethod
def tag_value(tag_item, tag_name: str, attname: str = "", default: Union[str, int] = None):
FILL_FUNC_BODY @staticmethod
def add_node(doc, parent, name: str, value: str = None):
"""
添加一个DOM节点
"""
node = doc.createEl... | from typing import Union
class DomUtils:
@staticmethod
def tag_value(tag_item, tag_name: str, attname: str = "", default: Union[str, int] = None):
"""
解析XML标签值
"""
FILL_FUNC_BODY @staticmethod
def add_node(doc, parent, name: str, value: str = None):
"""
添加一个DOM节... |
36,967 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/http.py | 170,172 | 11,193 | cookie_parse | RequestUtils | 178,193 | 172,193 | class RequestUtils:
_headers: dict = None
_cookies: Union[str, dict] = None
_proxies: dict = None
_timeout: int = 20
_session: Session = None
def __init__(self,
headers: dict = None,
ua: str = None,
cookies: Union[str, dict] = None,
... | class RequestUtils:
_headers: dict = None
_cookies: Union[str, dict] = None
_proxies: dict = None
_timeout: int = 20
_session: Session = None
def __init__(self,
headers: dict = None,
ua: str = None,
cookies: Union[str, dict] = None,
... | if not cookies_str:
return {}
cookie_dict = {}
cookies = cookies_str.split(';')
for cookie in cookies:
cstr = cookie.split('=')
if len(cstr) > 1:
cookie_dict[cstr[0].strip()] = cstr[1].strip()
if array:
cookiesList =... | """
解析cookie,转化为字典或者数组
:param cookies_str: cookie字符串
:param array: 是否转化为数组
:return: 字典或者数组
"""
if not cookies_str:
return {}
cookie_dict = {}
cookies = cookies_str.split(';')
for cookie in cookies:
cstr = cookie.spli... | 46 | 1,406 | 160 | 1,566 | from typing import Union, Any, Optional
import requests
import urllib3
from requests import Session, Response
from urllib3.exceptions import InsecureRequestWarning
urllib3.disable_warnings(InsecureRequestWarning)
class RequestUtils:
_headers: dict = None
_cookies: Union[str, dict] = None
_proxies: dict ... | from typing import Union, Any, Optional
import requests
import urllib3
from requests import Session, Response
from urllib3.exceptions import InsecureRequestWarning
urllib3.disable_warnings(InsecureRequestWarning)
class RequestUtils:
_headers: dict = None
_cookies: Union[str, dict] = None
_proxies: dict ... |
36,968 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/ip.py | 36,38 | 6,82 | is_internal | IpUtils | 41,47 | 38,47 | class IpUtils:
@staticmethod
def is_ipv4(ip):
"""
判断是不是ipv4
"""
try:
socket.inet_pton(socket.AF_INET, ip)
except AttributeError: # no inet_pton here,sorry
try:
socket.inet_aton(ip)
except socket.error:
... | class IpUtils:
@staticmethod
def is_ipv4(ip):
"""
判断是不是ipv4
"""
try:
socket.inet_pton(socket.AF_INET, ip)
except AttributeError: # no inet_pton here,sorry
try:
socket.inet_aton(ip)
except socket.error:
... | hostname = urlparse(hostname).hostname
if IpUtils.is_ip(hostname):
return IpUtils.is_private_ip(hostname)
else:
return IpUtils.is_internal_domain(hostname)
| """
判断一个host是内网还是外网
"""
hostname = urlparse(hostname).hostname
if IpUtils.is_ip(hostname):
return IpUtils.is_private_ip(hostname)
else:
return IpUtils.is_internal_domain(hostname)
| 10 | 486 | 70 | 556 | import ipaddress
import socket
from urllib.parse import urlparse
class IpUtils:
@staticmethod
def is_ipv4(ip):
"""
判断是不是ipv4
"""
try:
socket.inet_pton(socket.AF_INET, ip)
except AttributeError: # no inet_pton here,sorry
try:
soc... | import ipaddress
import socket
from urllib.parse import urlparse
class IpUtils:
@staticmethod
def is_ipv4(ip):
"""
判断是不是ipv4
"""
try:
socket.inet_pton(socket.AF_INET, ip)
except AttributeError: # no inet_pton here,sorry
try:
soc... |
36,969 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/object.py | 8,10 | 6,70 | is_obj | ObjectUtils | 10,23 | 10,23 | class ObjectUtils:
@staticmethod
def is_obj(obj: Any):
FILL_FUNC_BODY @staticmethod
def arguments(func: Callable) -> int:
"""
返回函数的参数个数
"""
signature = inspect.signature(func)
parameters = signature.parameters
return len(list(parameters.keys()))
@sta... | class ObjectUtils:
@staticmethod
def is_obj(obj: Any):
FILL_FUNC_BODY @staticmethod
def arguments(func: Callable) -> int:
"""
返回函数的参数个数
"""
signature = inspect.signature(func)
parameters = signature.parameters
return len(list(parameters.keys()))
@sta... | if isinstance(obj, list) \
or isinstance(obj, dict) \
or isinstance(obj, tuple):
return True
elif isinstance(obj, int) \
or isinstance(obj, float) \
or isinstance(obj, bool) \
or isinstance(obj, bytes):
... | if isinstance(obj, list) \
or isinstance(obj, dict) \
or isinstance(obj, tuple):
return True
elif isinstance(obj, int) \
or isinstance(obj, float) \
or isinstance(obj, bool) \
or isinstance(obj, bytes):
... | 36 | 416 | 128 | 544 | import inspect
from types import FunctionType
from typing import Any, Callable
class ObjectUtils:
@staticmethod
def is_obj(obj: Any):
FILL_FUNC_BODY @staticmethod
def arguments(func: Callable) -> int:
"""
返回函数的参数个数
"""
signature = inspect.signature(func)
paramet... | import inspect
from types import FunctionType
from typing import Any, Callable
class ObjectUtils:
@staticmethod
def is_obj(obj: Any):
FILL_FUNC_BODY @staticmethod
def arguments(func: Callable) -> int:
"""
返回函数的参数个数
"""
signature = inspect.signature(func)
paramet... |
36,970 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/otp.py | 27,29 | 4,49 | check | OtpUtils | 32,39 | 29,39 | class OtpUtils:
@staticmethod
def generate_secret_key(username: str) -> (str, str):
try:
secret = pyotp.random_base32()
uri = pyotp.totp.TOTP(secret).provisioning_uri(name='MoviePilot',
issuer_name='MoviePilot(' + usernam... | class OtpUtils:
@staticmethod
def generate_secret_key(username: str) -> (str, str):
try:
secret = pyotp.random_base32()
uri = pyotp.totp.TOTP(secret).provisioning_uri(name='MoviePilot',
issuer_name='MoviePilot(' + usernam... | try:
totp = pyotp.TOTP(secret)
return totp.verify(password)
except Exception as err:
print(str(err))
return False
| """
校验二次验证是否正确
"""
try:
totp = pyotp.TOTP(secret)
return totp.verify(password)
except Exception as err:
print(str(err))
return False
| 13 | 353 | 57 | 410 | import pyotp
class OtpUtils:
@staticmethod
def generate_secret_key(username: str) -> (str, str):
try:
secret = pyotp.random_base32()
uri = pyotp.totp.TOTP(secret).provisioning_uri(name='MoviePilot',
issuer_name='MoviePi... | import pyotp
class OtpUtils:
@staticmethod
def generate_secret_key(username: str) -> (str, str):
try:
secret = pyotp.random_base32()
uri = pyotp.totp.TOTP(secret).provisioning_uri(name='MoviePilot',
issuer_name='MoviePi... |
36,971 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/site.py | 35,37 | 4,63 | is_checkin | SiteUtils | 41,63 | 37,63 | class SiteUtils:
@classmethod
def is_logged_in(cls, html_text: str) -> bool:
"""
判断站点是否已经登陆
:param html_text:
:return:
"""
html = etree.HTML(html_text)
if not html:
return False
# 存在明显的密码输入框,说明未登录
if html.xpath("//input[@type='... | class SiteUtils:
@classmethod
def is_logged_in(cls, html_text: str) -> bool:
"""
判断站点是否已经登陆
:param html_text:
:return:
"""
html = etree.HTML(html_text)
if not html:
return False
# 存在明显的密码输入框,说明未登录
if html.xpath("//input[@type='... | html = etree.HTML(html_text)
if not html:
return False
# 站点签到支持的识别XPATH
xpaths = [
'//a[@id="signed"]',
'//a[contains(@href, "attendance")]',
'//a[contains(text(), "签到")]',
'//a/b[contains(text(), "签 到")]',
'//span[@... | """
判断站点是否已经签到
:return True已签到 False未签到
"""
html = etree.HTML(html_text)
if not html:
return False
# 站点签到支持的识别XPATH
xpaths = [
'//a[@id="signed"]',
'//a[contains(@href, "attendance")]',
'//a[contains(text(), ... | 43 | 358 | 289 | 647 | from lxml import etree
class SiteUtils:
@classmethod
def is_logged_in(cls, html_text: str) -> bool:
"""
判断站点是否已经登陆
:param html_text:
:return:
"""
html = etree.HTML(html_text)
if not html:
return False
# 存在明显的密码输入框,说明未登录
if ht... | from lxml import etree
class SiteUtils:
@classmethod
def is_logged_in(cls, html_text: str) -> bool:
"""
判断站点是否已经登陆
:param html_text:
:return:
"""
html = etree.HTML(html_text)
if not html:
return False
# 存在明显的密码输入框,说明未登录
if ht... |
36,974 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/timer.py | 8,14 | 6,82 | random_scheduler | TimerUtils | 22,44 | 14,44 | class TimerUtils:
@staticmethod
def random_scheduler(num_executions: int = 1,
begin_hour: int = 7,
end_hour: int = 23,
min_interval: int = 20,
max_interval: int = 40) -> List[datetime.datetime]:
FILL_FUNC_BODY ... | class TimerUtils:
@staticmethod
def random_scheduler(num_executions: int = 1,
begin_hour: int = 7,
end_hour: int = 23,
min_interval: int = 20,
max_interval: int = 40) -> List[datetime.datetime]:
"""
... | trigger: list = []
# 当前时间
now = datetime.datetime.now()
# 创建随机的时间触发器
random_trigger = now.replace(hour=begin_hour, minute=0, second=0, microsecond=0)
for _ in range(num_executions):
# 随机生成下一个任务的时间间隔
interval_minutes = random.randint(min_interval, m... | """
按执行次数生成随机定时器
:param num_executions: 执行次数
:param begin_hour: 开始时间
:param end_hour: 结束时间
:param min_interval: 最小间隔分钟
:param max_interval: 最大间隔分钟
"""
trigger: list = []
# 当前时间
now = datetime.datetime.now()
# 创建随机的时间触发器
... | 57 | 563 | 270 | 833 | import random
from typing import List
import datetime
class TimerUtils:
@staticmethod
def random_scheduler(num_executions: int = 1,
begin_hour: int = 7,
end_hour: int = 23,
min_interval: int = 20,
max_interval... | import random
from typing import List
import datetime
class TimerUtils:
@staticmethod
def random_scheduler(num_executions: int = 1,
begin_hour: int = 7,
end_hour: int = 23,
min_interval: int = 20,
max_interval... |
36,975 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/tokens.py | 20,21 | 4,39 | cur | Tokens | 21,27 | 21,27 | class Tokens:
_text: str = ""
_index: int = 0
_tokens: list = []
def __init__(self, text):
self._text = text
self._tokens = []
self.load_text(text)
def load_text(self, text):
splitted_text = re.split(r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~", text)
... | class Tokens:
_text: str = ""
_index: int = 0
_tokens: list = []
def __init__(self, text):
self._text = text
self._tokens = []
self.load_text(text)
def load_text(self, text):
splitted_text = re.split(r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~", text)
... | if self._index >= len(self._tokens):
return None
else:
token = self._tokens[self._index]
return token
| if self._index >= len(self._tokens):
return None
else:
token = self._tokens[self._index]
return token
| 12 | 273 | 46 | 319 | import re
class Tokens:
_text: str = ""
_index: int = 0
_tokens: list = []
def __init__(self, text):
self._text = text
self._tokens = []
self.load_text(text)
def load_text(self, text):
splitted_text = re.split(r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~", te... | import re
class Tokens:
_text: str = ""
_index: int = 0
_tokens: list = []
def __init__(self, text):
self._text = text
self._tokens = []
self.load_text(text)
def load_text(self, text):
splitted_text = re.split(r"\.|\s+|\(|\)|\[|]|-|\+|【|】|/|~|;|&|\||#|_|「|」|~", te... |
36,976 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/app/utils/web.py | 15,17 | 6,91 | get_location1 | WebUtils | 42,50 | 17,50 | class WebUtils:
@staticmethod
def get_location(ip: str):
"""
查询IP所属地
"""
return WebUtils.get_location1(ip) or WebUtils.get_location2(ip)
@staticmethod
def get_location1(ip: str):
FILL_FUNC_BODY @staticmethod
def get_location2(ip: str):
"""
https:/... | class WebUtils:
@staticmethod
def get_location(ip: str):
"""
查询IP所属地
"""
return WebUtils.get_location1(ip) or WebUtils.get_location2(ip)
@staticmethod
def get_location1(ip: str):
"""
https://api.mir6.com/api/ip
{
"code": 200,
... | try:
with RequestUtils().get_res(f"https://api.mir6.com/api/ip?ip={ip}&type=json") as r:
if r:
return r.json().get("data", {}).get("location") or ''
except Exception as err:
print(str(err))
return ""
| """
https://api.mir6.com/api/ip
{
"code": 200,
"msg": "success",
"data": {
"ip": "240e:97c:2f:1::5c",
"dec": "47925092370311863177116789888333643868",
"country": "中国",
"countryCode": "CN",
... | 19 | 809 | 93 | 902 | from typing import Optional
from app.utils.http import RequestUtils
class WebUtils:
@staticmethod
def get_location(ip: str):
"""
查询IP所属地
"""
return WebUtils.get_location1(ip) or WebUtils.get_location2(ip)
@staticmethod
def get_location1(ip: str):
FILL_FUNC_BODY @s... | from typing import Optional
from app.utils.http import RequestUtils
class WebUtils:
@staticmethod
def get_location(ip: str):
"""
查询IP所属地
"""
return WebUtils.get_location1(ip) or WebUtils.get_location2(ip)
@staticmethod
def get_location1(ip: str):
"""
... |
36,977 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/06abf3e7090b_1_0_11.py | 19,20 | 1,31 | upgrade | 20,29 | 20,29 | """1.0.11
Revision ID: 06abf3e7090b
Revises: d633ca6cd572
Create Date: 2023-10-27 12:22:56.213376
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '06abf3e7090b'
down_revision = 'd633ca6cd572'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | """1.0.11
Revision ID: 06abf3e7090b
Revises: d633ca6cd572
Create Date: 2023-10-27 12:22:56.213376
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '06abf3e7090b'
down_revision = 'd633ca6cd572'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("downloadhistory") as batch_op:
batch_op.add_column(sa.Column('username', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("downloadhistory") as batch_op:
batch_op.add_column(sa.Column('username', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| 30 | 184 | 101 | 285 | """1.0.11
Revision ID: 06abf3e7090b
Revises: d633ca6cd572
Create Date: 2023-10-27 12:22:56.213376
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '06abf3e7090b'
down_revision = 'd633ca6cd572'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | """1.0.11
Revision ID: 06abf3e7090b
Revises: d633ca6cd572
Create Date: 2023-10-27 12:22:56.213376
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '06abf3e7090b'
down_revision = 'd633ca6cd572'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | |
36,978 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/127a25fdf0e8_1_0_13.py | 21,22 | 1,31 | upgrade | 22,29 | 22,29 | """1.0.13
Revision ID: 127a25fdf0e8
Revises: d71e624f0208
Create Date: 2024-02-24 03:11:32.005540
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '127a25fdf0e8'
down_revision = 'd71e624f0208'
branch_labels = None
depends_on = None
def upgra... | """1.0.13
Revision ID: 127a25fdf0e8
Revises: d71e624f0208
Create Date: 2024-02-24 03:11:32.005540
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '127a25fdf0e8'
down_revision = 'd71e624f0208'
branch_labels = None
depends_on = None
def upgra... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('search_imdbid', sa.Integer, nullable=True))
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('search_imdbid', sa.Integer, nullable=True))
# ### end Alembic commands ###
| 26 | 193 | 99 | 292 | """1.0.13
Revision ID: 127a25fdf0e8
Revises: d71e624f0208
Create Date: 2024-02-24 03:11:32.005540
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '127a25fdf0e8'
down_revision = 'd71e624f0208'
branch_labels = None
depends_on = None
def upgra... | """1.0.13
Revision ID: 127a25fdf0e8
Revises: d71e624f0208
Create Date: 2024-02-24 03:11:32.005540
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '127a25fdf0e8'
down_revision = 'd71e624f0208'
branch_labels = None
depends_on = None
def upgra... | |
36,979 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/14f1813ae8e3_1_0_1.py | 19,20 | 1,32 | upgrade | 20,30 | 20,30 | """1.0.1
Revision ID: 14f1813ae8e3
Revises: 9f4edd55c2d4
Create Date: 2023-07-27 12:34:57.839443
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '14f1813ae8e3'
down_revision = '9f4edd55c2d4'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | """1.0.1
Revision ID: 14f1813ae8e3
Revises: 9f4edd55c2d4
Create Date: 2023-07-27 12:34:57.839443
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '14f1813ae8e3'
down_revision = '9f4edd55c2d4'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('best_version', sa.Integer, nullable=True))
batch_op.add_column(sa.Column('current_priority', sa.Integer, nullable=True))
excep... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('best_version', sa.Integer, nullable=True))
batch_op.add_column(sa.Column('current_priority', sa.Integer, nullable=True))
excep... | 33 | 186 | 131 | 317 | """1.0.1
Revision ID: 14f1813ae8e3
Revises: 9f4edd55c2d4
Create Date: 2023-07-27 12:34:57.839443
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '14f1813ae8e3'
down_revision = '9f4edd55c2d4'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | """1.0.1
Revision ID: 14f1813ae8e3
Revises: 9f4edd55c2d4
Create Date: 2023-07-27 12:34:57.839443
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '14f1813ae8e3'
down_revision = '9f4edd55c2d4'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | |
36,980 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/1e169250e949_1_0_4.py | 19,20 | 1,31 | upgrade | 20,29 | 20,29 | """1.0.4
Revision ID: 1e169250e949
Revises: 52ab4930be04
Create Date: 2023-09-01 09:56:33.907661
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e169250e949'
down_revision = '52ab4930be04'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | """1.0.4
Revision ID: 1e169250e949
Revises: 52ab4930be04
Create Date: 2023-09-01 09:56:33.907661
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e169250e949'
down_revision = '52ab4930be04'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('date', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('date', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| 30 | 186 | 100 | 286 | """1.0.4
Revision ID: 1e169250e949
Revises: 52ab4930be04
Create Date: 2023-09-01 09:56:33.907661
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e169250e949'
down_revision = '52ab4930be04'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | """1.0.4
Revision ID: 1e169250e949
Revises: 52ab4930be04
Create Date: 2023-09-01 09:56:33.907661
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e169250e949'
down_revision = '52ab4930be04'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | |
36,981 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/232dfa044617_1_0_6.py | 17,18 | 1,39 | upgrade | 18,37 | 18,37 | """1.0.6
Revision ID: 232dfa044617
Revises: e734c7fe6056
Create Date: 2023-09-19 21:34:41.994617
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '232dfa044617'
down_revision = 'e734c7fe6056'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1.0.6
Revision ID: 232dfa044617
Revises: e734c7fe6056
Create Date: 2023-09-19 21:34:41.994617
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '232dfa044617'
down_revision = 'e734c7fe6056'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | # ### commands auto generated by Alembic - please adjust! ###
# 搜索优先级
op.execute("delete from systemconfig where key = 'SearchFilterRules';")
op.execute(
"insert into systemconfig(key, value) VALUES('SearchFilterRules', (select value from systemconfig where key= 'FilterRules'));")
# 订阅优先级
... | # ### commands auto generated by Alembic - please adjust! ###
# 搜索优先级
op.execute("delete from systemconfig where key = 'SearchFilterRules';")
op.execute(
"insert into systemconfig(key, value) VALUES('SearchFilterRules', (select value from systemconfig where key= 'FilterRules'));")
# 订阅优先级
... | 99 | 176 | 311 | 487 | """1.0.6
Revision ID: 232dfa044617
Revises: e734c7fe6056
Create Date: 2023-09-19 21:34:41.994617
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '232dfa044617'
down_revision = 'e734c7fe6056'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1.0.6
Revision ID: 232dfa044617
Revises: e734c7fe6056
Create Date: 2023-09-19 21:34:41.994617
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '232dfa044617'
down_revision = 'e734c7fe6056'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | |
36,982 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/30329639c12b_1_0_7.py | 17,18 | 1,28 | upgrade | 18,26 | 18,26 | """1.0.7
Revision ID: 30329639c12b
Revises: 232dfa044617
Create Date: 2023-09-23 08:25:59.776488
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '30329639c12b'
down_revision = '232dfa044617'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1.0.7
Revision ID: 30329639c12b
Revises: 232dfa044617
Create Date: 2023-09-23 08:25:59.776488
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '30329639c12b'
down_revision = '232dfa044617'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | # ### commands auto generated by Alembic - please adjust! ###
op.execute("delete from systemconfig where key = 'DefaultFilterRules';")
op.execute(
"insert into systemconfig(key, value) VALUES('DefaultFilterRules', (select value from systemconfig where key= 'DefaultIncludeExcludeFilter'));")
op.e... | # ### commands auto generated by Alembic - please adjust! ###
op.execute("delete from systemconfig where key = 'DefaultFilterRules';")
op.execute(
"insert into systemconfig(key, value) VALUES('DefaultFilterRules', (select value from systemconfig where key= 'DefaultIncludeExcludeFilter'));")
op.e... | 44 | 179 | 127 | 306 | """1.0.7
Revision ID: 30329639c12b
Revises: 232dfa044617
Create Date: 2023-09-23 08:25:59.776488
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '30329639c12b'
down_revision = '232dfa044617'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1.0.7
Revision ID: 30329639c12b
Revises: 232dfa044617
Create Date: 2023-09-23 08:25:59.776488
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '30329639c12b'
down_revision = '232dfa044617'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | |
36,983 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/52ab4930be04_1_0_3.py | 17,18 | 1,29 | upgrade | 18,25 | 18,25 | """1_0_3
Revision ID: 52ab4930be04
Revises: ec5fb51fc300
Create Date: 2023-08-28 13:21:45.152012
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '52ab4930be04'
down_revision = 'ec5fb51fc300'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1_0_3
Revision ID: 52ab4930be04
Revises: ec5fb51fc300
Create Date: 2023-08-28 13:21:45.152012
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '52ab4930be04'
down_revision = 'ec5fb51fc300'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | # ### commands auto generated by Alembic - please adjust! ###
op.execute("delete from systemconfig where key = 'RssSites';")
op.execute("insert into systemconfig(key, value) VALUES('RssSites', (select value from systemconfig where key= 'IndexerSites'));")
op.execute("delete from systemconfig where key =... | # ### commands auto generated by Alembic - please adjust! ###
op.execute("delete from systemconfig where key = 'RssSites';")
op.execute("insert into systemconfig(key, value) VALUES('RssSites', (select value from systemconfig where key= 'IndexerSites'));")
op.execute("delete from systemconfig where key =... | 43 | 202 | 117 | 319 | """1_0_3
Revision ID: 52ab4930be04
Revises: ec5fb51fc300
Create Date: 2023-08-28 13:21:45.152012
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '52ab4930be04'
down_revision = 'ec5fb51fc300'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1_0_3
Revision ID: 52ab4930be04
Revises: ec5fb51fc300
Create Date: 2023-08-28 13:21:45.152012
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '52ab4930be04'
down_revision = 'ec5fb51fc300'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | |
36,984 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/5813aaa7cb3a_1_0_15.py | 21,22 | 1,35 | upgrade | 22,33 | 22,33 | """1.0.15
Revision ID: 5813aaa7cb3a
Revises: f94cd1217fd7
Create Date: 2024-03-17 09:04:51.785716
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5813aaa7cb3a'
down_revision = 'f94cd1217fd7'
branch_labels = None
depends_on = None
def upgra... | """1.0.15
Revision ID: 5813aaa7cb3a
Revises: f94cd1217fd7
Create Date: 2024-03-17 09:04:51.785716
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5813aaa7cb3a'
down_revision = 'f94cd1217fd7'
branch_labels = None
depends_on = None
def upgra... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("message") as batch_op:
batch_op.add_column(sa.Column('note', sa.String, nullable=True))
try:
op.create_index('ix_message_reg_time', 'message', ['reg_time'... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("message") as batch_op:
batch_op.add_column(sa.Column('note', sa.String, nullable=True))
try:
op.create_index('ix_message_reg_time', 'message', ['reg_time'... | 36 | 187 | 141 | 328 | """1.0.15
Revision ID: 5813aaa7cb3a
Revises: f94cd1217fd7
Create Date: 2024-03-17 09:04:51.785716
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5813aaa7cb3a'
down_revision = 'f94cd1217fd7'
branch_labels = None
depends_on = None
def upgra... | """1.0.15
Revision ID: 5813aaa7cb3a
Revises: f94cd1217fd7
Create Date: 2024-03-17 09:04:51.785716
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5813aaa7cb3a'
down_revision = 'f94cd1217fd7'
branch_labels = None
depends_on = None
def upgra... | |
36,985 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/735c01e0453d_1_0_18.py | 21,22 | 1,32 | upgrade | 22,30 | 22,30 | """1.0.18
Revision ID: 735c01e0453d
Revises: 9cb3993e340e
Create Date: 2024-04-29 19:40:38.375072
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '735c01e0453d'
down_revision = '9cb3993e340e'
branch_labels = None
depends_on = None
def upgra... | """1.0.18
Revision ID: 735c01e0453d
Revises: 9cb3993e340e
Create Date: 2024-04-29 19:40:38.375072
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '735c01e0453d'
down_revision = '9cb3993e340e'
branch_labels = None
depends_on = None
def upgra... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("site") as batch_op:
batch_op.add_column(sa.Column('apikey', sa.VARCHAR))
batch_op.add_column(sa.Column('token', sa.VARCHAR))
# ### end Alembic command... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("site") as batch_op:
batch_op.add_column(sa.Column('apikey', sa.VARCHAR))
batch_op.add_column(sa.Column('token', sa.VARCHAR))
# ### end Alembic command... | 27 | 194 | 114 | 308 | """1.0.18
Revision ID: 735c01e0453d
Revises: 9cb3993e340e
Create Date: 2024-04-29 19:40:38.375072
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '735c01e0453d'
down_revision = '9cb3993e340e'
branch_labels = None
depends_on = None
def upgra... | """1.0.18
Revision ID: 735c01e0453d
Revises: 9cb3993e340e
Create Date: 2024-04-29 19:40:38.375072
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '735c01e0453d'
down_revision = '9cb3993e340e'
branch_labels = None
depends_on = None
def upgra... | |
36,986 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/9cb3993e340e_1_0_17.py | 20,21 | 1,31 | upgrade | 21,29 | 21,29 | """1_0_17
Revision ID: 9cb3993e340e
Revises: d146dea51516
Create Date: 2024-03-28 14:36:35.588392
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9cb3993e340e'
down_revision = 'd146dea51516'
branch_labels = None
depends_on = None
def upgrad... | """1_0_17
Revision ID: 9cb3993e340e
Revises: d146dea51516
Create Date: 2024-03-28 14:36:35.588392
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9cb3993e340e'
down_revision = 'd146dea51516'
branch_labels = None
depends_on = None
def upgrad... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("user") as batch_op:
batch_op.add_column(sa.Column('is_otp', sa.BOOLEAN, server_default='0'))
batch_op.add_column(sa.Column('otp_secret', sa.VARCHAR))
... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("user") as batch_op:
batch_op.add_column(sa.Column('is_otp', sa.BOOLEAN, server_default='0'))
batch_op.add_column(sa.Column('otp_secret', sa.VARCHAR))
... | 28 | 190 | 128 | 318 | """1_0_17
Revision ID: 9cb3993e340e
Revises: d146dea51516
Create Date: 2024-03-28 14:36:35.588392
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9cb3993e340e'
down_revision = 'd146dea51516'
branch_labels = None
depends_on = None
def upgrad... | """1_0_17
Revision ID: 9cb3993e340e
Revises: d146dea51516
Create Date: 2024-03-28 14:36:35.588392
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9cb3993e340e'
down_revision = 'd146dea51516'
branch_labels = None
depends_on = None
def upgrad... | |
36,987 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/9f4edd55c2d4_1_0_0.py | 29,30 | 1,33 | downgrade | 30,33 | 30,33 | """1.0.0
Revision ID: 9f4edd55c2d4
Revises:
Create Date: 2023-07-13 12:27:26.402317
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9f4edd55c2d4'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto gene... | """1.0.0
Revision ID: 9f4edd55c2d4
Revises:
Create Date: 2023-07-13 12:27:26.402317
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9f4edd55c2d4'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto gene... | # ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
pass
# ### end Alembic commands ###
| 18 | 252 | 38 | 290 | """1.0.0
Revision ID: 9f4edd55c2d4
Revises:
Create Date: 2023-07-13 12:27:26.402317
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9f4edd55c2d4'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto gene... | """1.0.0
Revision ID: 9f4edd55c2d4
Revises:
Create Date: 2023-07-13 12:27:26.402317
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9f4edd55c2d4'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto gene... | |
36,988 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/a521fbc28b18_1_0_9.py | 18,19 | 1,31 | upgrade | 19,29 | 19,29 | """1_0_9
Revision ID: a521fbc28b18
Revises: b2f011d3a8b7
Create Date: 2023-09-28 13:37:16.479360
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a521fbc28b18'
down_revision = 'b2f011d3a8b7'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | """1_0_9
Revision ID: a521fbc28b18
Revises: b2f011d3a8b7
Create Date: 2023-09-28 13:37:16.479360
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a521fbc28b18'
down_revision = 'b2f011d3a8b7'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("downloadhistory") as batch_op:
batch_op.add_column(sa.Column('date', sa.String, nullable=True))
batch_op.add_column(sa.Column('channel', sa.String, nullable=True))
except Exception a... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("downloadhistory") as batch_op:
batch_op.add_column(sa.Column('date', sa.String, nullable=True))
batch_op.add_column(sa.Column('channel', sa.String, nullable=True))
except Exception a... | 33 | 185 | 127 | 312 | """1_0_9
Revision ID: a521fbc28b18
Revises: b2f011d3a8b7
Create Date: 2023-09-28 13:37:16.479360
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a521fbc28b18'
down_revision = 'b2f011d3a8b7'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | """1_0_9
Revision ID: a521fbc28b18
Revises: b2f011d3a8b7
Create Date: 2023-09-28 13:37:16.479360
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a521fbc28b18'
down_revision = 'b2f011d3a8b7'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | |
36,989 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/b2f011d3a8b7_1_0_8.py | 18,19 | 1,30 | upgrade | 19,28 | 19,28 | """1_0_8
Revision ID: b2f011d3a8b7
Revises: 30329639c12b
Create Date: 2023-09-28 10:15:58.410003
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b2f011d3a8b7'
down_revision = '30329639c12b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | """1_0_8
Revision ID: b2f011d3a8b7
Revises: 30329639c12b
Create Date: 2023-09-28 10:15:58.410003
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b2f011d3a8b7'
down_revision = '30329639c12b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("downloadhistory") as batch_op:
batch_op.add_column(sa.Column('userid', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("downloadhistory") as batch_op:
batch_op.add_column(sa.Column('userid', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| 30 | 188 | 102 | 290 | """1_0_8
Revision ID: b2f011d3a8b7
Revises: 30329639c12b
Create Date: 2023-09-28 10:15:58.410003
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b2f011d3a8b7'
down_revision = '30329639c12b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | """1_0_8
Revision ID: b2f011d3a8b7
Revises: 30329639c12b
Create Date: 2023-09-28 10:15:58.410003
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b2f011d3a8b7'
down_revision = '30329639c12b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FU... | |
36,990 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/d146dea51516_1_0_16.py | 21,22 | 1,35 | upgrade | 22,33 | 22,33 | """1.0.16
Revision ID: d146dea51516
Revises: 5813aaa7cb3a
Create Date: 2024-03-18 18:13:38.099531
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd146dea51516'
down_revision = '5813aaa7cb3a'
branch_labels = None
depends_on = None
def upgra... | """1.0.16
Revision ID: d146dea51516
Revises: 5813aaa7cb3a
Create Date: 2024-03-18 18:13:38.099531
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd146dea51516'
down_revision = '5813aaa7cb3a'
branch_labels = None
depends_on = None
def upgra... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('bangumiid', sa.Integer, nullable=True))
try:
op.create_index('ix_subscribe_bangumiid', 'subscribe'... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('bangumiid', sa.Integer, nullable=True))
try:
op.create_index('ix_subscribe_bangumiid', 'subscribe'... | 36 | 189 | 149 | 338 | """1.0.16
Revision ID: d146dea51516
Revises: 5813aaa7cb3a
Create Date: 2024-03-18 18:13:38.099531
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd146dea51516'
down_revision = '5813aaa7cb3a'
branch_labels = None
depends_on = None
def upgra... | """1.0.16
Revision ID: d146dea51516
Revises: 5813aaa7cb3a
Create Date: 2024-03-18 18:13:38.099531
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd146dea51516'
down_revision = '5813aaa7cb3a'
branch_labels = None
depends_on = None
def upgra... | |
36,991 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/d633ca6cd572_1_0_10.py | 19,20 | 1,33 | upgrade | 20,31 | 20,31 | """1.0.10
Revision ID: d633ca6cd572
Revises: a521fbc28b18
Create Date: 2023-10-12 08:54:49.728638
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd633ca6cd572'
down_revision = 'a521fbc28b18'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | """1.0.10
Revision ID: d633ca6cd572
Revises: a521fbc28b18
Create Date: 2023-10-12 08:54:49.728638
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd633ca6cd572'
down_revision = 'a521fbc28b18'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('quality', sa.String, nullable=True))
batch_op.add_column(sa.Column('resolution', sa.String, nullable=True))
batch_op.a... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('quality', sa.String, nullable=True))
batch_op.add_column(sa.Column('resolution', sa.String, nullable=True))
batch_op.a... | 36 | 183 | 152 | 335 | """1.0.10
Revision ID: d633ca6cd572
Revises: a521fbc28b18
Create Date: 2023-10-12 08:54:49.728638
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd633ca6cd572'
down_revision = 'a521fbc28b18'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | """1.0.10
Revision ID: d633ca6cd572
Revises: a521fbc28b18
Create Date: 2023-10-12 08:54:49.728638
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd633ca6cd572'
down_revision = 'a521fbc28b18'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | |
36,992 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/d71e624f0208_1_0_12.py | 19,20 | 1,31 | upgrade | 20,29 | 20,29 | """1_0_12
Revision ID: d71e624f0208
Revises: 06abf3e7090b
Create Date: 2023-12-12 13:26:34.039497
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd71e624f0208'
down_revision = '06abf3e7090b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | """1_0_12
Revision ID: d71e624f0208
Revises: 06abf3e7090b
Create Date: 2023-12-12 13:26:34.039497
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd71e624f0208'
down_revision = '06abf3e7090b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('save_path', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('save_path', sa.String, nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###
| 30 | 188 | 102 | 290 | """1_0_12
Revision ID: d71e624f0208
Revises: 06abf3e7090b
Create Date: 2023-12-12 13:26:34.039497
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd71e624f0208'
down_revision = '06abf3e7090b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | """1_0_12
Revision ID: d71e624f0208
Revises: 06abf3e7090b
Create Date: 2023-12-12 13:26:34.039497
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd71e624f0208'
down_revision = '06abf3e7090b'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_... | |
36,993 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/e734c7fe6056_1_0_5.py | 17,18 | 1,28 | upgrade | 18,26 | 18,26 | """1.0.5
Revision ID: e734c7fe6056
Revises: 1e169250e949
Create Date: 2023-09-07 18:19:41.250957
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e734c7fe6056'
down_revision = '1e169250e949'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1.0.5
Revision ID: e734c7fe6056
Revises: 1e169250e949
Create Date: 2023-09-07 18:19:41.250957
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e734c7fe6056'
down_revision = '1e169250e949'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | # ### commands auto generated by Alembic - please adjust! ###
try:
op.create_index('ix_transferhistory_tmdbid', 'transferhistory', ['tmdbid'], unique=False)
except Exception as err:
pass
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
try:
op.create_index('ix_transferhistory_tmdbid', 'transferhistory', ['tmdbid'], unique=False)
except Exception as err:
pass
# ### end Alembic commands ###
| 27 | 178 | 88 | 266 | """1.0.5
Revision ID: e734c7fe6056
Revises: 1e169250e949
Create Date: 2023-09-07 18:19:41.250957
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e734c7fe6056'
down_revision = '1e169250e949'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | """1.0.5
Revision ID: e734c7fe6056
Revises: 1e169250e949
Create Date: 2023-09-07 18:19:41.250957
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e734c7fe6056'
down_revision = '1e169250e949'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_FUNC_BODYdef downgrade() -... | |
36,994 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/ec5fb51fc300_1_0_2.py | 19,20 | 1,33 | upgrade | 20,31 | 20,31 | """1.0.2
Revision ID: ec5fb51fc300
Revises: 14f1813ae8e3
Create Date: 2023-08-12 17:55:06.509548
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ec5fb51fc300'
down_revision = '14f1813ae8e3'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | """1.0.2
Revision ID: ec5fb51fc300
Revises: 14f1813ae8e3
Create Date: 2023-08-12 17:55:06.509548
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ec5fb51fc300'
down_revision = '14f1813ae8e3'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("transferhistory") as batch_op:
batch_op.add_column(sa.Column('files', sa.String, nullable=True))
with op.batch_alter_table("rss") as batch_op:
batch_op.add_column(sa.Column('filt... | # ### commands auto generated by Alembic - please adjust! ###
try:
with op.batch_alter_table("transferhistory") as batch_op:
batch_op.add_column(sa.Column('files', sa.String, nullable=True))
with op.batch_alter_table("rss") as batch_op:
batch_op.add_column(sa.Column('filt... | 37 | 181 | 148 | 329 | """1.0.2
Revision ID: ec5fb51fc300
Revises: 14f1813ae8e3
Create Date: 2023-08-12 17:55:06.509548
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ec5fb51fc300'
down_revision = '14f1813ae8e3'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | """1.0.2
Revision ID: ec5fb51fc300
Revises: 14f1813ae8e3
Create Date: 2023-08-12 17:55:06.509548
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ec5fb51fc300'
down_revision = '14f1813ae8e3'
branch_labels = None
depends_on = None
def upgrade() -> None:
FILL_F... | |
36,995 | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot | /home/hieuvd/dung_repo/raw/stars_02/jxxghp_MoviePilot/MoviePilot/database/versions/f94cd1217fd7_1_0_14.py | 21,22 | 1,32 | upgrade | 22,29 | 22,29 | """1_0_14
Revision ID: f94cd1217fd7
Revises: 127a25fdf0e8
Create Date: 2024-03-06 19:19:33.053186
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f94cd1217fd7'
down_revision = '127a25fdf0e8'
branch_labels = None
depends_on = None
def upgra... | """1_0_14
Revision ID: f94cd1217fd7
Revises: 127a25fdf0e8
Create Date: 2024-03-06 19:19:33.053186
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f94cd1217fd7'
down_revision = '127a25fdf0e8'
branch_labels = None
depends_on = None
def upgra... | # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('manual_total_episode', sa.Integer, nullable=True))
# ### end Alembic commands ###
| # ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
with op.batch_alter_table("subscribe") as batch_op:
batch_op.add_column(sa.Column('manual_total_episode', sa.Integer, nullable=True))
# ### end Alembic commands ###
| 26 | 208 | 101 | 309 | """1_0_14
Revision ID: f94cd1217fd7
Revises: 127a25fdf0e8
Create Date: 2024-03-06 19:19:33.053186
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f94cd1217fd7'
down_revision = '127a25fdf0e8'
branch_labels = None
depends_on = None
def upgra... | """1_0_14
Revision ID: f94cd1217fd7
Revises: 127a25fdf0e8
Create Date: 2024-03-06 19:19:33.053186
"""
import contextlib
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f94cd1217fd7'
down_revision = '127a25fdf0e8'
branch_labels = None
depends_on = None
def upgra... | |
36,999 | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH/autogpt/commands/analyze_code.py | 8,14 | 1,32 | analyze_code | 24,32 | 14,32 | """Code evaluation module."""
from __future__ import annotations
from autogpt.commands.command import command
from autogpt.llm import call_ai_function
@command(
"analyze_code",
"Analyze Code",
'"code": "<full_code_string>"',
)
def analyze_code(code: str) -> list[str]:
FILL_FUNC_BODY | """Code evaluation module."""
from __future__ import annotations
from autogpt.commands.command import command
from autogpt.llm import call_ai_function
@command(
"analyze_code",
"Analyze Code",
'"code": "<full_code_string>"',
)
def analyze_code(code: str) -> list[str]:
"""
A function that takes in... |
function_string = "def analyze_code(code: str) -> list[str]:"
args = [code]
description_string = (
"Analyzes the given code and returns a list of suggestions for improvements."
)
return call_ai_function(function_string, args, description_string)
| """
A function that takes in a string and returns a response from create chat
completion api call.
Parameters:
code (str): Code to be evaluated.
Returns:
A result string from create chat completion. A list of suggestions to
improve the code.
"""
function_strin... | 30 | 175 | 86 | 261 | """Code evaluation module."""
from __future__ import annotations
from autogpt.commands.command import command
from autogpt.llm import call_ai_function
@command(
"analyze_code",
"Analyze Code",
'"code": "<full_code_string>"',
)
def analyze_code(code: str) -> list[str]:
FILL_FUNC_BODY | """Code evaluation module."""
from __future__ import annotations
from autogpt.commands.command import command
from autogpt.llm import call_ai_function
@command(
"analyze_code",
"Analyze Code",
'"code": "<full_code_string>"',
)
def analyze_code(code: str) -> list[str]:
"""
A function that takes in... | |
37,000 | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH/autogpt/commands/audio_text.py | 34,35 | 1,62 | read_audio | 44,62 | 35,62 | """Commands for converting audio to text."""
import json
import requests
from autogpt.commands.command import command
from autogpt.config import Config
CFG = Config()
@command(
"read_audio_from_file",
"Convert Audio to text",
'"filename": "<filename>"',
CFG.huggingface_audio_to_text_model,
"Con... | """Commands for converting audio to text."""
import json
import requests
from autogpt.commands.command import command
from autogpt.config import Config
CFG = Config()
@command(
"read_audio_from_file",
"Convert Audio to text",
'"filename": "<filename>"',
CFG.huggingface_audio_to_text_model,
"Con... | model = CFG.huggingface_audio_to_text_model
api_url = f"https://api-inference.huggingface.co/models/{model}"
api_token = CFG.huggingface_api_token
headers = {"Authorization": f"Bearer {api_token}"}
if api_token is None:
raise ValueError(
"You need to set your Hugging Face API to... | """
Convert audio to text.
Args:
audio (bytes): The audio to convert
Returns:
str: The text from the audio
"""
model = CFG.huggingface_audio_to_text_model
api_url = f"https://api-inference.huggingface.co/models/{model}"
api_token = CFG.huggingface_api_token
headers ... | 49 | 285 | 200 | 485 | """Commands for converting audio to text."""
import json
import requests
from autogpt.commands.command import command
from autogpt.config import Config
CFG = Config()
@command(
"read_audio_from_file",
"Convert Audio to text",
'"filename": "<filename>"',
CFG.huggingface_audio_to_text_model,
"Con... | """Commands for converting audio to text."""
import json
import requests
from autogpt.commands.command import command
from autogpt.config import Config
CFG = Config()
@command(
"read_audio_from_file",
"Convert Audio to text",
'"filename": "<filename>"',
CFG.huggingface_audio_to_text_model,
"Con... | |
37,001 | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH/autogpt/commands/command.py | 127,134 | 1,157 | command | 135,157 | 134,157 | import functools
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
descriptio... | import functools
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
descriptio... |
def decorator(func: Callable[..., Any]) -> Command:
cmd = Command(
name=name,
description=description,
method=func,
signature=signature,
enabled=enabled,
disabled_reason=disabled_reason,
)
@functools.wraps(func)
... | """The command decorator is used to create Command objects from ordinary functions."""
def decorator(func: Callable[..., Any]) -> Command:
cmd = Command(
name=name,
description=description,
method=func,
signature=signature,
enabled=enabled,
... | 35 | 1,275 | 170 | 1,445 | import functools
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
descriptio... | import functools
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
descriptio... | |
37,002 | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH | /home/hieuvd/dung_repo/raw/stars_02/kaqijiang_Auto-GPT-ZH/Auto-GPT-ZH/autogpt/commands/command.py | 97,98 | 44,127 | import_commands | CommandRegistry | 109,127 | 98,127 | class CommandRegistry:
"""
The CommandRegistry class is a manager for a collection of Command objects.
It allows the registration, modification, and retrieval of Command objects,
as well as the scanning and loading of command plugins from a specified
directory.
"""
def __init__(self):
... | class CommandRegistry:
"""
The CommandRegistry class is a manager for a collection of Command objects.
It allows the registration, modification, and retrieval of Command objects,
as well as the scanning and loading of command plugins from a specified
directory.
"""
def __init__(self):
... |
module = importlib.import_module(module_name)
for attr_name in dir(module):
attr = getattr(module, attr_name)
# Register decorated functions
if hasattr(attr, AUTO_GPT_COMMAND_IDENTIFIER) and getattr(
attr, AUTO_GPT_COMMAND_IDENTIFIER
):
... | """
Imports the specified Python module containing command plugins.
This method imports the associated module and registers any functions or
classes that are decorated with the `AUTO_GPT_COMMAND_IDENTIFIER` attribute
as `Command` objects. The registered `Command` objects are the... | 43 | 691 | 177 | 868 | import functools
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
descriptio... | import functools
import importlib
import inspect
from typing import Any, Callable, Optional
# Unique identifier for auto-gpt commands
AUTO_GPT_COMMAND_IDENTIFIER = "auto_gpt_command"
class Command:
"""A class representing a command.
Attributes:
name (str): The name of the command.
descriptio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.