Add MPC-BE remote control and resume support.
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
</div>
|
||||
<p v-if="getOverview(item)" class="collage-overview">{{ getOverview(item) }}</p>
|
||||
<div class="collage-buttons">
|
||||
<button class="btn btn-primary" @click.stop="handlePlay(item)">▶ Play</button>
|
||||
<button class="btn btn-primary" @click.stop="handlePlay(item)">▶ {{ getPlayLabel(item) }}</button>
|
||||
<button class="btn btn-secondary" @click.stop="$emit('info', item)">ℹ Info</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -416,6 +416,7 @@ function isItemVisible(index: number): boolean {
|
||||
const props = defineProps<{
|
||||
items: MediaItem[];
|
||||
featuredItem?: MediaItem | null;
|
||||
hasResumePosition: (filePath: string | null) => boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -530,6 +531,10 @@ function handlePlay(item: MediaItem) {
|
||||
if (file) emit('play', file);
|
||||
}
|
||||
|
||||
function getPlayLabel(item: MediaItem): string {
|
||||
return props.hasResumePosition(getPlayableFile(item)) ? 'Continue' : 'Play';
|
||||
}
|
||||
|
||||
function handleItemClick(item: MediaItem, index: number) {
|
||||
if (index === 0) {
|
||||
emit('info', item);
|
||||
|
||||
@@ -57,6 +57,11 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="mpcBeConnected" class="player-indicator" title="MPC-BE is connected">
|
||||
<span class="player-indicator-dot" aria-hidden="true"></span>
|
||||
<span>Player Open</span>
|
||||
</div>
|
||||
|
||||
<div v-if="isDesktopApp" class="header-settings">
|
||||
<button
|
||||
class="header-settings-btn"
|
||||
@@ -81,6 +86,7 @@ import { pickFolderAndRestart } from '../api';
|
||||
const props = defineProps<{
|
||||
currentView: 'movies' | 'series';
|
||||
searchQuery: string;
|
||||
mpcBeConnected: boolean;
|
||||
navRow: number;
|
||||
position: 'top' | 'after-hero' | 'after-movie-header' | 'after-series-hero';
|
||||
}>();
|
||||
@@ -180,3 +186,22 @@ onUnmounted(() => {
|
||||
window.removeEventListener('keydown', handleKeydown);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.player-indicator {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-right: 10px;
|
||||
font-size: 0.82rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.player-indicator-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 999px;
|
||||
background: #22c55e;
|
||||
box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
v-if="item.type === 'series'"
|
||||
:series="item.data as Series"
|
||||
:focus-episode="focusEpisode"
|
||||
:has-resume-position="hasResumePosition"
|
||||
@close="$emit('close')"
|
||||
@play="handlePlay"
|
||||
@openFolder="handleOpenFolder"
|
||||
@@ -95,7 +96,7 @@
|
||||
v-bind="navAttrs(2, index * 2)"
|
||||
@click="handlePlay(version.playable_file)"
|
||||
:disabled="!version.playable_file"
|
||||
>▶ Play</button>
|
||||
>▶ {{ getPlayLabel(version.playable_file) }}</button>
|
||||
<button
|
||||
class="btn btn-small btn-secondary"
|
||||
v-bind="navAttrs(2, index * 2 + 1)"
|
||||
@@ -148,6 +149,7 @@ import { navAttrs } from '../composables/useKeyboardNavigation';
|
||||
const props = defineProps<{
|
||||
item: MediaItem;
|
||||
focusEpisode?: { seasonNumber: number; episodeNumber: number } | null;
|
||||
hasResumePosition: (filePath: string | null) => boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -394,6 +396,10 @@ function handlePlay(filePath: string | null) {
|
||||
}
|
||||
}
|
||||
|
||||
function getPlayLabel(filePath: string | null): string {
|
||||
return props.hasResumePosition(filePath) ? 'Continue' : 'Play';
|
||||
}
|
||||
|
||||
function handleOpenFolder(folderPath: string) {
|
||||
emit('openFolder', folderPath);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
tabindex="0"
|
||||
@click="handlePlayVersion(torrent.playable_file)"
|
||||
:disabled="!torrent.playable_file"
|
||||
>▶ Play</button>
|
||||
>▶ {{ getPlayLabel(torrent.playable_file) }}</button>
|
||||
<button
|
||||
class="ctx-btn ctx-btn-folder"
|
||||
tabindex="0"
|
||||
@@ -164,6 +164,7 @@ import { navAttrs } from '../composables/useKeyboardNavigation';
|
||||
const props = defineProps<{
|
||||
series: Series;
|
||||
focusEpisode?: { seasonNumber: number; episodeNumber: number } | null;
|
||||
hasResumePosition: (filePath: string | null) => boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -302,6 +303,10 @@ function handlePlayVersion(filePath: string | null) {
|
||||
closeContextMenu();
|
||||
}
|
||||
|
||||
function getPlayLabel(filePath: string | null): string {
|
||||
return props.hasResumePosition(filePath) ? 'Continue' : 'Play';
|
||||
}
|
||||
|
||||
// Open folder for a version
|
||||
function handleOpenFolder(folderPath: string) {
|
||||
emit('openFolder', folderPath);
|
||||
|
||||
Reference in New Issue
Block a user