mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	feat: respect listen mode in recommended videos (#3430)
This commit is contained in:
		
							parent
							
								
									00c15cb8a7
								
							
						
					
					
						commit
						113e643c55
					
				
					 3 changed files with 14 additions and 4 deletions
				
			
		| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
            :item="related"
 | 
					            :item="related"
 | 
				
			||||||
            :index="index"
 | 
					            :index="index"
 | 
				
			||||||
            :playlist-id="playlistId"
 | 
					            :playlist-id="playlistId"
 | 
				
			||||||
 | 
					            :prefer-listen="preferListen"
 | 
				
			||||||
            height="94"
 | 
					            height="94"
 | 
				
			||||||
            width="168"
 | 
					            width="168"
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
| 
						 | 
					@ -15,6 +16,7 @@
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import { nextTick } from "vue";
 | 
					import { nextTick } from "vue";
 | 
				
			||||||
import VideoItem from "./VideoItem.vue";
 | 
					import VideoItem from "./VideoItem.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    components: { VideoItem },
 | 
					    components: { VideoItem },
 | 
				
			||||||
    props: {
 | 
					    props: {
 | 
				
			||||||
| 
						 | 
					@ -30,6 +32,10 @@ export default {
 | 
				
			||||||
            type: Number,
 | 
					            type: Number,
 | 
				
			||||||
            required: true,
 | 
					            required: true,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        preferListen: {
 | 
				
			||||||
 | 
					            type: Boolean,
 | 
				
			||||||
 | 
					            default: false,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    watch: {
 | 
					    watch: {
 | 
				
			||||||
        playlist: {
 | 
					        playlist: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@
 | 
				
			||||||
                    v: item.url.substr(-11),
 | 
					                    v: item.url.substr(-11),
 | 
				
			||||||
                    ...(playlistId && { list: playlistId }),
 | 
					                    ...(playlistId && { list: playlistId }),
 | 
				
			||||||
                    ...(index >= 0 && { index: index + 1 }),
 | 
					                    ...(index >= 0 && { index: index + 1 }),
 | 
				
			||||||
 | 
					                    ...(preferListen && { listen: 1 }),
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            }"
 | 
					            }"
 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
| 
						 | 
					@ -99,13 +100,13 @@
 | 
				
			||||||
                            v: item.url.substr(-11),
 | 
					                            v: item.url.substr(-11),
 | 
				
			||||||
                            ...(playlistId && { list: playlistId }),
 | 
					                            ...(playlistId && { list: playlistId }),
 | 
				
			||||||
                            ...(index >= 0 && { index: index + 1 }),
 | 
					                            ...(index >= 0 && { index: index + 1 }),
 | 
				
			||||||
                            listen: '1',
 | 
					                            ...(!preferListen && { listen: 1 }),
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                    }"
 | 
					                    }"
 | 
				
			||||||
                    :aria-label="'Listen to ' + title"
 | 
					                    :aria-label="preferListen ? title : 'Listen to ' + title"
 | 
				
			||||||
                    :title="'Listen to ' + title"
 | 
					                    :title="preferListen ? title : 'Listen to ' + title"
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
                    <i class="i-fa6-solid:headphones" />
 | 
					                    <font-awesome-icon :icon="preferListen ? 'i-fa6-solid:tv' : 'i-fa6-solid:headphones'" />
 | 
				
			||||||
                </router-link>
 | 
					                </router-link>
 | 
				
			||||||
                <button :title="$t('actions.add_to_playlist')" @click="showPlaylistModal = !showPlaylistModal">
 | 
					                <button :title="$t('actions.add_to_playlist')" @click="showPlaylistModal = !showPlaylistModal">
 | 
				
			||||||
                    <i class="i-fa6-solid:circle-plus" />
 | 
					                    <i class="i-fa6-solid:circle-plus" />
 | 
				
			||||||
| 
						 | 
					@ -167,6 +168,7 @@ export default {
 | 
				
			||||||
        hideChannel: { type: Boolean, default: false },
 | 
					        hideChannel: { type: Boolean, default: false },
 | 
				
			||||||
        index: { type: Number, default: -1 },
 | 
					        index: { type: Number, default: -1 },
 | 
				
			||||||
        playlistId: { type: String, default: null },
 | 
					        playlistId: { type: String, default: null },
 | 
				
			||||||
 | 
					        preferListen: { type: Boolean, default: false },
 | 
				
			||||||
        admin: { type: Boolean, default: false },
 | 
					        admin: { type: Boolean, default: false },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    emits: ["remove"],
 | 
					    emits: ["remove"],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -253,6 +253,7 @@
 | 
				
			||||||
                    :playlist-id="playlistId"
 | 
					                    :playlist-id="playlistId"
 | 
				
			||||||
                    :playlist="playlist"
 | 
					                    :playlist="playlist"
 | 
				
			||||||
                    :selected-index="index"
 | 
					                    :selected-index="index"
 | 
				
			||||||
 | 
					                    :prefer-listen="isListening"
 | 
				
			||||||
                />
 | 
					                />
 | 
				
			||||||
                <a
 | 
					                <a
 | 
				
			||||||
                    v-t="`actions.${showRecs ? 'minimize_recommendations' : 'show_recommendations'}`"
 | 
					                    v-t="`actions.${showRecs ? 'minimize_recommendations' : 'show_recommendations'}`"
 | 
				
			||||||
| 
						 | 
					@ -265,6 +266,7 @@
 | 
				
			||||||
                        v-for="related in video.relatedStreams"
 | 
					                        v-for="related in video.relatedStreams"
 | 
				
			||||||
                        :key="related.url"
 | 
					                        :key="related.url"
 | 
				
			||||||
                        :item="related"
 | 
					                        :item="related"
 | 
				
			||||||
 | 
					                        :prefer-listen="isListening"
 | 
				
			||||||
                        class="mb-4"
 | 
					                        class="mb-4"
 | 
				
			||||||
                        height="94"
 | 
					                        height="94"
 | 
				
			||||||
                        width="168"
 | 
					                        width="168"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue