2021-10-29 15:37:31 +00:00
|
|
|
"""functionality:
|
|
|
|
- hold all form classes used in the views
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
from django.contrib.auth.forms import AuthenticationForm
|
|
|
|
from django.forms.widgets import PasswordInput, TextInput
|
|
|
|
|
|
|
|
|
|
|
|
class CustomAuthForm(AuthenticationForm):
|
|
|
|
"""better styled login form"""
|
|
|
|
|
|
|
|
username = forms.CharField(
|
2021-12-16 11:00:36 +00:00
|
|
|
widget=TextInput(
|
|
|
|
attrs={
|
|
|
|
"placeholder": "Username",
|
|
|
|
"autofocus": True,
|
|
|
|
"autocomplete": True,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
label=False,
|
2021-10-29 15:37:31 +00:00
|
|
|
)
|
|
|
|
password = forms.CharField(
|
|
|
|
widget=PasswordInput(attrs={"placeholder": "Password"}), label=False
|
|
|
|
)
|
2021-12-16 08:17:58 +00:00
|
|
|
remember_me = forms.BooleanField(required=False)
|
2021-10-29 15:37:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UserSettingsForm(forms.Form):
|
|
|
|
"""user configurations values"""
|
|
|
|
|
|
|
|
CHOICES = [
|
|
|
|
("", "-- change color scheme --"),
|
|
|
|
("dark", "Dark"),
|
|
|
|
("light", "Light"),
|
|
|
|
]
|
|
|
|
|
|
|
|
colors = forms.ChoiceField(
|
|
|
|
widget=forms.Select, choices=CHOICES, required=False
|
|
|
|
)
|
|
|
|
page_size = forms.IntegerField(required=False)
|
|
|
|
|
|
|
|
|
|
|
|
class ApplicationSettingsForm(forms.Form):
|
|
|
|
"""handle all application settings"""
|
|
|
|
|
|
|
|
METADATA_CHOICES = [
|
|
|
|
("", "-- change metadata embed --"),
|
|
|
|
("0", "don't embed metadata"),
|
|
|
|
("1", "embed metadata"),
|
|
|
|
]
|
|
|
|
|
|
|
|
THUMBNAIL_CHOICES = [
|
|
|
|
("", "-- change thumbnail embed --"),
|
|
|
|
("0", "don't embed thumbnail"),
|
|
|
|
("1", "embed thumbnail"),
|
|
|
|
]
|
|
|
|
|
2022-01-05 07:06:07 +00:00
|
|
|
RYD_CHOICES = [
|
|
|
|
("", "-- change ryd integrations"),
|
|
|
|
("0", "disable ryd integration"),
|
|
|
|
("1", "enable ryd integration"),
|
|
|
|
]
|
|
|
|
|
2022-01-11 11:31:22 +00:00
|
|
|
CAST_CHOICES = [
|
|
|
|
("", "-- change Cast integration --"),
|
|
|
|
("0", "disable Cast"),
|
|
|
|
("1", "enable Cast"),
|
|
|
|
]
|
|
|
|
|
2022-01-30 13:10:29 +00:00
|
|
|
SUBTITLE_SOURCE_CHOICES = [
|
|
|
|
("", "-- change subtitle source settings"),
|
|
|
|
("auto", "also download auto generated"),
|
|
|
|
("user", "only download uploader"),
|
|
|
|
]
|
|
|
|
|
2021-10-29 15:37:31 +00:00
|
|
|
subscriptions_channel_size = forms.IntegerField(required=False)
|
|
|
|
downloads_limit_count = forms.IntegerField(required=False)
|
|
|
|
downloads_limit_speed = forms.IntegerField(required=False)
|
|
|
|
downloads_throttledratelimit = forms.IntegerField(required=False)
|
|
|
|
downloads_sleep_interval = forms.IntegerField(required=False)
|
2022-01-05 07:06:07 +00:00
|
|
|
downloads_autodelete_days = forms.IntegerField(required=False)
|
2021-10-29 15:37:31 +00:00
|
|
|
downloads_format = forms.CharField(required=False)
|
|
|
|
downloads_add_metadata = forms.ChoiceField(
|
|
|
|
widget=forms.Select, choices=METADATA_CHOICES, required=False
|
|
|
|
)
|
|
|
|
downloads_add_thumbnail = forms.ChoiceField(
|
|
|
|
widget=forms.Select, choices=THUMBNAIL_CHOICES, required=False
|
|
|
|
)
|
2022-01-30 13:10:29 +00:00
|
|
|
downloads_subtitle = forms.CharField(required=False)
|
|
|
|
downloads_subtitle_source = forms.ChoiceField(
|
|
|
|
widget=forms.Select, choices=SUBTITLE_SOURCE_CHOICES, required=False
|
|
|
|
)
|
2022-01-05 07:06:07 +00:00
|
|
|
downloads_integrate_ryd = forms.ChoiceField(
|
|
|
|
widget=forms.Select, choices=RYD_CHOICES, required=False
|
|
|
|
)
|
2022-01-11 11:31:22 +00:00
|
|
|
application_enable_cast = forms.ChoiceField(
|
|
|
|
widget=forms.Select, choices=CAST_CHOICES, required=False
|
|
|
|
)
|
2021-10-30 06:19:16 +00:00
|
|
|
|
|
|
|
|
2021-12-02 11:38:32 +00:00
|
|
|
class SchedulerSettingsForm(forms.Form):
|
|
|
|
"""handle scheduler settings"""
|
|
|
|
|
|
|
|
update_subscribed = forms.CharField(required=False)
|
|
|
|
download_pending = forms.CharField(required=False)
|
|
|
|
check_reindex = forms.CharField(required=False)
|
2021-12-13 03:54:54 +00:00
|
|
|
check_reindex_days = forms.IntegerField(required=False)
|
2021-12-02 11:38:32 +00:00
|
|
|
thumbnail_check = forms.CharField(required=False)
|
|
|
|
run_backup = forms.CharField(required=False)
|
2021-12-13 03:54:54 +00:00
|
|
|
run_backup_rotate = forms.IntegerField(required=False)
|
2021-12-02 11:38:32 +00:00
|
|
|
|
|
|
|
|
2021-12-30 13:42:42 +00:00
|
|
|
class MultiSearchForm(forms.Form):
|
|
|
|
"""multi search form for /search/"""
|
|
|
|
|
|
|
|
searchInput = forms.CharField(
|
|
|
|
label="",
|
|
|
|
widget=forms.TextInput(
|
|
|
|
attrs={
|
|
|
|
"autocomplete": "off",
|
|
|
|
"oninput": "searchMulti(this.value)",
|
|
|
|
"autofocus": True,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2022-01-07 11:29:25 +00:00
|
|
|
home = forms.CharField(widget=forms.HiddenInput())
|
|
|
|
channel = forms.CharField(widget=forms.HiddenInput())
|
|
|
|
playlist = forms.CharField(widget=forms.HiddenInput())
|
2021-12-30 13:42:42 +00:00
|
|
|
|
|
|
|
|
2021-10-30 07:14:16 +00:00
|
|
|
class AddToQueueForm(forms.Form):
|
|
|
|
"""text area form to add to downloads"""
|
|
|
|
|
|
|
|
vid_url = forms.CharField(
|
|
|
|
label=False,
|
|
|
|
widget=forms.Textarea(
|
|
|
|
attrs={
|
|
|
|
"rows": 4,
|
|
|
|
"placeholder": "Enter Video Urls or IDs here...",
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2021-10-30 08:00:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SubscribeToChannelForm(forms.Form):
|
|
|
|
"""text area form to subscribe to multiple channels"""
|
|
|
|
|
|
|
|
subscribe = forms.CharField(
|
2022-01-01 10:25:57 +00:00
|
|
|
label="Subscribe to channels",
|
2021-10-30 08:00:10 +00:00
|
|
|
widget=forms.Textarea(
|
|
|
|
attrs={
|
|
|
|
"rows": 3,
|
|
|
|
"placeholder": "Input channel ID, URL or Video of a channel",
|
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|
2021-11-19 04:52:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SubscribeToPlaylistForm(forms.Form):
|
|
|
|
"""text area form to subscribe to multiple playlists"""
|
|
|
|
|
|
|
|
subscribe = forms.CharField(
|
2022-01-01 10:25:57 +00:00
|
|
|
label="Subscribe to playlists",
|
2021-11-19 04:52:27 +00:00
|
|
|
widget=forms.Textarea(
|
|
|
|
attrs={
|
|
|
|
"rows": 3,
|
2022-01-01 10:25:57 +00:00
|
|
|
"placeholder": "Input playlist IDs or URLs",
|
2021-11-19 04:52:27 +00:00
|
|
|
}
|
|
|
|
),
|
|
|
|
)
|