Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find and read personal commands recursively, allowing dirs #1228

Open
wants to merge 1 commit into
base: async
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mapadroid/updater/updater.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import asyncio
import glob
import json
import os
import re
import time
from asyncio import CancelledError, Task
from datetime import datetime, timedelta
from pathlib import Path
from typing import AsyncGenerator, Dict, List, Optional, Tuple, Union

import asyncio_rlock
Expand Down Expand Up @@ -98,14 +98,14 @@ async def _load_jobs(self):
if os.path.exists('commands.json'):
await self._load_jobs_from_file('commands.json')
# load personal commands
for command_file in glob.glob(os.path.join("personal_commands", "*.json")):
for command_file in Path("personal_commands").rglob("*.json"):
try:
await self._load_jobs_from_file(command_file)
except Exception as e:
logger.error('Cannot add job {} - Reason: {}', command_file, e)

# Read all .apk files in the upload dir
for apk_file in glob.glob(str(MadGlobals.application_args.upload_path) + "/*.apk"):
for apk_file in Path(MadGlobals.application_args.upload_path).rglob("*.apk"):
created: int = int(os.path.getmtime(apk_file))

self._available_jobs[os.path.basename(apk_file)] = [SubJob(TYPE=JobType.INSTALLATION,
Expand Down
Loading