ytsm/README.md

141 lines
5.4 KiB
Markdown
Raw Permalink Normal View History

2018-10-29 18:32:14 +00:00
# YouTube Subscription Manager
2018-10-29 18:29:53 +00:00
A self-hosted tool which manages your YouTube subscriptions, and downloads files automatically.
## Current state
Currently, the program will do what it's main job is to do: download videos, and keep track of the subscriptions.
2018-10-30 09:56:20 +00:00
Of course, there are a lot of things that still need to be done. The web interface is still pretty limited, and there might still be uncaught bugs. These are some of the things that need to be done:
* OAuth YouTube authentication, so private playlists can be obtained
* Web UI improvements:
* Handle drag & drop for the subscription folders
* Update UI when something changes
* Improve stability
* Bonus: Plex integration
2018-10-30 09:56:20 +00:00
* Bonus: Support for additional services (Twitch, Vimeo)
2018-10-30 06:15:49 +00:00
## Dependencies
* python3: `$ apt install python3`
* pip: `$ apt install python3-pip`
2018-11-02 01:24:49 +00:00
* ffmpeg: `$ apt install ffmpeg`
* django: `$ pip3 install django`
* crispy_forms: `$ pip3 install django-crispy-forms`
* dj-config-url: `$ pip3 install dj-config-url`
* youtube-dl: `$ pip3 install youtube-dl`
* google-api-python-client: `$ pip3 install google-api-python-client`
* google_auth_oauthlib: `$ pip3 install google_auth_oauthlib`
* apscheduler (v3.5+): `$ pip3 install apscheduler`
2018-10-29 18:29:53 +00:00
* (recommended) oauth2client: `$ pip3 install oauth2client`
## Installation
2018-11-02 01:24:49 +00:00
There are 2 ways you can install this server. Using docker is the quickest and easiest method.
2018-10-30 09:56:20 +00:00
### Normal installation for development/testing
2018-11-02 01:24:49 +00:00
1. Clone this repository:
2018-10-29 18:29:53 +00:00
```bash
2018-11-02 01:24:49 +00:00
git clone https://github.com/chibicitiberiu/ytsm.git
cd ytsm
2018-10-29 18:29:53 +00:00
```
2018-11-02 01:24:49 +00:00
2. Install all the dependencies listed above.
2018-10-29 18:29:53 +00:00
```bash
2018-11-02 01:24:49 +00:00
sudo apt install python3 python3-pip ffmpeg
sudo pip3 install --no-cache-dir -r requirements.txt
2018-10-29 18:29:53 +00:00
```
2018-11-02 01:24:49 +00:00
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).
2018-10-29 18:29:53 +00:00
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.
2018-11-02 01:24:49 +00:00
After obtaining the key, set it in `config.ini`.
2018-10-29 18:29:53 +00:00
2018-11-02 01:24:49 +00:00
5. Set up the database:
2018-10-29 18:29:53 +00:00
2018-11-02 01:24:49 +00:00
```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`
2018-10-29 18:29:53 +00:00
The `port` parameter is optional.
The `--noreload` option is necessary, otherwise the scheduler will run on 2 separate processes at the same time,
2018-11-02 01:24:49 +00:00
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.
2018-10-29 18:29:53 +00:00
7. Open the server's page in your browser, by entering `http://localhost:port` in your address bar.
2018-10-29 18:29:53 +00:00
8. Create an admin user by going to the *register* page, and creating an user account.
2018-10-29 18:29:53 +00:00
9. Add some subscriptions, and enjoy!
2018-10-29 18:29:53 +00:00
2018-10-30 09:56:20 +00:00
### Docker
2018-11-02 01:24:49 +00:00
1. Clone this repository:
```bash
git clone https://github.com/chibicitiberiu/ytsm.git
cd ytsm
```
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!
2018-10-30 09:56:20 +00:00
2018-11-02 01:24:49 +00:00
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.
2018-10-30 09:56:20 +00:00
2018-11-02 01:24:49 +00:00
For more information about using Docker, check [this page](Docker_README.md).
2018-10-30 09:56:20 +00:00
### Deploying for production
2018-10-29 18:29:53 +00:00
This is a *django* project, so the correct way to deploy it to a server would be by using *mod_wsgi*. Since this project
is still in development, I haven't really thought about getting it ready for production.
If you are willing to try that, you can find the information on how to deploy this application on the
[Django website](https://docs.djangoproject.com/en/2.1/howto/deployment/).