-
Notifications
You must be signed in to change notification settings - Fork 842
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
Added functionality to export a single playlist #5779
Conversation
Co-authored-by: PikachuEXE <git@pikachuexe.net>
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
@@ -412,6 +415,41 @@ export default defineComponent({ | |||
showToast(this.playlistDeletionDisabledLabel) | |||
}, | |||
|
|||
handlePlaylistExport: async function () { | |||
const dateStr = getTodayDateStrLocalTimezone() | |||
const title = this.selectedUserPlaylist.playlistName.replaceAll(' ', '_').replaceAll(/["%*/:<>?\\|]/g, '_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need to replace more chars
See
https://www.mtu.edu/umc/services/websites/writing/characters-avoid/
I use Special !@#$%^&*()-_=+[]{};:'".>/?\| List
as test name and I got freetube-playlist-Special_!@#$_^&_()-_=+[]{};_'_.______List-2024-10-07
on MacOS
Need a windows guy to test the result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PikachuEXE I thought that the characters I listed in the Regexp would be those that are absolutely illegal for use in certain OS’s. The guide you linked calls some absolutely common, usual and legal characters "illegal" and "forbidden". So, just to confirm, this is more about conventions, right?
Thanks for having a look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On windows I have freetube-playlist-Special_!@#$_^&_()-_=+[]{};_'_.______List-2024-10-07.db
, same as MacOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume Linux is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Dont show the export button when playlist has no videos in it.
- Move the export button to right of the green copy playlists button so that all the green and red buttons are grouped correctly
- Discussion topic: Maybe this closes the issue. I know we dont have a "Import one Playlist button" but now we provide a way to export one playlist. So doesnt that automatically mean that the user can also import one playlist?
I think so |
I also see export button on online playlist (which does nothing) |
* development: (225 commits) Invidious API: Add support for auto-dubbed audio tracks (FreeTubeApp#5943) Fix settings password handling (FreeTubeApp#5988) Translated using Weblate (Serbian) Translated using Weblate (Breton) Translated using Weblate (Toki Pona) Translated using Weblate (Breton) Translated using Weblate (Toki Pona) Translated using Weblate (Icelandic) Bump youtubei.js from 10.5.0 to 11.0.0 (FreeTubeApp#5996) Bump shaka-player from 4.11.10 to 4.11.11 (FreeTubeApp#5995) Bump eslint-plugin-vue from 9.29.1 to 9.30.0 in the eslint group (FreeTubeApp#5994) Translated using Weblate (Latvian) Translated using Weblate (Toki Pona) Translated using Weblate (Icelandic) Translated using Weblate (Hungarian) Translated using Weblate (Toki Pona) Translated using Weblate (Icelandic) Translated using Weblate (Hungarian) Migrate FtListChannel and FtListHashtag to the composition API (FreeTubeApp#5945) Fix issue FreeTubeApp#5969 (FreeTubeApp#5970) ...
…ove it before "remove duplicate" button
@@ -275,7 +285,6 @@ export default defineComponent({ | |||
// Only online playlists can be shared | |||
if (this.isUserPlaylist) { return false } | |||
|
|||
// Cannot delete protected playlist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed?
@ChunkyProgrammer Though I can approve it but if you have time I rather have you take a look :) |
@@ -412,6 +421,41 @@ export default defineComponent({ | |||
showToast(this.playlistDeletionDisabledLabel) | |||
}, | |||
|
|||
handlePlaylistExport: async function () { | |||
const dateStr = getTodayDateStrLocalTimezone() | |||
const title = this.selectedUserPlaylist.playlistName.replaceAll(' ', '_').replaceAll(/["%*/:<>?\\|]/g, '_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: Maybe we should merge the logic here with the logic for replacing the names of files created for screenshots?
FreeTube/src/renderer/helpers/utils.js
Line 565 in 94fe62a
export function replaceFilenameForbiddenChars(filenameOriginal) { |
* development: (153 commits) Migrate FtTimestampCatcher to the composition API (FreeTubeApp#6064) Translated using Weblate (Polish) Added functionality to export a single playlist (FreeTubeApp#5779) Fix video player displaying a vertical scrollbar when context menu outside player container (FreeTubeApp#6075) Fix use of deprecated Invidious route on the videos subscription tab (FreeTubeApp#6057) Apply active FreeTube theme to shaka-player menus (FreeTubeApp#5986) Bump sass from 1.80.4 to 1.80.6 (FreeTubeApp#6071) Bump mini-css-extract-plugin from 2.9.1 to 2.9.2 (FreeTubeApp#6068) Translated using Weblate (Vietnamese) Bump webpack from 5.95.0 to 5.96.1 (FreeTubeApp#6069) Translated using Weblate (Vietnamese) Bump sass-loader from 16.0.2 to 16.0.3 (FreeTubeApp#6070) Bump lefthook from 1.8.1 to 1.8.2 (FreeTubeApp#6067) Bump the eslint group with 2 updates (FreeTubeApp#6066) Bump youtubei.js from 11.0.0 to 11.0.1 (FreeTubeApp#6072) Migrate PasswordSettings and PasswordDialog to the composition API (FreeTubeApp#6036) Add some missing jsdoc comments, add jsdoc eslint plugin (FreeTubeApp#6048) Fix shortcut for macOS setting shortcut in video page (FreeTubeApp#6054) Use decodingInfo's powerEfficient property when picking streams (FreeTubeApp#6061) Translated using Weblate (Afrikaans) ...
Single Playlist Export
Pull Request Type
Related issue
closes #5366
Description
This PR adds a button "Export Playlist" to the playlist-info component, that when clicked exports a single playlist with the file name "freetube-playlist-{playlistName}-{date}.db".
Screenshots
After:
Testing
I have tested this and found no problems. However, the UX is not perfect because this is only exporting. Importing currently requires going to data settings and there is no "Do you wish to overwrite the playlist" or "... add the videos to the local playlist" with the same name.
Desktop
Additional context
One could further abstract the way files are saved to disk. I have copied it from data-settings.js.
I have reused the locale token
Settings.Data Settings.Unable to write file
.