More dead code removal (https://github.com/meeb/tubesync/pull/1325/files#r2501509766, https://github.com/meeb/tubesync/pull/1325/files#r2501512241)
This commit is contained in:
@@ -258,40 +258,4 @@ class YouTube_VideoCodec(models.TextChoices):
|
||||
SourceResolutionInteger = SourceResolution._integer_mapping()
|
||||
youtube_long_source_types = YouTube_SourceType._long_type_mapping()
|
||||
youtube_validation_urls = YouTube_SourceType._validation_urls()
|
||||
youtube_help = {
|
||||
'examples': dict(zip(
|
||||
YouTube_SourceType.values,
|
||||
(
|
||||
('https://www.youtube.com/@rossmanngroup'),
|
||||
('https://www.youtube.com/channel/'
|
||||
'UCl2mFZoRqjw_ELax4Yisf6w'),
|
||||
('https://www.youtube.com/playlist?list='
|
||||
'PLkVbIsAWN2lsmovRO20_gtfUfgWi-XnnT'),
|
||||
),
|
||||
)),
|
||||
'texts': dict(zip(
|
||||
YouTube_SourceType.values,
|
||||
(
|
||||
_(
|
||||
'Enter a YouTube channel URL into the box below. A channel URL will be in '
|
||||
'the format of <strong>https://www.youtube.com/CHANNELNAME</strong> '
|
||||
'where <strong>CHANNELNAME</strong> is the name of the channel you want '
|
||||
'to add.'
|
||||
),
|
||||
_(
|
||||
'Enter a YouTube channel URL by channel ID into the box below. A channel '
|
||||
'URL by channel ID will be in the format of <strong>'
|
||||
'https://www.youtube.com/channel/BiGLoNgUnIqUeId</strong> '
|
||||
'where <strong>BiGLoNgUnIqUeId</strong> is the ID of the channel you want '
|
||||
'to add.'
|
||||
),
|
||||
_(
|
||||
'Enter a YouTube playlist URL into the box below. A playlist URL will be '
|
||||
'in the format of <strong>https://www.youtube.com/playlist?list='
|
||||
'BiGLoNgUnIqUeId</strong> where <strong>BiGLoNgUnIqUeId</strong> is the '
|
||||
'unique ID of the playlist you want to add.'
|
||||
),
|
||||
),
|
||||
)),
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ from .tasks import (
|
||||
)
|
||||
from .choices import (Val, MediaServerType, SourceResolution, IndexSchedule,
|
||||
YouTube_SourceType, youtube_long_source_types,
|
||||
youtube_help, youtube_validation_urls)
|
||||
youtube_validation_urls)
|
||||
from . import signals # noqa
|
||||
from . import youtube
|
||||
|
||||
@@ -192,9 +192,6 @@ class ValidateSourceView(FormView):
|
||||
'unsupported_format': _('URL does not match any supported format.'),
|
||||
}
|
||||
source_types = youtube_long_source_types
|
||||
help_item = dict(YouTube_SourceType.choices)
|
||||
help_texts = youtube_help.get('texts')
|
||||
help_examples = youtube_help.get('examples')
|
||||
validation_urls = youtube_validation_urls
|
||||
prepopulate_fields = {
|
||||
Val(YouTube_SourceType.CHANNEL): ('source_type', 'key', 'name', 'directory'),
|
||||
@@ -208,19 +205,6 @@ class ValidateSourceView(FormView):
|
||||
self.key = ''
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.source_type_str = kwargs.get('source_type', '').strip().lower()
|
||||
self.source_type = self.source_types.get(self.source_type_str, None)
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
data = super().get_context_data(*args, **kwargs)
|
||||
data['source_type'] = self.source_type_str
|
||||
data['help_item'] = self.help_item.get(self.source_type)
|
||||
data['help_text'] = self.help_texts.get(self.source_type)
|
||||
data['help_example'] = self.help_examples.get(self.source_type)
|
||||
return data
|
||||
|
||||
def form_valid(self, form):
|
||||
# Perform extra validation on the URL, we need to extract the channel name or
|
||||
# playlist ID and check they are valid
|
||||
|
||||
Reference in New Issue
Block a user