From ddefc36800056aa2da30d3fbe01a59a0e9de9293 Mon Sep 17 00:00:00 2001 From: dmunozv04 <39565245+dmunozv04@users.noreply.github.com> Date: Sat, 15 Jan 2022 20:36:08 +0100 Subject: [PATCH] README --- .gitignore | 3 ++- main.py | 4 +--- readme.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 readme.md diff --git a/.gitignore b/.gitignore index b18f120..1bf8f55 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,5 @@ cython_debug/ #.idea/ #config folder -config/ \ No newline at end of file +config/ +config.json \ No newline at end of file diff --git a/main.py b/main.py index 4d354fe..4f63f97 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,8 @@ import sys import asyncio -from webbrowser import get import pyatv import aiohttp from async_lru import alru_cache -from datetime import timedelta import json @@ -127,7 +125,7 @@ async def loop_atv(event_loop, atv_config, apikey, categories): except: atv.close() -def load_config(config_file="config/config.json"): +def load_config(config_file="config.json"): with open(config_file) as f: config = json.load(f) return config["atvs"][0], config["apikey"], config["skip_categories"] diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..9a09330 --- /dev/null +++ b/readme.md @@ -0,0 +1,55 @@ +# iSponsorBlockTV + +Skip sponsor segments in YouTube videos playing on an Apple TV. + +This project is written in asycronous python and should be pretty quick. + +## Installation + +### Docker +`WIP` + +### From source + +You need to install [python](https://www.python.org/downloads/) first, and to make it available in your PATH. After, clone the repo. +Then you need to download the dependencies with pip: +```python3 -m pip install -r requirements.txt``` +Lastly, run ```main.py``` + +## Setup + +You need to retrieve airplay keys to be able to connect to the Apple TV. (It will be made simpler in the future) +For now, use `atvremote`, a script included in pyatv: +1. atvremote scan +2. atvremote pair --protocol airplay --id `identifier you got on the previous step` + +Get [YouTube api key](https://developers.google.com/youtube/registering_an_application) + +Edit config.json.template and save it as config.json +## Usage + +Run iSponsorBLockTV in the same network as the Apple TV. + +It connect to the Apple TV, watch its activity and skip any sponsor segment using the [SponsorBlock](https://sponsor.ajay.app/) API. + +The last 5 videos' segments are cached to limit the number on queries on SponsorBlock and YouTube. + +To exit press ENTER + +## Libraries used +- [pyatv](https://github.com/postlund/pyatv) Used to connect to the Apple TV +- [asyncio] and [aiohttp] +- [async_lru] +- [json] + +## Contributing + +1. Fork it () +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create a new Pull Request + +## Contributors + +- [dmunozv04](https://github.com/dmunozv04) - creator and maintainer \ No newline at end of file