# Path: feincms/module/medialibrary/models.py
# class MediaFile(MediaFileBase):
#     class Meta:
#         app_label = "medialibrary"


import os
from django.core.management.base import NoArgsCommand
from django.utils.encoding import force_str
from feincms.module.medialibrary.models import MediaFile




class Command(NoArgsCommand):
    help = "Prints all orphaned files in the `media/medialibrary` folder"

    def handle_noargs(self, **options):
        mediafiles = list(MediaFile.objects.values_list("file", flat=True))

        # TODO make this smarter, and take MEDIA_ROOT into account
        for base, dirs, files in os.walk("media/medialibrary"):
            for f in files:

# Path: feincms/module/medialibrary/models.py
# class MediaFile(MediaFileBase):
#     class Meta:
#         app_label = "medialibrary"


# Path: feincms/management/commands/medialibrary_orphans.py
import os
from django.core.management.base import NoArgsCommand
from django.utils.encoding import force_str
from feincms.module.medialibrary.models import MediaFile





class Command(NoArgsCommand):
    help = "Prints all orphaned files in the `media/medialibrary` folder"

    def handle_noargs(self, **options):
        mediafiles = list(MediaFile.objects.values_list("file", flat=True))

        # TODO make this smarter, and take MEDIA_ROOT into account
        for base, dirs, files in os.walk("media/medialibrary"):
            for f in files:

                full = os.path.join(base[6:], f)