[PR #1689] [CLOSED] Auto skip intro by chapter start and end property #1662

Closed
opened 2026-04-25 00:00:27 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1689
Author: @ZaneYork
Created: 9/19/2025
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • f3af0bc Auto skip intro by chapter start and end property

📊 Changes

1 file changed (+21 additions, -1 deletions)

View changed files

📝 components/app/AudioPlayer.vue (+21 -1)

📄 Description

Brief summary

Add a player logic, when currentTime is not within the chapter's begin and end, skip to next chapter's beginning.

Which issue is fixed?

Implements https://github.com/advplyr/audiobookshelf-app/issues/749

Pull Request Type

Player's seek logic for both IOS and Android App

In-depth Description

The solution is a partial logic of mobile side to auto skip op and ed. Currently, we need a extra script to modify book's metadata to modify chapter's begin and end properties.

Here is the script i'm using now (need to rescan to let audiobookshelf read the change):

import json
import os
import shutil
import sys

def modify_json_file(file_path, offset_a, offset_b):
    # backup original file
    backup_path = file_path + '.bak'
    shutil.copy2(file_path, backup_path)
    
    # read json file
    with open(file_path, 'r', encoding='utf-8') as f:
        data = json.load(f)
    
    # modify chapters start and end property
    if 'chapters' in data:
        for chapter in data['chapters']:
            if 'start' in chapter:
                chapter['start'] += offset_a
            if 'end' in chapter:
                chapter['end'] -= offset_b
    
    # write back
    with open(file_path, 'w', encoding='utf-8') as f:
        json.dump(data, f, indent=4, ensure_ascii=False)

if __name__ == '__main__':
    if len(sys.argv) != 4:
        print("Usage: python json_modifier.py <json_file_path> <offset_A> <offset_B>")
        sys.exit(1)
    
    try:
        json_path = sys.argv[1]
        offset_a = float(sys.argv[2])
        offset_b = float(sys.argv[3])
        
        if not os.path.exists(json_path):
            raise FileNotFoundError(f"JSON file not found: {json_path}")
            
        modify_json_file(json_path, offset_a, offset_b)
        print(f"Successfully modified {json_path} and created backup")
        
    except Exception as e:
        print(f"Error: {str(e)}")
        sys.exit(1)

How have you tested this?

  • Started App in Android device
  • Connected to Server
  • Opened Book
  • Play to chapter's ending
  • Wait untill it auto skip to next chapter's beginning

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1689 **Author:** [@ZaneYork](https://github.com/ZaneYork) **Created:** 9/19/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`f3af0bc`](https://github.com/advplyr/audiobookshelf-app/commit/f3af0bccc23603aa1beeb13c4fdd3a97cd46797b) Auto skip intro by chapter start and end property ### 📊 Changes **1 file changed** (+21 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `components/app/AudioPlayer.vue` (+21 -1) </details> ### 📄 Description ## Brief summary Add a player logic, when currentTime is not within the chapter's begin and end, skip to next chapter's beginning. ## Which issue is fixed? Implements https://github.com/advplyr/audiobookshelf-app/issues/749 ## Pull Request Type Player's seek logic for both IOS and Android App ## In-depth Description The solution is a partial logic of mobile side to auto skip op and ed. Currently, we need a extra script to modify book's metadata to modify chapter's begin and end properties. Here is the script i'm using now (need to rescan to let audiobookshelf read the change): ``` import json import os import shutil import sys def modify_json_file(file_path, offset_a, offset_b): # backup original file backup_path = file_path + '.bak' shutil.copy2(file_path, backup_path) # read json file with open(file_path, 'r', encoding='utf-8') as f: data = json.load(f) # modify chapters start and end property if 'chapters' in data: for chapter in data['chapters']: if 'start' in chapter: chapter['start'] += offset_a if 'end' in chapter: chapter['end'] -= offset_b # write back with open(file_path, 'w', encoding='utf-8') as f: json.dump(data, f, indent=4, ensure_ascii=False) if __name__ == '__main__': if len(sys.argv) != 4: print("Usage: python json_modifier.py <json_file_path> <offset_A> <offset_B>") sys.exit(1) try: json_path = sys.argv[1] offset_a = float(sys.argv[2]) offset_b = float(sys.argv[3]) if not os.path.exists(json_path): raise FileNotFoundError(f"JSON file not found: {json_path}") modify_json_file(json_path, offset_a, offset_b) print(f"Successfully modified {json_path} and created backup") except Exception as e: print(f"Error: {str(e)}") sys.exit(1) ``` ## How have you tested this? * Started App in Android device * Connected to Server * Opened Book * Play to chapter's ending * Wait untill it auto skip to next chapter's beginning --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:27 +02:00
adam closed this issue 2026-04-25 00:00:27 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1662