aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md95
1 files changed, 66 insertions, 29 deletions
diff --git a/README.md b/README.md
index ff43750..fef2678 100644
--- a/README.md
+++ b/README.md
@@ -1,45 +1,82 @@
-# MPV-Android Sleep # Requirements
+# MPV-Android Sleep
+A gesture-controlled sleep timer for mpv-android that saves and restores playback positions.
+<!--insert video demonstration or screenshots-->
-# Setup For the Dummies
-In mpv-android
+## Features
+ Set a sleep timer with simple touch gestures
+- Save playback position when timer expires
+- Restore previous playback position for each media file
+- On-screen display (OSD) for timer status
-1. Set the gesture in `Settings > Touch gestures > Double tap (right)` (or other of your choice).
+## Usage
+The available gestures in mpv-android are limited, so for now this script uses cycling logic.
+- First gesture: begin the sleep timer
+- Gesture again to cancel the sleep timer
+- Gesture again to reinstate the timer (from last **completed** timer)
+- Gesture again to cancel the reinstatment
+## Requirements
+- MPV-Android ([api29 or later](https://github.com/mpv-android/mpv-android/releases))
-2. In `Settings > Advanced > Edit input.conf`
- add: `0x1000* script-binding sleep` where `*` should be set as 1, 2, or 3, based on your choice in #2. See key codes below.
-
-Key Codes (gestures):
-- `0x10001` ---> left
-- `0x10002` ---> center
-- `0x10003` ---> right<br><br>
-
-<!--
-| Gesture | Key Code |
-|---------|-----------|
-| Left | 0x10001 |
-| Center | 0x10002 |
-| Right | 0x10003 |
--->
+- Read storage permissions: (to enable the script to read file names for saving playback positions.)
+ ```
+ $: adb shell pm grant is.xyz.mpv android.permission.READ_EXTERNAL_STORAGE
+ ```
+## Installation
+1. Download Files
+ ```
+ $: git clone github.com/arachnida82/mpv-sleep &&
+ adb push mpv-sleep/lua/sleep.lua /storage/emulated/0/Android/media/is.xyz.mpv/scripts/ &&
+ adb push mpv-sleep/sleep.json /storage/emulated/0/Android/media/is.xyz.mpv/scripts
+ ```
+(`sleep.json` and `sleep.lua` must be placed in `is.xyz.mpv/*`, thus we have them in `scripts`)
-3. edit `mpv.conf` In `Settings > Advanced > Edit mpv.conf` and add: `script=/storage/emulated/0/Android/media/is.xyz.mpv/scripts/sleep.lua`
+## Setup
+**Enable Script**
-4. Either download [sleep.lua](https://urlcom) on **mobile** to `Android/media/is.xyz.mpv/scripts/`
+In mpv-android, navigate to `Settings > Advanced > Edit mpv.conf` and add the line:
+```
+script=/storage/emulated/0/Android/media/is.xyz.mpv/scripts/sleep.lua
+```
- or on **PC ---> Android**, use [adb](https://url.com).
+**Configure Gestures**
+1. Choose a *gesture* in `Settings > Touch gestures`
+2. Edit `Settings > Advanced > Edit input.conf` and add:
```
- $: adb push sleep.lua /storage/emulated/0/Android/media/is.xyz.mpv/scripts/
+ KEYCODE script-binding sleep
```
+ Replace *KEYCODE* with the key code corresponding to the gesture you selected in touch gestures.
+<div align="center">
+
+| Gesture (double tap) | Key Code |
+|----------------------|-----------|
+| Left | 0x10001 |
+| Center | 0x10002 |
+| Right | 0x10003 |
+
+</div>
+
+## Configuration
+edit `sleep.json` to customize:
+```json
+{
+ "config": {
+ "default_time": 25,
+ "display_time": true,
+ }
+}
+```
+
+For example, `"display_time": false,` removes the OSD countdown, but the timer continues in the background.
+## Contributing
+This script works well enough for my needs as is. However, pull requests are more than welcomed!
-## ignore
-<!--
-We need to retrieve user input. MPV OSD can output content, but not retrieve input.
-We could use [termux-dialog](https://wiki.termux.com/wiki/Termux-dialog), but that's bloated.
+For major changes, please open an issue first to discuss what you would like to change.
-Alternatively, we can write a small app that sleep.lua executes to retrieve user input through a simple dialogue
--->
+## License
+This script is licensed under the [TBD] license - see the [LICENSE](LICENSE) file for details.