Skip to content

Commit

Permalink
Update 'Only Show Latest Video for Each Channel' setting to handle a …
Browse files Browse the repository at this point in the history
…custom number of videos per channel (FreeTubeApp#5901)

* update onlyShowLatestFromChannel setting to handle a custom amount of videos

* update layout of subscription settings section

* remove unused localisation strings

* add labelledby attribute and update styling

* use slider
  • Loading branch information
c-ciobanu authored and Alban Dumas committed Jan 24, 2025
1 parent 0cf26e2 commit 3a8b41e
Show file tree
Hide file tree
Showing 43 changed files with 45 additions and 79 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.onlyShowLatestFromChannelNumber {
inline-size: calc(100% - 44px);
padding-inline-start: 44px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { defineComponent } from 'vue'
import { mapActions } from 'vuex'
import FtSettingsSection from '../ft-settings-section/ft-settings-section.vue'
import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue'
import FtSlider from '../ft-slider/ft-slider.vue'

export default defineComponent({
name: 'SubscriptionSettings',
components: {
'ft-settings-section': FtSettingsSection,
'ft-toggle-switch': FtToggleSwitch
'ft-toggle-switch': FtToggleSwitch,
'ft-slider': FtSlider,
},
computed: {
hideWatchedSubs: function () {
Expand All @@ -16,6 +18,9 @@ export default defineComponent({
onlyShowLatestFromChannel: function () {
return this.$store.getters.getOnlyShowLatestFromChannel
},
onlyShowLatestFromChannelNumber: function () {
return this.$store.getters.getOnlyShowLatestFromChannelNumber
},
useRssFeeds: function () {
return this.$store.getters.getUseRssFeeds
},
Expand All @@ -32,6 +37,7 @@ export default defineComponent({
'updateUseRssFeeds',
'updateFetchSubscriptionsAutomatically',
'updateOnlyShowLatestFromChannel',
'updateOnlyShowLatestFromChannelNumber',
'updateUnsubscriptionPopupStatus'
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
:compact="true"
@change="updateUseRssFeeds"
/>
<ft-toggle-switch
:label="$t('Settings.Subscription Settings.Confirm Before Unsubscribing')"
:default-value="unsubscriptionPopupStatus"
:compact="true"
@change="updateUnsubscriptionPopupStatus"
/>
</div>
<div class="switchColumn">
<ft-toggle-switch
Expand All @@ -27,22 +33,26 @@
@change="updateHideWatchedSubs"
/>
<ft-toggle-switch
:label="$t('Settings.Subscription Settings.Only Show Latest Video for Each Channel')"
:label="$t('Settings.Subscription Settings.Limit the number of videos displayed for each channel')"
:default-value="onlyShowLatestFromChannel"
:compact="true"
@change="updateOnlyShowLatestFromChannel"
/>
</div>
<div class="switchColumn">
<ft-toggle-switch
:label="$t('Settings.Subscription Settings.Confirm Before Unsubscribing')"
:default-value="unsubscriptionPopupStatus"
:compact="true"
@change="updateUnsubscriptionPopupStatus"
/>
<div class="onlyShowLatestFromChannelNumber">
<ft-slider
:label="$t('Settings.Subscription Settings.To')"
:default-value="onlyShowLatestFromChannelNumber"
:disabled="!onlyShowLatestFromChannel"
:min-value="1"
:max-value="30"
:step="1"
@change="updateOnlyShowLatestFromChannelNumber"
/>
</div>
</div>
</div>
</ft-settings-section>
</template>

<script src="./subscription-settings.js" />
<style src="./subscription-settings.css" scoped />
15 changes: 12 additions & 3 deletions src/renderer/helpers/subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,22 @@ export function updateVideoListAfterProcessing(videos) {
// ordered last to show first eligible video from channel
// if the first one incidentally failed one of the above checks
if (store.getters.getOnlyShowLatestFromChannel) {
const authors = new Set()
const authors = new Map()
videoList = videoList.filter((video) => {
if (!video.authorId) {
return true
} else if (!authors.has(video.authorId)) {
authors.add(video.authorId)
}

if (!authors.has(video.authorId)) {
authors.set(video.authorId, 1)
return true
} else {
const currentVideos = authors.get(video.authorId)

if (currentVideos < store.getters.getOnlyShowLatestFromChannelNumber) {
authors.set(video.authorId, currentVideos + 1)
return true
}
}

return false
Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ const state = {
listType: 'grid',
maxVideoPlaybackRate: 3,
onlyShowLatestFromChannel: false,
onlyShowLatestFromChannelNumber: 1,
openDeepLinksInNewWindow: false,
playNextVideo: false,
proxyHostname: '127.0.0.1',
Expand Down
1 change: 0 additions & 1 deletion static/locales/af.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ Settings:
Hide Videos on Watch: ''
Fetch Feeds from RSS: ''
Fetch Automatically: ''
Only Show Latest Video for Each Channel: ''
Confirm Before Unsubscribing: ''
Distraction Free Settings:
Distraction Free Settings: ''
Expand Down
1 change: 0 additions & 1 deletion static/locales/ar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ Settings:
Hide Videos on Watch: 'أخفِ الفيديوهات عند مشاهدتها'
Fetch Feeds from RSS: 'جلب المحتوى عن طريق RSS'
Fetch Automatically: جلب الخلاصة تلقائيا
Only Show Latest Video for Each Channel: عرض أحدث فيديو فقط لكل قناة
Confirm Before Unsubscribing: تجنب إلغاء الاشتراك عن طريق الخطأ

Data Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/be.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,6 @@ Settings:
Fetch Feeds from RSS: 'Атрымліваць стужкі з RSS'
Fetch Automatically: 'Аўтаматычна атрымліваць стужку'
Confirm Before Unsubscribing: Пацвердзіце перад тым як адпісацца
Only Show Latest Video for Each Channel: Паказваць толькі апошняе відэа для кожнага
канала
Distraction Free Settings:
Distraction Free Settings: 'Адцягненне ўвагі'
Sections:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/bg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,6 @@ Settings:
Hide Videos on Watch: 'Скриване на видеата при гледане'
Fetch Feeds from RSS: 'Извличане на съдържания през RSS'
Fetch Automatically: Автоматично извличане на съдържание
Only Show Latest Video for Each Channel: Показване само най-новите видеа за всеки
канал
Confirm Before Unsubscribing: Избягване на случайно отписване
Data Settings:
Data Settings: 'Данни'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ Settings:
Hide Videos on Watch: 'Skrýt přehraná videa'
Fetch Feeds from RSS: 'Získávat odběry z RSS'
Fetch Automatically: Automaticky načítat odběry
Only Show Latest Video for Each Channel: U každého kanálu zobrazit pouze nejnovější
video
Confirm Before Unsubscribing: Zamezit nechtěným odběrům
Distraction Free Settings:
Distraction Free Settings: 'Rozptylování'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/cy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,6 @@ Settings:
Hide Videos on Watch: 'Cuddio Fideos wrth Wylio'
Fetch Feeds from RSS: 'Nôl Llif RSS'
Fetch Automatically: 'Nôl Llif yn Awtomatig'
Only Show Latest Video for Each Channel: 'Dangos dim ond Fideo Diweddaraf Pob
Sianel'
Confirm Before Unsubscribing: Cadarnhau Cyn Dad-danysgrifio
Distraction Free Settings:
Distraction Free Settings: 'Dim Tarfu'
Expand Down
1 change: 0 additions & 1 deletion static/locales/da.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ Settings:
Subscription Settings: 'Abonnementsindstillinger'
Hide Videos on Watch: 'Skjul Videoer på Se'
Fetch Feeds from RSS: 'Hent Feeds fra RSS'
Only Show Latest Video for Each Channel: Vis Kun Seneste Video for Hver Kanal
Fetch Automatically: Hent Feed Automatisk
Confirm Before Unsubscribing: Bekræft Før Afmelding
Data Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/de-DE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,6 @@ Settings:
Hide Videos on Watch: Videos bei Wiedergabe ausblenden
Fetch Feeds from RSS: Feeds von RSS abrufen
Fetch Automatically: Feed automatisch abrufen
Only Show Latest Video for Each Channel: Nur das neueste Video für jeden Kanal
anzeigen
Confirm Before Unsubscribing: Unbeabsichtigtes Deabonnieren verhindern

Privacy Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/el.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ Settings:
Hide Videos on Watch: 'Απόκρυψη των βίντεο κατά την αναπαραγωγή'
Fetch Feeds from RSS: 'Φόρτωση τροφοδοσίας RSS'
Fetch Automatically: Αυτόματη Λήψη Τροφοδοσίας
Only Show Latest Video for Each Channel: Εμφάνιση μόνο του τελευταίου βίντεο για
κάθε κανάλι
Data Settings:
Data Settings: 'Ρυθμίσεις Δεδομένων'
Select Import Type: 'Επιλογή Τρόπου Εισαγωγής'
Expand Down
1 change: 0 additions & 1 deletion static/locales/en-GB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ Settings:
Hide Videos on Watch: 'Hide Videos on Watch'
Fetch Feeds from RSS: 'Fetch feeds from RSS'
Fetch Automatically: Fetch feed automatically
Only Show Latest Video for Each Channel: Only show latest video for each channel
Confirm Before Unsubscribing: Confirm before unsubscribing
Data Settings:
Data Settings: 'Data'
Expand Down
3 changes: 2 additions & 1 deletion static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ Settings:
Hide Videos on Watch: Hide Videos on Watch
Fetch Feeds from RSS: Fetch Feeds from RSS
Fetch Automatically: Fetch Feed Automatically
Only Show Latest Video for Each Channel: Only Show Latest Video for Each Channel
'Limit the number of videos displayed for each channel': 'Limit the number of videos displayed for each channel'
To: To
Confirm Before Unsubscribing: Confirm Before Unsubscribing
Distraction Free Settings:
Distraction Free Settings: Distraction Free
Expand Down
2 changes: 0 additions & 2 deletions static/locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ Settings:
Hide Videos on Watch: 'Ocultar vídeos vistos'
Fetch Feeds from RSS: 'Recuperar suministros desde RSS'
Fetch Automatically: Obtener los feed automáticamente
Only Show Latest Video for Each Channel: Mostrar solo los últimos vídeos de cada
canal
Confirm Before Unsubscribing: Evitar bajas accidentales
Data Settings:
Data Settings: 'Datos'
Expand Down
1 change: 0 additions & 1 deletion static/locales/et.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ Settings:
Hide Videos on Watch: 'Vaatamisel peida videod'
Fetch Feeds from RSS: 'Laadi RSS-uudisvood'
Fetch Automatically: Laadi tellimuste voog automaatselt
Only Show Latest Video for Each Channel: Iga kanali puhul näita vaid viimast videot
Confirm Before Unsubscribing: Väldi ekslikku ja juhuslikku tellimusest loobumist
Data Settings:
Data Settings: 'Andmehaldus'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/eu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,6 @@ Settings:
Hide Videos on Watch: 'Ikusten ari zaren bideoa ezkutatu'
Fetch Feeds from RSS: 'RSS jarioak eskuratu'
Fetch Automatically: Eskuratu jarioa automatikoki
Only Show Latest Video for Each Channel: Erakutsi soilik kanal bakoitzeko azken
bideoa
Confirm Before Unsubscribing: Saihestu ustekabeko harpidetza kentzea
Distraction Free Settings:
Distraction Free Settings: 'Oharkabetasunik ez'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/fi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@ Settings:
Hide Videos on Watch: 'Piilota katsotut videot'
Fetch Feeds from RSS: Nouda RSS-syöte
Fetch Automatically: Nouda syöte automaattisesti
Only Show Latest Video for Each Channel: Näytä vain jokaisen kanavan uusin video

Privacy Settings:
Watch history has been cleared: Katseluhistoria poistettiin
Are you sure you want to remove your entire watch history?: Haluatko varmasti
Expand Down
2 changes: 0 additions & 2 deletions static/locales/fr-FR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,6 @@ Settings:
Hide Videos on Watch: 'Masquer les vidéos visionnées'
Fetch Feeds from RSS: Récupération de flux RSS
Fetch Automatically: Récupération automatique des flux
Only Show Latest Video for Each Channel: Afficher uniquement la dernière vidéo
pour chaque chaîne
Confirm Before Unsubscribing: Évitez les désabonnements accidentels

Privacy Settings:
Expand Down
1 change: 0 additions & 1 deletion static/locales/he.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ Settings:
Fetch Feeds from RSS: 'ייבוא עדכונים בעזרת RSS'
Fetch Automatically: משיכת ערוץ העדכונים אוטומטית
Confirm Before Unsubscribing: אישור לפני ביטול מינוי
Only Show Latest Video for Each Channel: להציג רק את הסרטון האחרון לכל ערוץ
Data Settings:
Data Settings: 'נתונים'
Select Import Type: 'נא לבחור את תסדיר הייבוא'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/hr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,6 @@ Settings:
Hide Videos on Watch: 'Sakrij video nakon gledanja'
Fetch Feeds from RSS: 'Dohvati feedove s RSS-a'
Fetch Automatically: Automatski dohvati feed
Only Show Latest Video for Each Channel: Prikaži samo najnoviji video za svaki
kanal
Confirm Before Unsubscribing: Izbjegni slučajno otkazivanje pretplate

Data Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/hu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ Settings:
Hide Videos on Watch: 'Videók elrejtése megtekintés után'
Fetch Feeds from RSS: 'RSS-hírcsatornák beolvasása'
Fetch Automatically: Hírcsatorna automatikus lekérdezése
Only Show Latest Video for Each Channel: Csak a legújabb videókat jelenítse meg
a csatornáktól
Confirm Before Unsubscribing: Kerülje el a véletlen leiratkozást
Data Settings:
Data Settings: 'Adat'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/id.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ Settings:
Hide Videos on Watch: 'Sembunyikan Video saat Menonton'
Fetch Feeds from RSS: 'Ambil Umpan dari RSS'
Fetch Automatically: Ambil Umpan Secara Otomatis
Only Show Latest Video for Each Channel: Hanya Tampilkan Video Terbaru untuk Setiap
Kanal
Data Settings:
Data Settings: 'Pengaturan Data'
Select Import Type: 'Pilih Tipe Impor'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/is.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,6 @@ Settings:
Hide Videos on Watch: 'Fela myndskeið eftir áhorf'
Fetch Feeds from RSS: 'Ná í streymi úr RSS'
Fetch Automatically: Sækja streymi sjálfvirkt
Only Show Latest Video for Each Channel: Aðeins birta nýjasta myndskeið fyrir
hverja myndskeiðarás
Confirm Before Unsubscribing: Staðfesta uppsögn áskriftar
Distraction Free Settings:
Distraction Free Settings: 'Truflanaminnkandi'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ Settings:
Hide Videos on Watch: 'Nascondi i video visualizzati'
Fetch Feeds from RSS: Scarica gli aggiornamenti dai flussi RSS
Fetch Automatically: Recupera i feed automaticamente
Only Show Latest Video for Each Channel: Mostra solo il video più recente per
ciascun canale
Confirm Before Unsubscribing: Evita la cancellazione accidentale dell'iscrizione

Data Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ Settings:
Fetch Feeds from RSS: RSS から情報取得
Fetch Automatically: フィードの自動取得
Confirm Before Unsubscribing: 登録解除する前に確認画面を表示する
Only Show Latest Video for Each Channel: 各チャンネルの最新動画のみを表示する

Privacy Settings:
Save Watched Progress: 再生位置の保存
Remember History: 履歴の保存
Expand Down
2 changes: 0 additions & 2 deletions static/locales/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,6 @@ Settings:
Hide Videos on Watch: 'Bekeken video''s verbergen'
Fetch Feeds from RSS: Feeds ophalen via RSS
Fetch Automatically: Feed automatisch ophalen
Only Show Latest Video for Each Channel: Alleen nieuwste video voor elk kanaal
tonen
Confirm Before Unsubscribing: Onbedoeld deabonneren voor­komen

Data Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/pl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,6 @@ Settings:
Hide Videos on Watch: 'Ukrywaj filmy po obejrzeniu'
Fetch Feeds from RSS: Pobierz subskrypcje z RSS
Fetch Automatically: Automatycznie odświeżaj subskrypcje
Only Show Latest Video for Each Channel: Pokaż tylko najnowszy film z każdego
kanału
Confirm Before Unsubscribing: Uniknij przypadkowego usunięcia subskrypcji

Privacy Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/pt-BR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,6 @@ Settings:
Hide Videos on Watch: 'Ocultar vídeos após assisti-los'
Fetch Feeds from RSS: Buscar Informações através de RSS
Fetch Automatically: Buscar feed automaticamente
Only Show Latest Video for Each Channel: Mostrar apenas vídeo mais recente para
cada canal
Confirm Before Unsubscribing: Evitar cancelamento acidental de inscrições

Privacy Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/pt-PT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,6 @@ Settings:
Hide Videos on Watch: Ocultar vídeos visualizados
Fetch Feeds from RSS: Obter subscrições através de RSS
Fetch Automatically: Obter fontes automaticamente
Only Show Latest Video for Each Channel: Mostrar apenas o último vídeo de cada
canal
Confirm Before Unsubscribing: Impedir cancelamento acidental de subscrições
Distraction Free Settings:
Distraction Free Settings: Definições de distrações
Expand Down
2 changes: 0 additions & 2 deletions static/locales/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ Settings:
Hide Videos on Watch: 'Ocultar vídeos visualizados'
Fetch Feeds from RSS: 'Obter subscrições através de RSS'
Fetch Automatically: Obter fontes automaticamente
Only Show Latest Video for Each Channel: Mostrar apenas o último vídeo de cada
canal
Confirm Before Unsubscribing: Impedir cancelamento acidental de subscrições
Data Settings:
Data Settings: 'Dados'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/ro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,6 @@ Settings:
Fetch Feeds from RSS: 'Preluare de fluxuri din RSS'
Fetch Automatically: Preluați feedul automat
Confirm Before Unsubscribing: Confirmă înainte de dezabonare
Only Show Latest Video for Each Channel: Arată doar cele mai noi videoclipuri
pentru fiecare canal
Data Settings:
Data Settings: 'Setări de date'
Select Import Type: 'Selectează tipul de import'
Expand Down
2 changes: 0 additions & 2 deletions static/locales/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,6 @@ Settings:
Hide Videos on Watch: 'Скрывать видео после просмотра'
Fetch Feeds from RSS: Получать ленты из RSS
Fetch Automatically: Автоматически получать ленту
Only Show Latest Video for Each Channel: Показывать только последние видео для
каждого канала
Confirm Before Unsubscribing: Подтвердить, прежде чем отписаться

Privacy Settings:
Expand Down
2 changes: 0 additions & 2 deletions static/locales/sr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ Settings:
Hide Videos on Watch: 'Сакриј видео снимке на гледању'
Fetch Feeds from RSS: 'Прикупи фидове из RSS-а'
Fetch Automatically: Аутоматски прикупи фид
Only Show Latest Video for Each Channel: Прикажи само најновији видео снимак за
сваки канал
Confirm Before Unsubscribing: Избегни случајно отпраћивање
Distraction Free Settings:
Distraction Free Settings: 'Без ометања'
Expand Down
Loading

0 comments on commit 3a8b41e

Please sign in to comment.