Skip to content

Commit

Permalink
Merge pull request #25 from alaindet/feature/subtitles
Browse files Browse the repository at this point in the history
Feature/subtitles
  • Loading branch information
alaindet committed Feb 22, 2021
2 parents 408004b + a847f8e commit eaa8b25
Show file tree
Hide file tree
Showing 29 changed files with 505 additions and 86 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [1.3.0] - 2021-02-22

### Added
- Subtitles feature


## [1.2.1] - 2021-02-10

### Fixed
Automatic tracking issue
- Automatic tracking issue


## [1.2.0] - 2021-02-09

### Added
- `--videos-path` option to `npm start` and `npm run build-cache` scripts


## [1.1.0] - 2021-02-09

### Added
Expand All @@ -25,7 +33,8 @@ Automatic tracking issue
### Fixed
- Alerts reset the timeout each time they appear


## [1.0.0] - 2021-02-07

### Added
v1.0.0 released
- v1.0.0 released
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,31 @@ Offline Video Player is admittedly a specific solution to a specific problem, so
- `--force-cache` (Default `false`) Force to rebuild the videos cache file
- `--force-tracking` (Default `false`) Force to rebuild and reset the videos tracking
- `--videos-path` (Default: `/videos`) Change the videos folder (accepts only *full paths*)
- `--subtitles` (Default: `false`) Adds a subtitle track if given a BCP47-compliant language code. See **Subtitles** paragraph below

- `npm run build-cache` Rebuild the videos cache file from videos folder. Options are
- `--videos-path` (Default: `/videos`) Change the videos folder (accepts only *full paths*)
- `--subtitles` (Default: `false`) Same as `--subtitles` option of `npm run start`

- `npm run build-tracking` Rebuild the videos tracking feature

- `npm run reset` Reset all generated files (WARNING: Deletes progress)

### Subtitles
- Subtitles are added as an additional `<track>` HTML element when either `npm run start` or `npm run build-cache` are given the `--subtitles` option. Ex.:
```
npm run start -- --subtitles=it
npm run start -- --subtitles
npm run build-cache -- --subtitles=en
npm run build-cache -- --subtitles
```
- If no value for the option is provided (Ex.: `--subtitles` instead of `--subtitles=it`), a default value (`en`) is assumed
- The `--subtitles` value must be a [BCP47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) compliant language code, ex.: `en`, `it` or `de` ([Official reference](https://tools.ietf.org/html/bcp47) here)
- Given a video file with path `foo.mp4`, its subtitles file path is determined as follows
1. Check if `foo.srt` exists in the same folder
2. Check if `foo.{lang}.srt` exists (Ex.: `foo.en.srt`) in the same folder
3. If none exists, skip subtitles for this video


## Options

Expand All @@ -77,9 +97,9 @@ Offline Video Player is admittedly a specific solution to a specific problem, so
# NOPE
npm start -- --videos-path=C:\your\specific\path # IT DOES NOT WORK!
```

but these two work

```
# YEP
npm start -- --videos-path="C:\your\specific\path"
Expand Down
224 changes: 224 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
"express-session": "^1.17.1",
"get-video-duration": "^3.0.2",
"glob": "^7.1.6",
"language-tags": "^1.0.5",
"multer": "^1.4.2",
"natural-orderby": "^2.0.3",
"normalize-path": "^3.0.0",
"open": "^7.3.1",
"srt-to-vtt": "^1.1.3",
"yargs": "^16.2.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit eaa8b25

Please sign in to comment.