2011-12-16 14:13:37 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2016-02-18 10:49:26 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2011-12-16 14:13:37 +00:00
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
from django.conf import settings
|
|
|
|
import os
|
|
|
|
from glob import glob
|
|
|
|
|
2013-09-26 15:27:43 +00:00
|
|
|
import app.monkey_patch
|
|
|
|
from ... import models
|
2011-12-16 14:13:37 +00:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
"""
|
|
|
|
"""
|
2013-09-26 15:27:43 +00:00
|
|
|
help = 'list files without db entry'
|
2011-12-16 14:13:37 +00:00
|
|
|
args = ''
|
|
|
|
|
|
|
|
def handle(self, **options):
|
2013-09-26 15:27:43 +00:00
|
|
|
for f in glob(os.path.join(settings.MEDIA_ROOT, 'media', '*', '*', '*', '*')):
|
2011-12-16 14:13:37 +00:00
|
|
|
oshash = f[-19:].replace('/', '')
|
|
|
|
if models.File.objects.filter(oshash=oshash).count() == 0:
|
2016-02-18 10:49:26 +00:00
|
|
|
print(f)
|