mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 19:36:20 -05:00
Including Country/Region codes in caption file names.
This commit is contained in:
parent
0929bac69e
commit
d5ca3e7f02
12 changed files with 280 additions and 23 deletions
|
|
@ -71,7 +71,8 @@ class ArchiveDownloader(Downloader, ABC):
|
|||
|
||||
async def do_singlefile(self, download: Download) -> Tuple[bytes, dict]:
|
||||
"""Create a Singlefile from the archive's URL."""
|
||||
cmd = (str(SINGLE_FILE_BIN),
|
||||
cmd = ('/usr/bin/nice', '-n15', # Nice above map importing, but very low priority.
|
||||
str(SINGLE_FILE_BIN),
|
||||
download.url,
|
||||
'--browser-executable-path', CHROMIUM,
|
||||
'--browser-args', '["--no-sandbox"]',
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ def channel_get(_: Request, channel_id: int = None):
|
|||
@wrol_mode_check
|
||||
def channel_post(_: Request, body: schema.ChannelPostRequest):
|
||||
body.directory = get_media_directory() / body.directory
|
||||
if not body.directory.is_dir() and body.mkdir:
|
||||
make_media_directory(body.directory)
|
||||
|
||||
channel = lib.create_channel(data=body, return_dict=False)
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ def create_channel(session: Session, data: schema.ChannelPostRequest, return_dic
|
|||
except APIError as e:
|
||||
raise ValidationError() from e
|
||||
|
||||
pathlib.Path(data.directory).mkdir(parents=True, exist_ok=True)
|
||||
channel = Channel()
|
||||
session.add(channel)
|
||||
session.flush([channel])
|
||||
|
|
|
|||
|
|
@ -249,15 +249,6 @@ def test_channel_post_directory(test_session, test_client, test_directory):
|
|||
assert response.status_code == HTTPStatus.CREATED
|
||||
directory = test_session.query(Channel).filter_by(id=1).one().directory
|
||||
assert (test_directory / 'foo') == directory
|
||||
assert not directory.is_dir()
|
||||
assert directory.is_absolute()
|
||||
|
||||
# Channel can be created and have its directory be created.
|
||||
data = dict(name='bar', directory='bar', mkdir=True)
|
||||
request, response = test_client.post('/api/videos/channels', content=json.dumps(data))
|
||||
assert response.status_code == HTTPStatus.CREATED
|
||||
directory = test_session.query(Channel).filter_by(id=2).one().directory
|
||||
assert (test_directory / 'bar') == directory
|
||||
assert directory.is_dir()
|
||||
assert directory.is_absolute()
|
||||
|
||||
|
|
|
|||
|
|
@ -101,9 +101,9 @@ async def test_search_channels_by_name(test_session, channel_factory, video_fact
|
|||
Channels can be searched by their name.
|
||||
"""
|
||||
# Create four channels with varying associated videos.
|
||||
c1 = channel_factory(name='foo')
|
||||
c1 = channel_factory(name='Foo')
|
||||
c2 = channel_factory(name='bar')
|
||||
c3 = channel_factory(name='foo bar')
|
||||
c3 = channel_factory(name='Foo Bar')
|
||||
c4 = channel_factory(name='foobar')
|
||||
video_factory(channel_id=c1.id)
|
||||
for _ in range(2):
|
||||
|
|
@ -123,8 +123,8 @@ async def test_search_channels_by_name(test_session, channel_factory, video_fact
|
|||
if channel_names:
|
||||
raise AssertionError('More channels than expected.')
|
||||
|
||||
await assert_search('foo', ['foo', 'foo bar', 'foobar'])
|
||||
await assert_search('bar', ['foobar', 'foo bar', 'bar'], True)
|
||||
await assert_search('foo', ['Foo', 'foobar', 'Foo Bar'])
|
||||
await assert_search('bar', ['foobar', 'Foo Bar', 'bar'], True)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue