forked from rc/aircox
first push
This commit is contained in:
0
programs/management/__init__.py
Normal file
0
programs/management/__init__.py
Normal file
0
programs/management/commands/__init__.py
Normal file
0
programs/management/commands/__init__.py
Normal file
0
programs/management/commands/_private.py
Normal file
0
programs/management/commands/_private.py
Normal file
29
programs/management/commands/monitor.py
Normal file
29
programs/management/commands/monitor.py
Normal file
@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
import programs.models as models
|
||||
import programs.settings
|
||||
|
||||
class Command(BaseCommand):
|
||||
help= "Take a look at the programs directory to check on new podcasts"
|
||||
|
||||
|
||||
|
||||
|
||||
def handle(self, *args, **options):
|
||||
programs = models.Program.objects.filter(schedule__isnull = True)
|
||||
|
||||
for program in programs:
|
||||
self.scan(program, program.path + '/public', public = True)
|
||||
self.scan(program, program.path + '/podcasts', embed = True)
|
||||
self.scan(program, program.path + '/private')
|
||||
|
||||
|
||||
def scan (self, program, path, public = False, embed = False):
|
||||
try:
|
||||
for filename in os.listdir(path):
|
||||
long_filename = path + '/' + filename
|
||||
|
||||
except:
|
||||
pass
|
||||
|
Reference in New Issue
Block a user