Revert "Continued refactoring."

This reverts commit 3e835af295.
This commit is contained in:
Tiberiu Chibici 2020-04-11 00:42:37 +03:00
parent 3e835af295
commit 75b2fc6bfe
3 changed files with 16 additions and 52 deletions

View File

@ -31,18 +31,13 @@ def __initialize_logger():
logging.root.addHandler(console_handler)
def __load_main_jobs():
SynchronizeJob.schedule_global_job()
def main():
__initialize_logger()
try:
if Services.appConfig().initialized:
Services.scheduler().initialize()
__load_main_jobs()
SynchronizeJob.schedule_global_job()
except OperationalError:
# Settings table is not created when running migrate or makemigrations;
# Just don't do anything in this case.

View File

@ -29,25 +29,10 @@ VIDEO_ORDER_MAPPING = {
}
class Provider(models.Model):
class_name = models.CharField(null=False, max_length=64, unique=True,
help_text='Class name in the "providers" package.')
config = models.CharField(max_length=1024,
help_text='Provider configuration (stored as JSON)')
class SubscriptionFolder(models.Model):
name = models.CharField(null=False, max_length=250,
help_text='Folder name')
parent = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True,
help_text='Parent folder')
user = models.ForeignKey(User, on_delete=models.CASCADE, null=False, blank=False,
help_text='User who owns the subscription')
name = models.CharField(null=False, max_length=250)
parent = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True)
user = models.ForeignKey(User, on_delete=models.CASCADE, null=False, blank=False)
class Meta:
ordering = [Lower('parent__name'), Lower('name')]
@ -113,33 +98,17 @@ class SubscriptionFolder(models.Model):
class Subscription(models.Model):
name = models.CharField(null=False, max_length=1024,
help_text='Name of playlist or channel.')
name = models.CharField(null=False, max_length=1024)
description = models.TextField()
original_url = models.CharField(null=False, max_length=1024)
thumbnail = models.CharField(max_length=1024)
description = models.TextField(help_text='Description of the playlist/channel.')
provider = models.CharField(null=False, max_length=64)
provider_id = models.CharField(null=False, max_length=64)
provider_data = models.CharField(null=True, max_length=1024)
original_url = models.CharField(null=False, max_length=1024,
help_text='Original URL added by user.')
thumbnail = models.CharField(max_length=1024,
help_text='An URL to the thumbnail.')
#
provider = models.ForeignKey(Provider, null=True, on_delete=models.SET_DEFAULT,
help_text='Provider who manages this subscription (e.g. YouTube, Vimeo etc)')
provider_id = models.CharField(null=False, max_length=64,
help_text='Identifier according to provider (e.g. YouTube video ID)')
provider_data = models.CharField(null=True, max_length=1024,
help_text='Extra data stored by the provider serialized as JSON')
#
parent_folder = models.ForeignKey(SubscriptionFolder, on_delete=models.CASCADE, null=True, blank=True,
help_text='Parent folder')
user = models.ForeignKey(User, on_delete=models.CASCADE,
help_text='Owner user')
parent_folder = models.ForeignKey(SubscriptionFolder, on_delete=models.CASCADE, null=True, blank=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
# overrides
auto_download = models.BooleanField(null=True, blank=True)

View File

@ -10,10 +10,10 @@ from django.views.generic import CreateView, UpdateView, DeleteView, FormView
from django.views.generic.edit import FormMixin
from django.conf import settings
from django.core.paginator import Paginator
from YtManagerApp.services.videos import get_videos
from YtManagerApp.management.videos import get_videos
from YtManagerApp.models import Subscription, SubscriptionFolder, VIDEO_ORDER_CHOICES, VIDEO_ORDER_MAPPING
from YtManagerApp.services import Services
from YtManagerApp.utils import subscription_file_parser
from YtManagerApp.management.services import Services
from YtManagerApp.utils import youtube, subscription_file_parser
from YtManagerApp.views.controls.modal import ModalMixin
import logging