Skip to content
Merged
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
61 changes: 1 addition & 60 deletions src/renderer/components/DataSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,7 @@
/>
<FtButton
:label="$t('Settings.Data Settings.Export Playlists')"
@click="exportPlaylistsForOlderVersionsSometimes"
/>
</FtFlexBox>
<FtFlexBox>
<FtToggleSwitch
:label="$t('Settings.Data Settings.Export Playlists For Older FreeTube Versions.Label')"
:compact="true"
:default-value="shouldExportPlaylistForOlderVersions"
:tooltip="$t('Settings.Data Settings.Export Playlists For Older FreeTube Versions.Tooltip')"
:tooltip-allow-newlines="true"
@change="shouldExportPlaylistForOlderVersions = !shouldExportPlaylistForOlderVersions"
@click="exportPlaylists"
/>
</FtFlexBox>
<FtPrompt
Expand All @@ -81,7 +71,6 @@ import FtButton from './FtButton/FtButton.vue'
import FtFlexBox from './ft-flex-box/ft-flex-box.vue'
import FtPrompt from './FtPrompt/FtPrompt.vue'
import FtSettingsSection from './FtSettingsSection/FtSettingsSection.vue'
import FtToggleSwitch from './FtToggleSwitch/FtToggleSwitch.vue'

import store from '../store/index'

Expand Down Expand Up @@ -963,8 +952,6 @@ async function exportHistory() {

const allPlaylists = computed(() => store.getters.getAllPlaylists)

const shouldExportPlaylistForOlderVersions = ref(false)

async function importPlaylists() {
let response
try {
Expand Down Expand Up @@ -1168,51 +1155,5 @@ async function exportPlaylists() {
)
}

function exportPlaylistsForOlderVersionsSometimes() {
if (shouldExportPlaylistForOlderVersions.value) {
exportPlaylistsForOlderVersions()
} else {
exportPlaylists()
}
}

async function exportPlaylistsForOlderVersions() {
const dateStr = getTodayDateStrLocalTimezone()
const exportFileName = 'freetube-playlists-as-single-favorites-playlist-' + dateStr + '.db'

const favoritesPlaylistData = {
playlistName: 'Favorites',
protected: true,
videos: [],
}

allPlaylists.value.forEach((playlist) => {
playlist.videos.forEach((video) => {
const videoAlreadyAdded = favoritesPlaylistData.videos.some((v) => {
return v.videoId === video.videoId
})
if (videoAlreadyAdded) { return }

favoritesPlaylistData.videos.push(
Object.assign({
// The "required" keys during import (but actually unused) in older versions
isLive: false,
paid: false,
published: '',
}, video)
)
})
})

await promptAndWriteToFile(
exportFileName,
JSON.stringify([favoritesPlaylistData]),
t('Settings.Data Settings.Playlist File'),
'application/x-freetube-db',
'.db',
t('Settings.Data Settings.All playlists has been successfully exported')
)
}

// #endregion playlists
</script>
9 changes: 0 additions & 9 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,15 +599,6 @@ Settings:
Export History: Export History
Import Playlists: Import Playlists
Export Playlists: Export Playlists
Export Playlists For Older FreeTube Versions:
Label: Export Playlists For Older FreeTube Versions
# |- = Keep newlines, No newline at end
Tooltip: |-
This option exports videos from all playlists into one playlist named 'Favorites'.
How to export & import videos in playlists for an older version of FreeTube:
1. Export your playlists with this option enabled.
2. Delete all of your existing playlists using the Remove All Playlists option under Privacy Settings.
3. Launch the older version of FreeTube and import the exported playlists."
Profile object has insufficient data, skipping item: Profile object has insufficient
data, skipping item
All subscriptions and profiles have been successfully imported: All subscriptions
Expand Down