Skip to content
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

Merged
merged 7 commits into from
Nov 4, 2024

Conversation

Zeabyte
Copy link
Contributor

@Zeabyte Zeabyte commented Oct 1, 2024

Single Playlist Export

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

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:
image

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

  • OS: Fedora Workstation
  • OS Version: 40
  • FreeTube version: latest from development

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.

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Oct 1, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 1, 2024 16:35
Co-authored-by: PikachuEXE <git@pikachuexe.net>
auto-merge was automatically disabled October 2, 2024 07:30

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 2, 2024 07:31
auto-merge was automatically disabled October 2, 2024 07:33

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 2, 2024 07:33
auto-merge was automatically disabled October 2, 2024 07:36

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 2, 2024 07:36
auto-merge was automatically disabled October 2, 2024 07:39

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 2, 2024 07:39
@@ -412,6 +415,41 @@ export default defineComponent({
showToast(this.playlistDeletionDisabledLabel)
},

handlePlaylistExport: async function () {
const dateStr = getTodayDateStrLocalTimezone()
const title = this.selectedUserPlaylist.playlistName.replaceAll(' ', '_').replaceAll(/["%*/:<>?\\|]/g, '_')
Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have access to Windows machine so I can't test it
Here is a screenshot of forbidden char message
2024-10-07 18_55_11-重新命名

I will create a custom build to test on Windows machine later

Copy link
Collaborator

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

PikachuEXE
PikachuEXE previously approved these changes Oct 8, 2024
Copy link
Collaborator

@PikachuEXE PikachuEXE left a 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

@PikachuEXE
Copy link
Collaborator

Copy link
Member

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
    image
  • 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?

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Oct 12, 2024
@PikachuEXE
Copy link
Collaborator

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

@PikachuEXE
Copy link
Collaborator

I also see export button on online playlist (which does nothing)
Let me recheck later...

* 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)
  ...
@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Oct 30, 2024
@@ -275,7 +285,6 @@ export default defineComponent({
// Only online playlists can be shared
if (this.isUserPlaylist) { return false }

// Cannot delete protected playlist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this removed?

@PikachuEXE PikachuEXE requested review from absidue and ChunkyProgrammer and removed request for absidue and ChunkyProgrammer October 31, 2024 00:00
@PikachuEXE
Copy link
Collaborator

@ChunkyProgrammer Though I can approve it but if you have time I rather have you take a look :)
Or I will just (partially self-)approve tomorrow

@@ -412,6 +421,41 @@ export default defineComponent({
showToast(this.playlistDeletionDisabledLabel)
},

handlePlaylistExport: async function () {
const dateStr = getTodayDateStrLocalTimezone()
const title = this.selectedUserPlaylist.playlistName.replaceAll(' ', '_').replaceAll(/["%*/:<>?\\|]/g, '_')
Copy link
Member

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?

export function replaceFilenameForbiddenChars(filenameOriginal) {

@FreeTubeBot FreeTubeBot merged commit d3b6563 into FreeTubeApp:development Nov 4, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 4, 2024
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 4, 2024
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Importing/Exporting only 1 playlist.
6 participants