Skip to content

Commit af47db0

Browse files
committed
refactor(DLNA): loop though settings and allow editing
1 parent e900c43 commit af47db0

File tree

4 files changed

+452
-317
lines changed

4 files changed

+452
-317
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
<template>
2+
<v-card class="dlnaEntryEditor">
3+
<v-row class="ma-0 justify-space-between align-center">
4+
<v-card-title>{{ $t('settings.dlna.entryEditor') }}</v-card-title>
5+
<v-btn icon class="mr-2" @click="$emit('close-editor')">
6+
<v-icon>mdi-close</v-icon>
7+
</v-btn>
8+
</v-row>
9+
<v-card-text>
10+
<v-container>
11+
<v-row>
12+
<v-col
13+
v-for="key in Object.keys(currentEntryData)"
14+
:key="key"
15+
cols="12"
16+
sm="6"
17+
md="4"
18+
>
19+
<v-select
20+
v-if="key === 'Method'"
21+
v-model="currentEntryData[key]"
22+
:items="Object.values(deliveryMethod)"
23+
outlined
24+
:label="$t('settings.dlna.table.' + key)"
25+
/>
26+
<v-select
27+
v-else-if="key === 'Type' && category === 'CodecProfiles'"
28+
v-model="currentEntryData[key]"
29+
:items="Object.values(codecType)"
30+
outlined
31+
:label="$t('settings.dlna.table.' + key)"
32+
/>
33+
<v-select
34+
v-else-if="key === 'Type'"
35+
v-model="currentEntryData[key]"
36+
:items="Object.values(dlnaMediaType)"
37+
outlined
38+
:label="$t('settings.dlna.table.' + key)"
39+
/>
40+
<v-select
41+
v-else-if="key === 'TranscodeSeekInfo'"
42+
v-model="currentEntryData[key]"
43+
:items="Object.values(transcodeSeekInfo)"
44+
outlined
45+
:label="$t('settings.dlna.table.' + key)"
46+
/>
47+
<v-select
48+
v-else-if="key === 'Context'"
49+
v-model="currentEntryData[key]"
50+
:items="Object.values(encodingContext)"
51+
outlined
52+
:label="$t('settings.dlna.table.' + key)"
53+
/>
54+
<v-text-field
55+
v-else-if="typeof currentEntryData[key] === 'string'"
56+
v-model="currentEntryData[key]"
57+
:label="$t('settings.dlna.table.' + key)"
58+
outlined
59+
/>
60+
<v-text-field
61+
v-else-if="typeof currentEntryData[key] === 'number'"
62+
v-model.number="currentEntryData[key]"
63+
:label="$t('settings.dlna.table.' + key)"
64+
type="number"
65+
outlined
66+
/>
67+
<v-checkbox
68+
v-else-if="typeof currentEntryData[key] === 'boolean'"
69+
v-model="currentEntryData[key]"
70+
:label="$t('settings.dlna.table.' + key)"
71+
/>
72+
</v-col>
73+
</v-row>
74+
</v-container>
75+
</v-card-text>
76+
<v-card-actions>
77+
<v-btn color="success" @click="$emit('save-item', currentEntryData)">
78+
{{ $t('settings.dlna.profile.save') }}
79+
</v-btn>
80+
</v-card-actions>
81+
</v-card>
82+
</template>
83+
84+
<script lang="ts">
85+
import Vue from 'vue';
86+
import {
87+
CodecProfile,
88+
ContainerProfile,
89+
DirectPlayProfile,
90+
DlnaProfileType,
91+
ResponseProfile,
92+
SubtitleDeliveryMethod,
93+
SubtitleProfile,
94+
TranscodeSeekInfo,
95+
TranscodingProfile,
96+
XmlAttribute
97+
} from '@jellyfin/client-axios';
98+
import { CodecType } from '@jellyfin/client-axios/dist/models/codec-type';
99+
import { EncodingContext } from '@jellyfin/client-axios/dist/models/encoding-context';
100+
101+
export default Vue.extend({
102+
props: {
103+
entryData: {
104+
type: Object as () =>
105+
| SubtitleProfile
106+
| DirectPlayProfile
107+
| TranscodingProfile
108+
| ContainerProfile
109+
| CodecProfile
110+
| ResponseProfile
111+
| XmlAttribute,
112+
default: () => {
113+
return {};
114+
}
115+
},
116+
category: {
117+
default: '',
118+
type: String
119+
}
120+
},
121+
data() {
122+
return {
123+
currentEntryData: undefined as
124+
| SubtitleProfile
125+
| DirectPlayProfile
126+
| TranscodingProfile
127+
| ContainerProfile
128+
| CodecProfile
129+
| ResponseProfile
130+
| XmlAttribute
131+
| undefined,
132+
deliveryMethod: SubtitleDeliveryMethod,
133+
codecType: CodecType,
134+
dlnaMediaType: DlnaProfileType,
135+
transcodeSeekInfo: TranscodeSeekInfo,
136+
encodingContext: EncodingContext
137+
};
138+
},
139+
beforeMount() {
140+
this.bindToData();
141+
},
142+
methods: {
143+
bindToData() {
144+
this.currentEntryData = JSON.parse(JSON.stringify(this.entryData));
145+
}
146+
}
147+
});
148+
</script>
149+
150+
<style lang="scss" scoped>
151+
.dlnaEntryEditor {
152+
width: 80em;
153+
}
154+
</style>

0 commit comments

Comments
 (0)