Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

space bar plays random video #680

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
"sortOrderDescription": "Sort order",
"sortOrderHint": "Sort order",
"sortOrderMoreInfo": "Show the sort order filter",
"spacePlaysRandomDescription": "Pressing spacebar plays random video from random starting time",
"spacePlaysRandomMoreInfo": "Random starting time only works when preferred video player is set",
"starFilterDescription": "Star",
"starFilterHint": "Star filter",
"starFilterMoreInfo": "Show the star filter",
Expand Down
10 changes: 9 additions & 1 deletion src/app/common/settings-buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export type SettingsButtonKey = 'autoFileTags'
| 'sortOptionTimesPlayed'
| 'sortOptionYear'
| 'sortOrder'
| 'spacePlaysRandom'
| 'starFilter'
| 'startWizard'
| 'tagExclusion'
Expand Down Expand Up @@ -202,6 +203,7 @@ export const SettingsButtonsGroups: SettingsButtonKey[][] = [
'showDeleteOption',
'dangerousDelete',
'playPlaylist',
'spacePlaysRandom',
'openAtTimestamp',
]
];
Expand Down Expand Up @@ -762,7 +764,13 @@ export const SettingsButtons: SettingsButtonsType = {
title: '',
toggled: false
},

'spacePlaysRandom': {
description: 'BUTTONS.spacePlaysRandomDescription',
hidden: false,
moreInfo: 'BUTTONS.spacePlaysRandomMoreInfo',
title: '',
toggled: false
},
'sortOptionFps': {
description: 'BUTTONS.sortOptionFpsDescription',
hidden: false,
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ export class HomeComponent implements OnInit, AfterViewInit {
this.sheetOverlayShowing = false;
} else if (event.key === 'Escape' && this.settingsButtons['showTags'].toggled) {
this.toggleButton('showTags');
} else if (event.key === ' ' && this.settingsButtons['spacePlaysRandom'].toggled) {
const randomIndex: number = Math.floor(Math.random() * this.pipeSideEffectService.galleryShowing.length);
const video: ImageElement = this.pipeSideEffectService.galleryShowing[randomIndex];
const randomPlayStart: number = Math.floor(Math.random() * video.screens);
this.openVideo(video, randomPlayStart);
}
}

Expand Down
Loading