mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
The form provides an option to select default directory, user specified directory or samba shares if enabled. The form also checks that the directory exists and is readable by the minidlna user. Tested that changing media directory to a samba share location works. Closes #2084. Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
24 lines
827 B
Python
24 lines
827 B
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""
|
|
FreedomBox configuration form for MiniDLNA server.
|
|
"""
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from plinth.modules.storage.forms import (DirectorySelectForm,
|
|
DirectoryValidator)
|
|
|
|
from . import SYSTEM_USER
|
|
|
|
|
|
class MiniDLNAServerForm(DirectorySelectForm):
|
|
"""MiniDLNA server configuration form."""
|
|
|
|
def __init__(self, *args, **kw):
|
|
validator = DirectoryValidator(username=SYSTEM_USER)
|
|
super().__init__(
|
|
title=_('Media Files Directory'), help_text=_(
|
|
'Directory that MiniDLNA Server will read for content. All '
|
|
'sub-directories of this will be also scanned for media files.'
|
|
), default='/var/lib/minidlna', validator=validator, *args, **kw)
|