From 9dda2965be46e8e78feb1eab8f7c75c02662c578 Mon Sep 17 00:00:00 2001 From: Tiberiu Chibici Date: Fri, 2 Nov 2018 03:24:49 +0200 Subject: [PATCH] Updated readme --- README.md | 97 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 70 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 66c5639..b1469db 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Of course, there are a lot of things that still need to be done. The web interfa * python3: `$ apt install python3` * pip: `$ apt install python3-pip` +* ffmpeg: `$ apt install ffmpeg` * django: `$ pip3 install django` * crispy_forms: `$ pip3 install django-crispy-forms` * dj-config-url: `$ pip3 install dj-config-url` @@ -35,48 +36,55 @@ Of course, there are a lot of things that still need to be done. The web interfa ## Installation +There are 2 ways you can install this server. Using docker is the quickest and easiest method. + ### Normal installation for development/testing -1. Install all the dependencies listed above. - - ```bash - sudo apt install python3 python3-pip - sudo pip3 install apscheduler django django-crispy-forms dj-config-url youtube-dl google-api-python-client google_auth_oauthlib oauth2client - ``` - -2. Clone this repository: +1. Clone this repository: ```bash git clone https://github.com/chibicitiberiu/ytsm.git - cd ytsm/app + cd ytsm ``` -3. Set up the database: `python3 manage.py migrate` - - By default, a SQLite database is used, which is located in the project's folder. - You can customize that in `YtManager/settings.py`, by modifying the `DATABASES` variable (search Django documentation for details). - +2. Install all the dependencies listed above. + + ```bash + sudo apt install python3 python3-pip ffmpeg + sudo pip3 install --no-cache-dir -r requirements.txt + ``` + +3. Modify `config/config.ini` to your liking. All the settings should be documented through comments. +All these settings apply server-wide. The settings in the `user` section can be overriden from the web page for each +individual user. + 4. Obtain an YouTube API developer key from [https://console.developers.google.com/apis/dashboard](https://console.developers.google.com/apis/dashboard). You can find a detailed guide on [this page](https://www.slickremix.com/docs/get-api-key-for-youtube/). The `defaults.ini` file already has an API key, but if the quotas are reached, you won't be able to use this program any more. Also, I might decide to delete that key, which will break your installation. + + After obtaining the key, set it in `config.ini`. -5. Modify `config/config.ini` to your liking. All the settings should be documented through comments. -All these settings apply server-wide. The settings in the `user` section can be overriden from the web page for each -individual user. +5. Set up the database: - The most important settings are: - - * `[Global] YoutubeApiKey` - put your YouTube API key here - * `[User] DownloadPath` - sets the folder where videos will be downloaded - -6. Start the server: `python3 manage.py runserver [port] --noreload` + ```bash + cd app + python3 manage.py migrate + ``` + + By default, a SQLite database is used, which is located in the project's folder. The database can be configured + in `settings.ini`. + +6. Start the server: `python3 manage.py runserver [port] --noreload --insecure` The `port` parameter is optional. The `--noreload` option is necessary, otherwise the scheduler will run on 2 separate processes at the same time, - which is not ideal. + which is not ideal. + + The `--insecure` option is required only if `Debug=False` in `config.ini`, Without this option, the static resources + (CSS, javascript) won't work. 7. Open the server's page in your browser, by entering `http://localhost:port` in your address bar. @@ -86,11 +94,46 @@ individual user. ### Docker -A much easier way to install is to use Docker. +1. Clone this repository: -To run with docker, edit the config file (config/config.ini) and then run `docker-compose up -d`, it will bind to port 80. + ```bash + git clone https://github.com/chibicitiberiu/ytsm.git + cd ytsm + ``` -You can edit the default download locations in the docker-compose.yml file. +2. Install docker (if not installed) + +3. Modify `config/config.ini` to your liking. All the settings should be documented through comments. +All these settings apply server-wide. The settings in the `user` section can be overriden from the web page for each +individual user. + + **Attention**: you cannot modify the download location from `settings.ini` when using docker. + To do so, you will need to modify the volume mapping in `docker-compose.yml`. + +4. Obtain an YouTube API developer key from [https://console.developers.google.com/apis/dashboard](https://console.developers.google.com/apis/dashboard). +You can find a detailed guide on [this page](https://www.slickremix.com/docs/get-api-key-for-youtube/). + + The `defaults.ini` file already has an API key, but if the quotas are reached, you won't be able to use this program + any more. Also, I might decide to delete that key, which will break your installation. + + After obtaining the key, set it in `config.ini`. + +5. Build and run docker compose image: + + ```bash + docker-compose up -d + ``` + +6. Open the server's page in your browser, by entering `http://localhost` in your address bar. + +7. Create an admin user by going to the *register* page, and creating an user account. + +8. Add some subscriptions, and enjoy! + +The docker image uses a sqlite database, and stores the data in a folder `data/` located in the project directory. +You can edit the default download locations in the `docker-compose.yml` file. + +For more information about using Docker, check [this page](Docker_README.md). ### Deploying for production