diff --git a/.gitignore b/.gitignore index 5ce42cd..62681d9 100644 --- a/.gitignore +++ b/.gitignore @@ -113,3 +113,5 @@ venv.bak/ .mypy_cache/ .dmypy.json dmypy.json + +media/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..df016b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3 + +WORKDIR /usr/src/app + +RUN apt-get update +RUN apt-get install ffmpeg -y + +COPY ./app/requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY ./app/ . +COPY ./config/ ./config/ + +#RUN python manage.py migrate + +CMD ["python", "./manage.py", "runserver", "8000", "--noreload"] +#CMD ["gunicorn", "YtManager.wsgi", "--bind", "0.0.0.0:8000"] diff --git a/readme.md b/README.md similarity index 94% rename from readme.md rename to README.md index c0aef34..ecc812e 100644 --- a/readme.md +++ b/README.md @@ -20,6 +20,12 @@ This is what still needs to be done: * Improve stability * Bonus: Plex integration +# Docker + +To run with docker, edit the config file (config/config.ini) and then run `docker-compose up -d`, it will bind to port 80. + +You can edit the default download locations in the docker-compose.yml file. + ## Dependencies * python3: `$ apt install python3` diff --git a/YtManager/__init__.py b/app/YtManager/__init__.py similarity index 100% rename from YtManager/__init__.py rename to app/YtManager/__init__.py diff --git a/YtManager/settings.py b/app/YtManager/settings.py similarity index 95% rename from YtManager/settings.py rename to app/YtManager/settings.py index 348292f..35bbb2f 100644 --- a/YtManager/settings.py +++ b/app/YtManager/settings.py @@ -26,7 +26,7 @@ YOUTUBE_API_KEY = "AIzaSyBabzE4Bup77WexdLMa9rN9z-wJidEfNX8" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] SESSION_COOKIE_AGE = 3600 * 30 # one month @@ -81,11 +81,14 @@ WSGI_APPLICATION = 'YtManager.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'postgres', + 'USER': 'postgres', + 'HOST': 'db', + 'PORT': 5432, } -} +} # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators diff --git a/YtManager/urls.py b/app/YtManager/urls.py similarity index 100% rename from YtManager/urls.py rename to app/YtManager/urls.py diff --git a/YtManager/wsgi.py b/app/YtManager/wsgi.py similarity index 100% rename from YtManager/wsgi.py rename to app/YtManager/wsgi.py diff --git a/YtManagerApp/__init__.py b/app/YtManagerApp/__init__.py similarity index 100% rename from YtManagerApp/__init__.py rename to app/YtManagerApp/__init__.py diff --git a/YtManagerApp/admin.py b/app/YtManagerApp/admin.py similarity index 100% rename from YtManagerApp/admin.py rename to app/YtManagerApp/admin.py diff --git a/YtManagerApp/appconfig.py b/app/YtManagerApp/appconfig.py similarity index 100% rename from YtManagerApp/appconfig.py rename to app/YtManagerApp/appconfig.py diff --git a/YtManagerApp/appmain.py b/app/YtManagerApp/appmain.py similarity index 100% rename from YtManagerApp/appmain.py rename to app/YtManagerApp/appmain.py diff --git a/YtManagerApp/apps.py b/app/YtManagerApp/apps.py similarity index 100% rename from YtManagerApp/apps.py rename to app/YtManagerApp/apps.py diff --git a/YtManagerApp/management/__init__.py b/app/YtManagerApp/management/__init__.py similarity index 100% rename from YtManagerApp/management/__init__.py rename to app/YtManagerApp/management/__init__.py diff --git a/YtManagerApp/management/downloader.py b/app/YtManagerApp/management/downloader.py similarity index 100% rename from YtManagerApp/management/downloader.py rename to app/YtManagerApp/management/downloader.py diff --git a/YtManagerApp/management/jobs/__init__.py b/app/YtManagerApp/management/jobs/__init__.py similarity index 100% rename from YtManagerApp/management/jobs/__init__.py rename to app/YtManagerApp/management/jobs/__init__.py diff --git a/YtManagerApp/management/jobs/delete_video.py b/app/YtManagerApp/management/jobs/delete_video.py similarity index 100% rename from YtManagerApp/management/jobs/delete_video.py rename to app/YtManagerApp/management/jobs/delete_video.py diff --git a/YtManagerApp/management/jobs/download_video.py b/app/YtManagerApp/management/jobs/download_video.py similarity index 100% rename from YtManagerApp/management/jobs/download_video.py rename to app/YtManagerApp/management/jobs/download_video.py diff --git a/YtManagerApp/management/jobs/synchronize.py b/app/YtManagerApp/management/jobs/synchronize.py similarity index 100% rename from YtManagerApp/management/jobs/synchronize.py rename to app/YtManagerApp/management/jobs/synchronize.py diff --git a/YtManagerApp/management/subscriptions.py b/app/YtManagerApp/management/subscriptions.py similarity index 100% rename from YtManagerApp/management/subscriptions.py rename to app/YtManagerApp/management/subscriptions.py diff --git a/YtManagerApp/management/videos.py b/app/YtManagerApp/management/videos.py similarity index 100% rename from YtManagerApp/management/videos.py rename to app/YtManagerApp/management/videos.py diff --git a/YtManagerApp/migrations/0001_initial.py b/app/YtManagerApp/migrations/0001_initial.py similarity index 100% rename from YtManagerApp/migrations/0001_initial.py rename to app/YtManagerApp/migrations/0001_initial.py diff --git a/YtManagerApp/migrations/0002_subscriptionfolder_user.py b/app/YtManagerApp/migrations/0002_subscriptionfolder_user.py similarity index 100% rename from YtManagerApp/migrations/0002_subscriptionfolder_user.py rename to app/YtManagerApp/migrations/0002_subscriptionfolder_user.py diff --git a/YtManagerApp/migrations/0003_auto_20181013_2018.py b/app/YtManagerApp/migrations/0003_auto_20181013_2018.py similarity index 100% rename from YtManagerApp/migrations/0003_auto_20181013_2018.py rename to app/YtManagerApp/migrations/0003_auto_20181013_2018.py diff --git a/YtManagerApp/migrations/0004_auto_20181014_1702.py b/app/YtManagerApp/migrations/0004_auto_20181014_1702.py similarity index 100% rename from YtManagerApp/migrations/0004_auto_20181014_1702.py rename to app/YtManagerApp/migrations/0004_auto_20181014_1702.py diff --git a/YtManagerApp/migrations/0005_auto_20181026_2013.py b/app/YtManagerApp/migrations/0005_auto_20181026_2013.py similarity index 100% rename from YtManagerApp/migrations/0005_auto_20181026_2013.py rename to app/YtManagerApp/migrations/0005_auto_20181026_2013.py diff --git a/YtManagerApp/migrations/0006_auto_20181027_0256.py b/app/YtManagerApp/migrations/0006_auto_20181027_0256.py similarity index 100% rename from YtManagerApp/migrations/0006_auto_20181027_0256.py rename to app/YtManagerApp/migrations/0006_auto_20181027_0256.py diff --git a/YtManagerApp/migrations/0007_auto_20181029_1638.py b/app/YtManagerApp/migrations/0007_auto_20181029_1638.py similarity index 100% rename from YtManagerApp/migrations/0007_auto_20181029_1638.py rename to app/YtManagerApp/migrations/0007_auto_20181029_1638.py diff --git a/YtManagerApp/migrations/__init__.py b/app/YtManagerApp/migrations/__init__.py similarity index 100% rename from YtManagerApp/migrations/__init__.py rename to app/YtManagerApp/migrations/__init__.py diff --git a/YtManagerApp/models.py b/app/YtManagerApp/models.py similarity index 100% rename from YtManagerApp/models.py rename to app/YtManagerApp/models.py diff --git a/YtManagerApp/scheduler.py b/app/YtManagerApp/scheduler.py similarity index 100% rename from YtManagerApp/scheduler.py rename to app/YtManagerApp/scheduler.py diff --git a/YtManagerApp/static/YtManagerApp/css/login.css b/app/YtManagerApp/static/YtManagerApp/css/login.css similarity index 100% rename from YtManagerApp/static/YtManagerApp/css/login.css rename to app/YtManagerApp/static/YtManagerApp/css/login.css diff --git a/YtManagerApp/static/YtManagerApp/css/login.css.map b/app/YtManagerApp/static/YtManagerApp/css/login.css.map similarity index 100% rename from YtManagerApp/static/YtManagerApp/css/login.css.map rename to app/YtManagerApp/static/YtManagerApp/css/login.css.map diff --git a/YtManagerApp/static/YtManagerApp/css/login.scss b/app/YtManagerApp/static/YtManagerApp/css/login.scss similarity index 100% rename from YtManagerApp/static/YtManagerApp/css/login.scss rename to app/YtManagerApp/static/YtManagerApp/css/login.scss diff --git a/YtManagerApp/static/YtManagerApp/css/style.css b/app/YtManagerApp/static/YtManagerApp/css/style.css similarity index 100% rename from YtManagerApp/static/YtManagerApp/css/style.css rename to app/YtManagerApp/static/YtManagerApp/css/style.css diff --git a/YtManagerApp/static/YtManagerApp/css/style.css.map b/app/YtManagerApp/static/YtManagerApp/css/style.css.map similarity index 100% rename from YtManagerApp/static/YtManagerApp/css/style.css.map rename to app/YtManagerApp/static/YtManagerApp/css/style.css.map diff --git a/YtManagerApp/static/YtManagerApp/css/style.scss b/app/YtManagerApp/static/YtManagerApp/css/style.scss similarity index 100% rename from YtManagerApp/static/YtManagerApp/css/style.scss rename to app/YtManagerApp/static/YtManagerApp/css/style.scss diff --git a/YtManagerApp/static/YtManagerApp/img/baseline-folder-24px.svg b/app/YtManagerApp/static/YtManagerApp/img/baseline-folder-24px.svg similarity index 100% rename from YtManagerApp/static/YtManagerApp/img/baseline-folder-24px.svg rename to app/YtManagerApp/static/YtManagerApp/img/baseline-folder-24px.svg diff --git a/YtManagerApp/static/YtManagerApp/img/baseline-person-24px.svg b/app/YtManagerApp/static/YtManagerApp/img/baseline-person-24px.svg similarity index 100% rename from YtManagerApp/static/YtManagerApp/img/baseline-person-24px.svg rename to app/YtManagerApp/static/YtManagerApp/img/baseline-person-24px.svg diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/LICENCE.md b/app/YtManagerApp/static/YtManagerApp/import/typicons/LICENCE.md similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/LICENCE.md rename to app/YtManagerApp/static/YtManagerApp/import/typicons/LICENCE.md diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/demo.html b/app/YtManagerApp/static/YtManagerApp/import/typicons/demo.html similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/demo.html rename to app/YtManagerApp/static/YtManagerApp/import/typicons/demo.html diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/typicons.css b/app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.css similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/typicons.css rename to app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.css diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/typicons.eot b/app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.eot similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/typicons.eot rename to app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.eot diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/typicons.min.css b/app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.min.css similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/typicons.min.css rename to app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.min.css diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/typicons.svg b/app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.svg similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/typicons.svg rename to app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.svg diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/typicons.ttf b/app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.ttf similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/typicons.ttf rename to app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.ttf diff --git a/YtManagerApp/static/YtManagerApp/import/typicons/typicons.woff b/app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.woff similarity index 100% rename from YtManagerApp/static/YtManagerApp/import/typicons/typicons.woff rename to app/YtManagerApp/static/YtManagerApp/import/typicons/typicons.woff diff --git a/YtManagerApp/templates/YtManagerApp/controls/folder_create_modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/folder_create_modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/folder_create_modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/folder_create_modal.html diff --git a/YtManagerApp/templates/YtManagerApp/controls/folder_delete_modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/folder_delete_modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/folder_delete_modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/folder_delete_modal.html diff --git a/YtManagerApp/templates/YtManagerApp/controls/folder_update_modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/folder_update_modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/folder_update_modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/folder_update_modal.html diff --git a/YtManagerApp/templates/YtManagerApp/controls/modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/modal.html diff --git a/YtManagerApp/templates/YtManagerApp/controls/subscription_create_modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/subscription_create_modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/subscription_create_modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/subscription_create_modal.html diff --git a/YtManagerApp/templates/YtManagerApp/controls/subscription_delete_modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/subscription_delete_modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/subscription_delete_modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/subscription_delete_modal.html diff --git a/YtManagerApp/templates/YtManagerApp/controls/subscription_update_modal.html b/app/YtManagerApp/templates/YtManagerApp/controls/subscription_update_modal.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/controls/subscription_update_modal.html rename to app/YtManagerApp/templates/YtManagerApp/controls/subscription_update_modal.html diff --git a/YtManagerApp/templates/YtManagerApp/index.html b/app/YtManagerApp/templates/YtManagerApp/index.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/index.html rename to app/YtManagerApp/templates/YtManagerApp/index.html diff --git a/YtManagerApp/templates/YtManagerApp/index_unauthenticated.html b/app/YtManagerApp/templates/YtManagerApp/index_unauthenticated.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/index_unauthenticated.html rename to app/YtManagerApp/templates/YtManagerApp/index_unauthenticated.html diff --git a/YtManagerApp/templates/YtManagerApp/index_videos.html b/app/YtManagerApp/templates/YtManagerApp/index_videos.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/index_videos.html rename to app/YtManagerApp/templates/YtManagerApp/index_videos.html diff --git a/YtManagerApp/templates/YtManagerApp/js/common.js b/app/YtManagerApp/templates/YtManagerApp/js/common.js similarity index 100% rename from YtManagerApp/templates/YtManagerApp/js/common.js rename to app/YtManagerApp/templates/YtManagerApp/js/common.js diff --git a/YtManagerApp/templates/YtManagerApp/js/index.js b/app/YtManagerApp/templates/YtManagerApp/js/index.js similarity index 100% rename from YtManagerApp/templates/YtManagerApp/js/index.js rename to app/YtManagerApp/templates/YtManagerApp/js/index.js diff --git a/YtManagerApp/templates/YtManagerApp/master_default.html b/app/YtManagerApp/templates/YtManagerApp/master_default.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/master_default.html rename to app/YtManagerApp/templates/YtManagerApp/master_default.html diff --git a/YtManagerApp/templates/YtManagerApp/settings.html b/app/YtManagerApp/templates/YtManagerApp/settings.html similarity index 100% rename from YtManagerApp/templates/YtManagerApp/settings.html rename to app/YtManagerApp/templates/YtManagerApp/settings.html diff --git a/YtManagerApp/templates/registration/logged_out.html b/app/YtManagerApp/templates/registration/logged_out.html similarity index 100% rename from YtManagerApp/templates/registration/logged_out.html rename to app/YtManagerApp/templates/registration/logged_out.html diff --git a/YtManagerApp/templates/registration/login.html b/app/YtManagerApp/templates/registration/login.html similarity index 100% rename from YtManagerApp/templates/registration/login.html rename to app/YtManagerApp/templates/registration/login.html diff --git a/YtManagerApp/templates/registration/password_reset_complete.html b/app/YtManagerApp/templates/registration/password_reset_complete.html similarity index 100% rename from YtManagerApp/templates/registration/password_reset_complete.html rename to app/YtManagerApp/templates/registration/password_reset_complete.html diff --git a/YtManagerApp/templates/registration/password_reset_confirm.html b/app/YtManagerApp/templates/registration/password_reset_confirm.html similarity index 100% rename from YtManagerApp/templates/registration/password_reset_confirm.html rename to app/YtManagerApp/templates/registration/password_reset_confirm.html diff --git a/YtManagerApp/templates/registration/password_reset_done.html b/app/YtManagerApp/templates/registration/password_reset_done.html similarity index 100% rename from YtManagerApp/templates/registration/password_reset_done.html rename to app/YtManagerApp/templates/registration/password_reset_done.html diff --git a/YtManagerApp/templates/registration/password_reset_email.html b/app/YtManagerApp/templates/registration/password_reset_email.html similarity index 100% rename from YtManagerApp/templates/registration/password_reset_email.html rename to app/YtManagerApp/templates/registration/password_reset_email.html diff --git a/YtManagerApp/templates/registration/password_reset_form.html b/app/YtManagerApp/templates/registration/password_reset_form.html similarity index 100% rename from YtManagerApp/templates/registration/password_reset_form.html rename to app/YtManagerApp/templates/registration/password_reset_form.html diff --git a/YtManagerApp/templates/registration/register.html b/app/YtManagerApp/templates/registration/register.html similarity index 100% rename from YtManagerApp/templates/registration/register.html rename to app/YtManagerApp/templates/registration/register.html diff --git a/YtManagerApp/templates/registration/register_done.html b/app/YtManagerApp/templates/registration/register_done.html similarity index 100% rename from YtManagerApp/templates/registration/register_done.html rename to app/YtManagerApp/templates/registration/register_done.html diff --git a/YtManagerApp/templatetags/__init__.py b/app/YtManagerApp/templatetags/__init__.py similarity index 100% rename from YtManagerApp/templatetags/__init__.py rename to app/YtManagerApp/templatetags/__init__.py diff --git a/YtManagerApp/templatetags/common.py b/app/YtManagerApp/templatetags/common.py similarity index 100% rename from YtManagerApp/templatetags/common.py rename to app/YtManagerApp/templatetags/common.py diff --git a/YtManagerApp/templatetags/ratings.py b/app/YtManagerApp/templatetags/ratings.py similarity index 100% rename from YtManagerApp/templatetags/ratings.py rename to app/YtManagerApp/templatetags/ratings.py diff --git a/YtManagerApp/tests.py b/app/YtManagerApp/tests.py similarity index 100% rename from YtManagerApp/tests.py rename to app/YtManagerApp/tests.py diff --git a/YtManagerApp/urls.py b/app/YtManagerApp/urls.py similarity index 100% rename from YtManagerApp/urls.py rename to app/YtManagerApp/urls.py diff --git a/YtManagerApp/utils/__init__.py b/app/YtManagerApp/utils/__init__.py similarity index 100% rename from YtManagerApp/utils/__init__.py rename to app/YtManagerApp/utils/__init__.py diff --git a/YtManagerApp/utils/extended_interpolation_with_env.py b/app/YtManagerApp/utils/extended_interpolation_with_env.py similarity index 100% rename from YtManagerApp/utils/extended_interpolation_with_env.py rename to app/YtManagerApp/utils/extended_interpolation_with_env.py diff --git a/YtManagerApp/utils/youtube.py b/app/YtManagerApp/utils/youtube.py similarity index 100% rename from YtManagerApp/utils/youtube.py rename to app/YtManagerApp/utils/youtube.py diff --git a/YtManagerApp/views/__init__.py b/app/YtManagerApp/views/__init__.py similarity index 100% rename from YtManagerApp/views/__init__.py rename to app/YtManagerApp/views/__init__.py diff --git a/YtManagerApp/views/actions.py b/app/YtManagerApp/views/actions.py similarity index 100% rename from YtManagerApp/views/actions.py rename to app/YtManagerApp/views/actions.py diff --git a/YtManagerApp/views/auth.py b/app/YtManagerApp/views/auth.py similarity index 100% rename from YtManagerApp/views/auth.py rename to app/YtManagerApp/views/auth.py diff --git a/YtManagerApp/views/controls/__init__.py b/app/YtManagerApp/views/controls/__init__.py similarity index 100% rename from YtManagerApp/views/controls/__init__.py rename to app/YtManagerApp/views/controls/__init__.py diff --git a/YtManagerApp/views/controls/modal.py b/app/YtManagerApp/views/controls/modal.py similarity index 100% rename from YtManagerApp/views/controls/modal.py rename to app/YtManagerApp/views/controls/modal.py diff --git a/YtManagerApp/views/index.py b/app/YtManagerApp/views/index.py similarity index 100% rename from YtManagerApp/views/index.py rename to app/YtManagerApp/views/index.py diff --git a/YtManagerApp/views/settings.py b/app/YtManagerApp/views/settings.py similarity index 100% rename from YtManagerApp/views/settings.py rename to app/YtManagerApp/views/settings.py diff --git a/app/config/config.ini b/app/config/config.ini new file mode 100644 index 0000000..c3d0f48 --- /dev/null +++ b/app/config/config.ini @@ -0,0 +1,59 @@ +; Use $ to use the value of an environment variable. +; The global section contains settings that apply to the entire server +[global] +; YouTube API key - get this from your user account +YoutubeApiKey=AIzaSyAonB6T-DrKjfGxBGuHyFMg0x_d0T9nlP8 + +; Specifies the synchronization schedule, in crontab format. +; Format: +SynchronizationSchedule=5 * * * * + +; Number of threads running the scheduler +; Since most of the jobs scheduled are downloads, there is no advantage to having +; a higher concurrency +SchedulerConcurrency=1 + +; Log level +LogLevel=DEBUG + +; Default user settings +[user] +; When a video is deleted on the system, it will be marked as 'watched' +MarkDeletedAsWatched=True + +; Videos marked as watched are automatically deleted +DeleteWatched=True + +; Enable automatic downloading +AutoDownload=True + +; Limit the total number of videos downloaded (-1 or empty = no limit) +DownloadGlobalLimit=10 + +; Limit the numbers of videos per subscription (-1 or empty = no limit) +DownloadSubscriptionLimit=5 + +; Number of download attempts +DownloadMaxAttempts=3 + +; Download order +; Options: newest, oldest, playlist, playlist_reverse, popularity, rating +DownloadOrder=playlist + +; Path where downloaded videos are stored +DownloadPath=data/media/videos + +; A pattern which describes how downloaded files are organized. Extensions are automatically appended. +; Supported fields: channel, channel_id, playlist, playlist_id, playlist_index, title, id +; The default pattern should work pretty well with Plex +;DownloadFilePattern=${channel}/${playlist}/S01E${playlist_index} - ${title} [${id}] + +; Download format that will be passed to youtube-dl. See the youtube-dl documentation for more details. +DownloadFormat=bestvideo+bestaudio + +; Subtitles - these options match the youtube-dl options +;DownloadSubtitles=True +;DownloadAutogeneratedSubtitles=False +;DownloadSubtitlesAll=False +;DownloadSubtitlesLangs=en,ro +;DownloadSubtitlesFormat= diff --git a/app/config/defaults.ini b/app/config/defaults.ini new file mode 100644 index 0000000..a4a0b30 --- /dev/null +++ b/app/config/defaults.ini @@ -0,0 +1,59 @@ +; Use $ to use the value of an environment variable. +; The global section contains settings that apply to the entire server +[global] +; YouTube API key - get this from your user account +YoutubeApiKey=AIzaSyBabzE4Bup77WexdLMa9rN9z-wJidEfNX8 + +; Specifies the synchronization schedule, in crontab format. +; Format: +SynchronizationSchedule=0 * * * * + +; Number of threads running the scheduler +; Since most of the jobs scheduled are downloads, there is no advantage to having +; a higher concurrency +SchedulerConcurrency=2 + +; Log level +LogLevel=INFO + +; Default user settings +[user] +; When a video is deleted on the system, it will be marked as 'watched' +MarkDeletedAsWatched=True + +; Videos marked as watched are automatically deleted +DeleteWatched=True + +; Enable automatic downloading +AutoDownload=True + +; Limit the total number of videos downloaded (-1 or empty = no limit) +DownloadGlobalLimit= + +; Limit the numbers of videos per subscription (-1 or empty = no limit) +DownloadSubscriptionLimit=5 + +; Number of download attempts +DownloadMaxAttempts=3 + +; Download order +; Options: newest, oldest, playlist, playlist_reverse, popularity, rating +DownloadOrder=playlist + +; Path where downloaded videos are stored +DownloadPath=${env:USERPROFILE}${env:HOME}/Downloads + +; A pattern which describes how downloaded files are organized. Extensions are automatically appended. +; Supported fields: channel, channel_id, playlist, playlist_id, playlist_index, title, id +; The default pattern should work pretty well with Plex +DownloadFilePattern=${channel}/${playlist}/S01E${playlist_index} - ${title} [${id}] + +; Download format that will be passed to youtube-dl. See the youtube-dl documentation for more details. +DownloadFormat=bestvideo+bestaudio + +; Subtitles - these options match the youtube-dl options +DownloadSubtitles=True +DownloadAutogeneratedSubtitles=False +DownloadSubtitlesAll=False +DownloadSubtitlesLangs=en,ro +DownloadSubtitlesFormat= diff --git a/external/__init__.py b/app/external/__init__.py similarity index 100% rename from external/__init__.py rename to app/external/__init__.py diff --git a/external/pytaw/.gitignore b/app/external/pytaw/.gitignore similarity index 100% rename from external/pytaw/.gitignore rename to app/external/pytaw/.gitignore diff --git a/external/pytaw/.pytaw.conf b/app/external/pytaw/.pytaw.conf similarity index 100% rename from external/pytaw/.pytaw.conf rename to app/external/pytaw/.pytaw.conf diff --git a/external/pytaw/README.md b/app/external/pytaw/README.md similarity index 100% rename from external/pytaw/README.md rename to app/external/pytaw/README.md diff --git a/external/pytaw/__init__.py b/app/external/pytaw/__init__.py similarity index 100% rename from external/pytaw/__init__.py rename to app/external/pytaw/__init__.py diff --git a/external/pytaw/docs/Makefile b/app/external/pytaw/docs/Makefile similarity index 100% rename from external/pytaw/docs/Makefile rename to app/external/pytaw/docs/Makefile diff --git a/external/pytaw/docs/conf.py b/app/external/pytaw/docs/conf.py similarity index 100% rename from external/pytaw/docs/conf.py rename to app/external/pytaw/docs/conf.py diff --git a/external/pytaw/docs/index.rst b/app/external/pytaw/docs/index.rst similarity index 100% rename from external/pytaw/docs/index.rst rename to app/external/pytaw/docs/index.rst diff --git a/external/pytaw/docs/make.bat b/app/external/pytaw/docs/make.bat similarity index 100% rename from external/pytaw/docs/make.bat rename to app/external/pytaw/docs/make.bat diff --git a/external/pytaw/main_test.py b/app/external/pytaw/main_test.py similarity index 100% rename from external/pytaw/main_test.py rename to app/external/pytaw/main_test.py diff --git a/external/pytaw/pytaw/__init__.py b/app/external/pytaw/pytaw/__init__.py similarity index 100% rename from external/pytaw/pytaw/__init__.py rename to app/external/pytaw/pytaw/__init__.py diff --git a/external/pytaw/pytaw/utils.py b/app/external/pytaw/pytaw/utils.py similarity index 100% rename from external/pytaw/pytaw/utils.py rename to app/external/pytaw/pytaw/utils.py diff --git a/external/pytaw/pytaw/youtube.py b/app/external/pytaw/pytaw/youtube.py similarity index 100% rename from external/pytaw/pytaw/youtube.py rename to app/external/pytaw/pytaw/youtube.py diff --git a/external/pytaw/setup.py b/app/external/pytaw/setup.py similarity index 100% rename from external/pytaw/setup.py rename to app/external/pytaw/setup.py diff --git a/external/pytaw/tests/__init__.py b/app/external/pytaw/tests/__init__.py similarity index 100% rename from external/pytaw/tests/__init__.py rename to app/external/pytaw/tests/__init__.py diff --git a/external/pytaw/tests/test_pytaw.py b/app/external/pytaw/tests/test_pytaw.py similarity index 100% rename from external/pytaw/tests/test_pytaw.py rename to app/external/pytaw/tests/test_pytaw.py diff --git a/app/init.sh b/app/init.sh new file mode 100755 index 0000000..374b374 --- /dev/null +++ b/app/init.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +#./manage.py runserver 0.0.0.0:8000 --noreload +gunicorn -b 0.0.0.0:8000 -w 4 YtManager.wsgi diff --git a/manage.py b/app/manage.py similarity index 100% rename from manage.py rename to app/manage.py diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100644 index 0000000..df7ef7c --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,10 @@ +apscheduler +gunicorn +django +django-crispy-forms +youtube-dl +google-api-python-client +google_auth_oauthlib +oauth2client +psycopg2-binary +python-dateutil diff --git a/config/config.ini b/config/config.ini index 39e85ab..c3d0f48 100644 --- a/config/config.ini +++ b/config/config.ini @@ -2,16 +2,16 @@ ; The global section contains settings that apply to the entire server [global] ; YouTube API key - get this from your user account -;YoutubeApiKey=AIzaSyBabzE4Bup77WexdLMa9rN9z-wJidEfNX8 +YoutubeApiKey=AIzaSyAonB6T-DrKjfGxBGuHyFMg0x_d0T9nlP8 ; Specifies the synchronization schedule, in crontab format. ; Format: -;SynchronizationSchedule=0 * * * * +SynchronizationSchedule=5 * * * * ; Number of threads running the scheduler ; Since most of the jobs scheduled are downloads, there is no advantage to having ; a higher concurrency -;SchedulerConcurrency=2 +SchedulerConcurrency=1 ; Log level LogLevel=DEBUG @@ -19,29 +19,29 @@ LogLevel=DEBUG ; Default user settings [user] ; When a video is deleted on the system, it will be marked as 'watched' -;MarkDeletedAsWatched=True +MarkDeletedAsWatched=True ; Videos marked as watched are automatically deleted -;DeleteWatched=True +DeleteWatched=True ; Enable automatic downloading -;AutoDownload=True +AutoDownload=True ; Limit the total number of videos downloaded (-1 or empty = no limit) -;DownloadGlobalLimit= +DownloadGlobalLimit=10 ; Limit the numbers of videos per subscription (-1 or empty = no limit) -;DownloadSubscriptionLimit=5 +DownloadSubscriptionLimit=5 ; Number of download attempts -;DownloadMaxAttempts=3 +DownloadMaxAttempts=3 ; Download order ; Options: newest, oldest, playlist, playlist_reverse, popularity, rating -;DownloadOrder=playlist +DownloadOrder=playlist ; Path where downloaded videos are stored -DownloadPath=temp/download +DownloadPath=data/media/videos ; A pattern which describes how downloaded files are organized. Extensions are automatically appended. ; Supported fields: channel, channel_id, playlist, playlist_id, playlist_index, title, id @@ -49,7 +49,7 @@ DownloadPath=temp/download ;DownloadFilePattern=${channel}/${playlist}/S01E${playlist_index} - ${title} [${id}] ; Download format that will be passed to youtube-dl. See the youtube-dl documentation for more details. -DownloadFormat=worstvideo+bestaudio +DownloadFormat=bestvideo+bestaudio ; Subtitles - these options match the youtube-dl options ;DownloadSubtitles=True diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..751e3ad --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: '3.1' + +services: + nginx: + image: nginx:latest + volumes: + - ./nginx:/etc/nginx/conf.d/ + - ./app/YtManagerApp/static:/www/static + ports: + - "80:80" + depends_on: + - web + + db: + image: postgres + restart: always + volumes: + - /var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: postgres + POSTGRES_DB: ytmanager + + web: + build: . + tty: true + command: ./init.sh + ports: + - "8000:8000" + volumes: + - ./media:/usr/src/app/data/media + depends_on: + - db + diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..1b60a84 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,31 @@ +# nginx.conf +upstream djangoA { + server web:8000 max_fails=3 fail_timeout=0; +} +server { + include mime.types; + # The port your site will be served on + listen 80; + # the domain name it will serve for + server_name 0.0.0.0;# substitute your machine's IP address or FQDN + charset utf-8; + #Max upload size + client_max_body_size 512M; # adjust to taste + location /static { + alias /www/static; + expires 30d; + } + + location / { + try_files $uri @proxy_to_app; + } + + # Finally, send all non-media requests to the Django server. + location @proxy_to_app { + proxy_set_header X-Real-IP $remote_addr; + proxy_redirect off; + proxy_set_header Host $host; + proxy_pass http://djangoA; + } +} +