mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
Continued refactoring.
This commit is contained in:
parent
6b843f1fc2
commit
3e835af295
@ -31,13 +31,18 @@ def __initialize_logger():
|
|||||||
logging.root.addHandler(console_handler)
|
logging.root.addHandler(console_handler)
|
||||||
|
|
||||||
|
|
||||||
|
def __load_main_jobs():
|
||||||
|
SynchronizeJob.schedule_global_job()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
__initialize_logger()
|
__initialize_logger()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if Services.appConfig().initialized:
|
if Services.appConfig().initialized:
|
||||||
Services.scheduler().initialize()
|
Services.scheduler().initialize()
|
||||||
SynchronizeJob.schedule_global_job()
|
__load_main_jobs()
|
||||||
|
|
||||||
except OperationalError:
|
except OperationalError:
|
||||||
# Settings table is not created when running migrate or makemigrations;
|
# Settings table is not created when running migrate or makemigrations;
|
||||||
# Just don't do anything in this case.
|
# Just don't do anything in this case.
|
||||||
|
@ -29,10 +29,25 @@ 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):
|
class SubscriptionFolder(models.Model):
|
||||||
name = models.CharField(null=False, max_length=250)
|
|
||||||
parent = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True)
|
name = models.CharField(null=False, max_length=250,
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE, null=False, blank=False)
|
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')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = [Lower('parent__name'), Lower('name')]
|
ordering = [Lower('parent__name'), Lower('name')]
|
||||||
@ -98,17 +113,33 @@ class SubscriptionFolder(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
class Subscription(models.Model):
|
class Subscription(models.Model):
|
||||||
name = models.CharField(null=False, max_length=1024)
|
name = models.CharField(null=False, max_length=1024,
|
||||||
description = models.TextField()
|
help_text='Name of playlist or channel.')
|
||||||
original_url = models.CharField(null=False, max_length=1024)
|
|
||||||
thumbnail = models.CharField(max_length=1024)
|
|
||||||
|
|
||||||
provider = models.CharField(null=False, max_length=64)
|
description = models.TextField(help_text='Description of the playlist/channel.')
|
||||||
provider_id = models.CharField(null=False, max_length=64)
|
|
||||||
provider_data = models.CharField(null=True, max_length=1024)
|
|
||||||
|
|
||||||
parent_folder = models.ForeignKey(SubscriptionFolder, on_delete=models.CASCADE, null=True, blank=True)
|
original_url = models.CharField(null=False, max_length=1024,
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
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')
|
||||||
|
|
||||||
# overrides
|
# overrides
|
||||||
auto_download = models.BooleanField(null=True, blank=True)
|
auto_download = models.BooleanField(null=True, blank=True)
|
||||||
|
@ -10,10 +10,10 @@ from django.views.generic import CreateView, UpdateView, DeleteView, FormView
|
|||||||
from django.views.generic.edit import FormMixin
|
from django.views.generic.edit import FormMixin
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from YtManagerApp.management.videos import get_videos
|
from YtManagerApp.services.videos import get_videos
|
||||||
from YtManagerApp.models import Subscription, SubscriptionFolder, VIDEO_ORDER_CHOICES, VIDEO_ORDER_MAPPING
|
from YtManagerApp.models import Subscription, SubscriptionFolder, VIDEO_ORDER_CHOICES, VIDEO_ORDER_MAPPING
|
||||||
from YtManagerApp.management.services import Services
|
from YtManagerApp.services import Services
|
||||||
from YtManagerApp.utils import youtube, subscription_file_parser
|
from YtManagerApp.utils import subscription_file_parser
|
||||||
from YtManagerApp.views.controls.modal import ModalMixin
|
from YtManagerApp.views.controls.modal import ModalMixin
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
Loading…
Reference in New Issue
Block a user