Fix and add Locales. Add Reverse playlist functionality

This commit is contained in:
Preston 2020-09-09 18:58:35 -04:00
parent 61d0f78a5a
commit dea4eba109
12 changed files with 57 additions and 15 deletions

View File

@ -422,7 +422,7 @@ export default Vue.extend({
} }
this.showToast({ this.showToast({
message: this.$t('Settings.Data Settings.All subscriptions have been successfully exported') message: this.$t('Settings.Data Settings.Subscriptions have been successfully exported')
}) })
}) })
}) })
@ -489,7 +489,7 @@ export default Vue.extend({
} }
this.showToast({ this.showToast({
message: this.$t('Settings.Data Settings.All subscriptions have been successfully exported') message: this.$t('Settings.Data Settings.Subscriptions have been successfully exported')
}) })
}) })
}) })
@ -557,7 +557,7 @@ export default Vue.extend({
} }
this.showToast({ this.showToast({
message: this.$t('Settings.Data Settings.All subscriptions have been successfully exported') message: this.$t('Settings.Data Settings.Subscriptions have been successfully exported')
}) })
}) })
}) })

View File

@ -19,7 +19,7 @@
@click="importHistory" @click="importHistory"
/> />
<ft-button <ft-button
:label="$t('Settings.Data Settings.Export Subscriptions')" :label="$t('Settings.Data Settings.Export History')"
@click="exportHistory" @click="exportHistory"
/> />
</ft-flex-box> </ft-flex-box>

View File

@ -18,7 +18,7 @@
<h3 <h3
class="profileListTitle" class="profileListTitle"
> >
Profile Select {{ $t("Profile.Profile Select") }}
</h3> </h3>
<ft-icon-button <ft-icon-button
class="profileSettings" class="profileSettings"

View File

