mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 11:56:18 -05:00
Many fixes split out from the feature/unified-query branch. Installing diagnostic tools in the built images. Displaying video comment statistics. Echoing error when install.sh fails.
This commit is contained in:
parent
78806b6060
commit
ba2dd6dd11
12 changed files with 121 additions and 14 deletions
45
scripts/delete_downloads.py
Executable file
45
scripts/delete_downloads.py
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#! /usr/bin/env python3
|
||||
import asyncio
|
||||
|
||||
from wrolpi.db import get_db_curs
|
||||
from wrolpi.downloader import get_download_manager_config
|
||||
|
||||
|
||||
async def delete_once_downloads():
|
||||
"""Deletes all once-downloads."""
|
||||
with get_db_curs(commit=True) as curs:
|
||||
curs.execute('DELETE FROM download WHERE frequency IS NULL')
|
||||
|
||||
|
||||
async def delete_all_downloads():
|
||||
"""Deletes all downloads."""
|
||||
with get_db_curs(commit=True) as curs:
|
||||
curs.execute('DELETE FROM download') # noqa
|
||||
|
||||
|
||||
async def main():
|
||||
"""Asks the user which Downloads they want to delete. Saves the config if any downloads are deleted."""
|
||||
need_save = False
|
||||
|
||||
delete_once = input('Delete all once-downloads? (Downloads that will only occur once) [y/N]: ')
|
||||
delete_once = True if delete_once.lower() == 'y' else False
|
||||
|
||||
if delete_once:
|
||||
await delete_once_downloads()
|
||||
need_save = True
|
||||
|
||||
delete_all = input('Delete ALL downloads? [y/N]: ')
|
||||
delete_all = True if delete_all.lower() == 'y' else False
|
||||
|
||||
if delete_all:
|
||||
await delete_all_downloads()
|
||||
need_save = True
|
||||
|
||||
if need_save:
|
||||
# Save the config file.
|
||||
get_download_manager_config().save()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.new_event_loop()
|
||||
loop.run_until_complete(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue