Beispiel #1
0
 def test_get_actions_in_progess(self):
     now = datetime.date.today()
     type = Type(code='video')
     type.save()
     status = Status(code='rename')
     status.save()
     mf = MediaFile(type = type, \
                    status = status, \
                    filepath ='/fakefilepath/myfile.mkv')
     mf.save()
     command = "/bogus/command"
     completion = 5
     description = 'desc'
     action = Action(mediafile = mf, \
                     command = command, \
                     completion = completion, \
                     description = description)
     action.save()  # action saved but not started
     current_actions = Action.get_actions_in_progress()
     num_actions = len(current_actions)
     self.assertFalse(action in current_actions)
     action.start()
     current_actions = Action.get_actions_in_progress()
     self.assertEqual(len(current_actions), num_actions + 1)
     self.assertTrue(action in current_actions)
Beispiel #2
0
 def test_get_actions_in_progess(self):
     now = datetime.date.today()
     type = Type(code='video')
     type.save()
     status = Status(code='rename')
     status.save()
     mf = MediaFile(type = type, \
                    status = status, \
                    filepath ='/fakefilepath/myfile.mkv')
     mf.save()
     command = "/bogus/command"
     completion = 5
     description = 'desc'
     action = Action(mediafile = mf, \
                     command = command, \
                     completion = completion, \
                     description = description)
     action.save() # action saved but not started
     current_actions = Action.get_actions_in_progress()
     num_actions = len(current_actions)
     self.assertFalse(action in current_actions)
     action.start()
     current_actions = Action.get_actions_in_progress()
     self.assertEqual(len(current_actions), num_actions + 1)
     self.assertTrue(action in current_actions)
Beispiel #3
0
def home(request): # The home / index view
    context = {}
    # Check for media folders and begin first time setup if they do not exist
    if len(MediaFolder.objects.all()) == 0:
        log.info("No media folders defined. Entering Setup")
        return setup(request)
    current_actions = Action.get_actions_in_progress() # list of running actions
    context['actions'] = current_actions # add actions to context
    scan_folder = get_object_or_404(MediaFolder) # top level media folder
    context['scan_folder'] = scan_folder
    log.debug("home view context:" + str(context))
    return render(request, 'sorter/index.html', context)
Beispiel #4
0
def home(request):  # The home / index view
    context = {}
    # Check for media folders and begin first time setup if they do not exist
    if len(MediaFolder.objects.all()) == 0:
        log.info("No media folders defined. Entering Setup")
        return setup(request)
    current_actions = Action.get_actions_in_progress(
    )  # list of running actions
    context['actions'] = current_actions  # add actions to context
    scan_folder = get_object_or_404(MediaFolder)  # top level media folder
    context['scan_folder'] = scan_folder
    log.debug("home view context:" + str(context))
    return render(request, 'sorter/index.html', context)