@ -28,6 +28,7 @@ export default Vue.extend({
isLoading: false, isLoading: false,
shuffleEnabled: false, shuffleEnabled: false,
loopEnabled: false, loopEnabled: false,
reversePlaylist: false,
channelName: '', channelName: '',
channelId: '', channelId: '',
channelThumbnail: '', channelThumbnail: '',
@ -132,6 +133,19 @@ export default Vue.extend({
} }
}, },
toggleReversePlaylist: function () {
this.isLoading = true
this.showToast({
message: this.$t('The playlist has been reversed')
})
this.reversePlaylist = !this.reversePlaylist
this.playlistItems = this.playlistItems.reverse()
setTimeout(() => {
this.isLoading = false
}, 1)
},
playNextVideo: function () { playNextVideo: function () {
const playlistInfo = { const playlistInfo = {
playlistId: this.playlistId playlistId: this.playlistId

View File

@ -28,22 +28,33 @@
class="playlistIcon" class="playlistIcon"
:class="{ playlistIconActive: loopEnabled }" :class="{ playlistIconActive: loopEnabled }"
icon="retweet" icon="retweet"
:title="$t('Video.Loop Playlist')"
@click="toggleLoop" @click="toggleLoop"
/> />
<font-awesome-icon <font-awesome-icon
class="playlistIcon" class="playlistIcon"
:class="{ playlistIconActive: shuffleEnabled }" :class="{ playlistIconActive: shuffleEnabled }"
icon="random" icon="random"
:title="$t('Video.Shuffle Playlist')"
@click="toggleShuffle" @click="toggleShuffle"
/> />
<font-awesome-icon
class="playlistIcon"
:class="{ playlistIconActive: reversePlaylist }"
icon="exchange-alt"
:title="$t('Video.Reverse Playlist')"
@click="toggleReversePlaylist"
/>
<font-awesome-icon <font-awesome-icon
class="playlistIcon" class="playlistIcon"
icon="step-backward" icon="step-backward"
:title="$t('Video.Play Previous Video')"
@click="playPreviousVideo" @click="playPreviousVideo"
/> />
<font-awesome-icon <font-awesome-icon
class="playlistIcon" class="playlistIcon"
icon="step-forward" icon="step-forward"
:title="$t('Video.Play Next Video')"
@click="playNextVideo" @click="playNextVideo"
/> />
</p> </p>

View File

@ -16,7 +16,7 @@ export default Vue.extend({
type: Array, type: Array,
required: true required: true
}, },
watchingPlaylist: { showAutoplay: {
type: Boolean, type: Boolean,
default: false default: false
} }

View File

@ -4,7 +4,7 @@
{{ $t("Up Next") }} {{ $t("Up Next") }}
</h3> </h3>
<ft-toggle-switch <ft-toggle-switch
v-if="!watchingPlaylist" v-if="showAutoplay"
class="autoPlayToggle" class="autoPlayToggle"
:label="$t('Video.Autoplay')" :label="$t('Video.Autoplay')"
:compact="true" :compact="true"

View File

@ -23,7 +23,7 @@ Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(VueI18n) Vue.use(VueI18n)
// List of locales approved for use // List of locales approved for use
const activeLocales = ['en-US', 'de-DE', 'es-MX', 'fi', 'fr-FR', 'ja', 'pt-BR', 'pt-PT', 'ru', 'vi', 'zh-CN', 'zh-TW'] const activeLocales = ['en-US', 'de-DE', 'es-MX', 'fi', 'fr-FR', 'ja', 'pt-BR', 'pt-PT', 'pl', 'ru', 'vi', 'zh-CN', 'zh-TW']
const messages = {} const messages = {}
const fileLocation = isDev ? 'static/locales/' : `${__dirname}/static/locales/` const fileLocation = isDev ? 'static/locales/' : `${__dirname}/static/locales/`

View File

@ -258,17 +258,25 @@ export default Vue.extend({
const feedUrl = `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}` const feedUrl = `https://www.youtube.com/feeds/videos.xml?channel_id=${channelId}`
parser.parseURL(feedUrl).then(async (feed) => { parser.parseURL(feedUrl).then(async (feed) => {
resolve(await Promise.all(feed.items.map((video) => { const items = await Promise.all(feed.items.map((video) => {
video.authorId = channelId video.authorId = channelId
video.videoId = video.id.replace('yt:video:', '') video.videoId = video.id.replace('yt:video:', '')
video.type = 'video' video.type = 'video'
video.publishedDate = new Date(video.pubDate)
video.publishedText = video.publishedDate.toLocaleString()
video.lengthSeconds = '0:00' video.lengthSeconds = '0:00'
video.isRSS = true video.isRSS = true
video.publishedDate = new Date(video.pubDate)
if (video.publishedDate.toString() === 'Invalid Date') {
video.publishedDate = new Date(video.isoDate)
}
video.publishedText = video.publishedDate.toLocaleString()
return video return video
}))) }))
resolve(items)
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
const errorMessage = this.$t('Local API Error (Click to copy)') const errorMessage = this.$t('Local API Error (Click to copy)')

View File

@ -303,8 +303,10 @@ export default Vue.extend({
this.activeSourceList = this.videoSourceList this.activeSourceList = this.videoSourceList
} }
const templateUrl = result.player_response.storyboards.playerStoryboardSpecRenderer.spec if (typeof result.player_response.storyboards !== 'undefined') {
this.createLocalStoryboardUrls(templateUrl) const templateUrl = result.player_response.storyboards.playerStoryboardSpecRenderer.spec
this.createLocalStoryboardUrls(templateUrl)
}
} }
this.isLoading = false this.isLoading = false

View File

@ -80,7 +80,7 @@
/> />
<watch-video-recommendations <watch-video-recommendations
v-if="!isLoading" v-if="!isLoading"
:watching-playlist="watchingPlaylist" :show-autoplay="!watchingPlaylist"
:data="recommendedVideos" :data="recommendedVideos"
class="watchVideoSideBar watchVideoRecommendations" class="watchVideoSideBar watchVideoRecommendations"
:class="{ :class="{

View File

@ -271,6 +271,7 @@ About:
Latest FreeTube News: Latest FreeTube News Latest FreeTube News: Latest FreeTube News
Profile: Profile:
Profile Select: Profile Select
All Channels: All Channels All Channels: All Channels
Profile Manager: Profile Manager Profile Manager: Profile Manager
Create New Profile: Create New Profile Create New Profile: Create New Profile
@ -335,6 +336,11 @@ Video:
Copy Invidious Link: Copy Invidious Link Copy Invidious Link: Copy Invidious Link
View: View View: View
Views: Views Views: Views
Loop Playlist: Loop Playlist
Shuffle Playlist: Shuffle Playlist
Reverse Playlist: Reverse Playlist
Play Next Video: Play Next Video
Play Previous Video: Play Previous Video
# Context is "X People Watching" # Context is "X People Watching"
Watching: Watching Watching: Watching
Watched: Watched Watched: Watched
@ -454,6 +460,7 @@ Loop is now disabled: Loop is now disabled
Loop is now enabled: Loop is now enabled Loop is now enabled: Loop is now enabled
Shuffle is now disabled: Shuffle is now disabled Shuffle is now disabled: Shuffle is now disabled
Shuffle is now enabled: Shuffle is now enabled Shuffle is now enabled: Shuffle is now enabled
The playlist has been reversed: The playlist has been reversed
Playing Next Video: Playing Next Video Playing Next Video: Playing Next Video
Playing Previous Video: Playing Previous Video Playing Previous Video: Playing Previous Video
Playing next video in 5 seconds. Click to cancel: Playing next video in 5 seconds. Click Playing next video in 5 seconds. Click to cancel: Playing next video in 5 seconds. Click