mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 06:56:18 -05:00
Updating function names to match their functionality.
This commit is contained in:
parent
8de805b6d1
commit
e06f846c8c
4 changed files with 9 additions and 8 deletions
|
|
@ -444,7 +444,7 @@ def search_archives(search_str: str, domain: str, limit: int, offset: int, order
|
|||
|
||||
|
||||
@optional_session
|
||||
def search_domains_by_directory(name: str, limit: int = 5, session: Session = None) -> List[Domain]:
|
||||
def search_domains_by_name(name: str, limit: int = 5, session: Session = None) -> List[Domain]:
|
||||
domains = session.query(Domain) \
|
||||
.filter(Domain.domain.ilike(f'%{name}%')) \
|
||||
.order_by(asc(Domain.domain)) \
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ def download_channel(id_: int):
|
|||
|
||||
|
||||
@optional_session
|
||||
def search_channels_by_directory(name: str, limit: int = 5, session: Session = None) -> List[Channel]:
|
||||
def search_channels_by_name(name: str, limit: int = 5, session: Session = None) -> List[Channel]:
|
||||
channels = session.query(Channel) \
|
||||
.filter(Channel.name.ilike(f'%{name}%')) \
|
||||
.order_by(asc(Channel.name)) \
|
||||
|
|
|
|||
|
|
@ -126,17 +126,18 @@ async def post_search_directories(_, body: schema.DirectoriesSearchRequest):
|
|||
return response.empty()
|
||||
|
||||
from modules.videos.channel import lib as channels_lib
|
||||
channel_directories = channels_lib.search_channels_by_directory(name=body.name)
|
||||
channel_directories = [dict(path=i.directory, name=i.name) for i in channel_directories]
|
||||
channels = channels_lib.search_channels_by_name(name=body.name)
|
||||
channel_directories = [dict(path=i.directory, name=i.name) for i in channels]
|
||||
channel_paths = [i['path'] for i in channel_directories]
|
||||
|
||||
from modules.archive import lib as archives_lib
|
||||
domain_directories = archives_lib.search_domains_by_directory(name=body.name)
|
||||
domain_directories = [dict(path=i.directory, domain=i.domain) for i in domain_directories]
|
||||
domains = archives_lib.search_domains_by_name(name=body.name)
|
||||
domain_directories = [dict(path=i.directory, domain=i.domain) for i in domains]
|
||||
domain_paths = [i['path'] for i in domain_directories]
|
||||
|
||||
# Get all directories that match but do not contain the above directories.
|
||||
from wrolpi.files.models import Directory
|
||||
directories: List[Directory] = await lib.search_directories(
|
||||
directories: List[Directory] = await lib.search_directories_by_name(
|
||||
name=body.name,
|
||||
excluded=list(map(str, channel_paths + domain_paths)))
|
||||
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ async def upsert_directories(parent_directories, directories):
|
|||
|
||||
|
||||
@optional_session
|
||||
async def search_directories(name: str, excluded: List[str] = None, limit: int = 20, session: Session = None) \
|
||||
async def search_directories_by_name(name: str, excluded: List[str] = None, limit: int = 20, session: Session = None) \
|
||||
-> List[Directory]:
|
||||
"""Find the Directories whose names contain the `name` string."""
|
||||
excluded = excluded or []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue