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

feat: option to limit dearrow to certain channels #3982

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
26 changes: 26 additions & 0 deletions src/components/PreferencesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,26 @@
<strong v-t="'actions.enable_dearrow'" />
<input id="chkDeArrow" v-model="dearrow" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
<label class="pref" for="dearrowInclude">
<strong v-t="'channels to include (comma separated)'" />
<textarea
id="dearrowInclude"
v-model="dearrowInclude"
class="input mr-2 h-16 w-auto"
type="text"
@change="onChange($event)"
/>
</label>
<label class="pref" for="dearrowExclude">
<strong v-t="'channels to include (comma separated)'" />
<textarea
id="dearrowExclude"
v-model="dearrowExclude"
class="input mr-2 h-16 w-auto"
type="text"
@change="onChange($event)"
/>
</label>

<h2 v-t="'titles.instance'" class="text-center" />
<p v-t="'actions.instances_not_shown'" class="text-center" />
Expand Down Expand Up @@ -436,6 +456,8 @@ export default {
showMarkers: true,
minSegmentLength: 0,
dearrow: false,
dearrowInclude: "",
dearrowExclude: "",
selectedTheme: "dark",
autoPlayVideo: true,
autoDisplayCaptions: false,
Expand Down Expand Up @@ -557,6 +579,8 @@ export default {
this.showMarkers = this.getPreferenceBoolean("showMarkers", true);
this.minSegmentLength = Math.max(this.getPreferenceNumber("minSegmentLength", 0), 0);
this.dearrow = this.getPreferenceBoolean("dearrow", false);
this.dearrowInclude = this.getPreferenceString("dearrowInclude", "");
this.dearrowExclude = this.getPreferenceString("dearrowExclude", "");
this.selectedTheme = this.getPreferenceString("theme", "dark");
this.autoPlayVideo = this.getPreferenceBoolean("playerAutoPlay", true);
this.autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false);
Expand Down Expand Up @@ -618,6 +642,8 @@ export default {
localStorage.setItem("minSegmentLength", this.minSegmentLength);

localStorage.setItem("dearrow", this.dearrow);
localStorage.setItem("dearrowInclude", this.dearrowInclude);
localStorage.setItem("dearrowExclude", this.dearrowExclude);

localStorage.setItem("theme", this.selectedTheme);
localStorage.setItem("playerAutoPlay", this.autoPlayVideo);
Expand Down
8 changes: 7 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,14 @@ const mixin = {
},
fetchDeArrowContent(content) {
if (!this.getPreferenceBoolean("dearrow", false)) return;

let dearrowInclude = this.getPreferenceString("dearrowInclude", "");
let dearrowExclude = this.getPreferenceString("dearrowExclude", "");
dearrowInclude = dearrowInclude == "" ? null : dearrowInclude.split(",");
dearrowExclude = dearrowExclude == "" ? null : dearrowExclude.split(",");
const videoIds = content
.filter(item => item.type === "stream")
.filter(item => dearrowInclude === null || dearrowInclude.includes(item.uploaderName))
.filter(item => dearrowExclude === null || !dearrowExclude.includes(item.uploaderName))
.map(item => item.url.substr(-11))
.sort();

Expand All @@ -535,6 +540,7 @@ const mixin = {
Object.keys(json).forEach(videoId => {
const item = content.find(item => item.url.endsWith(videoId));
if (item) item.dearrow = json[videoId];
console.log(item);
});
});
},
Expand Down
Loading