jellyfin/README.md

127 lines
5.3 KiB
Markdown
Raw Normal View History

2023-04-05 16:31:14 +00:00
## Tube Archivist Jellyfin Integration
2023-08-05 03:37:34 +00:00
*Note: This repo was renamed from **tubearchivist/jellyfin** to **tubearchivist/tubearchivist-jf** to avoid confustion with the main Jellyfin repo.*
2023-04-05 16:31:14 +00:00
Import your Tube Archivist media folder into Jellyfin
![home screenshot](assets/screenshot-home.png?raw=true "Jellyfin Home")
2023-07-31 16:38:02 +00:00
This repo looks for regular contributors. If this is a useful integration, consider improving upon it.
This requires Tube Archivist v0.4.0 or later for API compatibility.
2023-04-05 16:31:14 +00:00
## Core functionality
- Import each YouTube channel as a TV Show
- Each year will become a Season of that Show
- Load artwork and additional metadata into Jellyfin
## How does that work?
2023-04-07 05:29:52 +00:00
At the core, this links the two APIs together: This first queries the Jellyfin API for YouTube videos for any videos that don't have metadata to then populate the required fields from Tube Archivist. Then as a secondary step this will transfer the artwork.
2023-04-05 16:31:14 +00:00
This doesn't depend on any additional Jellyfin plugins, that is a stand alone solution.
2023-04-11 01:15:33 +00:00
This is a *one way* sync, syncing metadata from TA to Jellyfin. This syncs in particular:
- Video title
- Video description
- Video date published
- Channel name
- Channel description
2023-04-05 16:31:14 +00:00
## Setup Jellyfin
2023-07-31 16:38:02 +00:00
Take a look at the example docker-compose.yml provided.
2023-04-05 16:31:14 +00:00
0. Add the Tube Archivist **/youtube** folder as a media folder for Jellyfin.
2023-07-31 16:38:02 +00:00
- IMPORTANT: This needs to be mounted as **read only** aka `ro`, otherwise this will mess up Tube Archivist.
2023-04-05 16:31:14 +00:00
1. Add a new media library to your Jellyfin server for your Tube Archivist videos, required options:
- Content type: `Shows`
- Displayname: `YouTube`
- Folder: Root folder for Tube Archivist videos
- Deactivate all Metadata downloaders
- Automatically refresh metadata from the internet: `Never`
- Deactivate all Image fetchers
2. Let Jellyfin complete the library scan
- This works best if Jellyfin has found all media files and Tube Archivist isn't currently downloading.
- At first, this will add all channels as a Show with a single Season 1.
2023-04-07 05:29:52 +00:00
- Then this script will populate the metadata.
2023-04-05 16:31:14 +00:00
2023-04-07 12:30:44 +00:00
3. Backdrops
- In your Jellyfin installation under > *Settings* > *Display* > enable *Backdrops* for best channel art viewing experience.
2023-07-31 16:38:02 +00:00
## Install with Docker
An example configuration is provided in the docker-compose.yml file. Configure these environment variables:
- `TA_URL`: Full URL where Tube Archivist is reachable
- `TA_TOKEN`: Tube Archivist API token, accessible from the settings page
- `JF_URL`: Full URL where Jellyfin is reachable
- `JF_TOKEN`: Jellyfin API token
- `LISTEN_PORT`: Optionally change the port where the integration is listening for messages. Defaults to `8001`. If you change this, make sure to also change the json link for auto trigger as described below.
Mount the `/youtube` folder from Tube Archivist also in this container at `/youtube` to give this integration access to the media archive.
### Manual trigger
For an initial import or for other irregular occasions, trigger the library scan from outside the container, e.g.:
```bash
docker exec -it tubearchivist-jf python main.py
```
### Auto trigger
Use the notification functionality of Tube Archivist to automatically trigger a library scan whenever the download task complets in Tube Archivist. For the `Start download` schedule on your settings page add a json Apprise link to send a push notification to the `tubearchivist-jf` container on task completion, make sure to specify the port, e.g.:
```
json://tubearchivist-jf:8001
```
2023-04-05 16:31:14 +00:00
## Install Standalone
1. Install required libraries for your environment, e.g.
```bash
2023-07-31 16:38:02 +00:00
pip install requests
2023-04-05 16:31:14 +00:00
```
2. rename/copy *config.sample.json* to *config.json*.
3. configure these keys:
- `ta_video_path`: Absolute path of your /youtube folder from Tube Archivist
- `ta_url`: Full URL where Tube Archivist is reachable
- `ta_token`: Tube Archivist API token, accessible from the settings page
- `jf_url`: Full URL where Jellyfin is reachable
- `jf_token`: Jellyfin API token
2023-07-27 15:38:49 +00:00
Then run the script from the main folder with python, e.g.
2023-04-05 16:31:14 +00:00
```python
2023-07-27 15:38:49 +00:00
python app/main.py
2023-04-05 16:31:14 +00:00
```
2023-04-07 12:04:11 +00:00
## Migration problems
2023-07-31 16:43:45 +00:00
Due to the filesystem change between Tube Archivist v0.3.6 to v0.4.0, this will reset your YouTube videos in Jellyfin and will add them as new again. Unfortunately there is no migration path.
2023-07-31 16:38:02 +00:00
2023-04-07 12:04:11 +00:00
To import an existing Tube Archivist archive created with v0.3.4 or before, there are a few manual steps needed. These issues are fixed with videos and channels indexed with v0.3.5 and later.
Apply these fixes *before* importing the archive.
**Permissions**
Fix folder permissions not owned by the correct user. Navigate to the `ta_video_path` and run:
```bash
sudo chown -R $UID:$GID .
```
**Channel Art**
Tube Archivist v0.3.5 adds additional art work to the channel metadata. To trigger an automatic refresh of your old channels open a Python shell within the *tubearchivist* container:
```bash
docker exec -it tubearchivist python
```
Then execute these lines to trigger a background task for a full metadata refresh for all channels.
```python
from home.src.es.connect import IndexPaginate
from home.tasks import check_reindex
query = {"query": {"match_all": {}}}
all_channels = IndexPaginate("ta_channel", query).get_results()
reindex = {"channel": [i["channel_id"] for i in all_channels]}
check_reindex.delay(data=reindex)
```