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

[Feature] Playlist: Sort videos by published date #6280

Conversation

GLEBR1K
Copy link
Contributor

@GLEBR1K GLEBR1K commented Dec 5, 2024

Playlist: Sort videos by published date

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

closes #6223

Description

Add new video order options in user playlists:

  • Earliest published date
  • Latest published date

Screenshots

Testing

The following scenarios tested:

  • List view (Subscriptions/Trending/Most Popular/History/Channel):
    • Add a video using the plus icon
    • Add a video using the quick bookmark
  • Video player view:
    • Add a video using the plus icon
    • Add a video using the quick bookmark
  • Playlist import/export

Side effects:

  • Already playlisted videos (have been stored w/o published date) remain w/o published date. During sorting, such videos treated as the earliest (published = 0).
  • Importing a playlist exported earlier, add videos w/o published date as well.

Desktop

  • OS: Windows
  • OS Version: 11
  • FreeTube version: a7f738a

Additional context

N/A

@GLEBR1K GLEBR1K marked this pull request as ready for review December 5, 2024 15:18
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 5, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 5, 2024 15:18
@efb4f5ff-1298-471a-8973-3d47447115dc
Copy link
Member

efb4f5ff-1298-471a-8973-3d47447115dc commented Dec 5, 2024

Upcoming videos timestamps are listed in seconds. Could that be changed to be more readable? Like changing it to minutes or hours?

image

auto-merge was automatically disabled December 6, 2024 06:44

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 6, 2024 06:45
@GLEBR1K
Copy link
Contributor Author

GLEBR1K commented Dec 6, 2024

Upcoming videos timestamps are listed in seconds. Could that be changed to be more readable? Like changing it to minutes or hours?

image

@efb4f5ff-1298-471a-8973-3d47447115dc

Yes, minutes or hours are fine. However, I checked the existing list view in terms of formatting, and it turned that upcoming events formatted as date and time. I did the same:

@efb4f5ff-1298-471a-8973-3d47447115dc

This is probably out of scope of this PR but im going to mention it anyway. This was an upcoming video but i fetched it through my subscription page using RSS (see #3356 for more info on that) therefore it saved an incorrect publish date. The video is live now so i tried going to the video in the hope that the publish date would get updated in the playlist but it didnt.

VirtualBoxVM_OSIA7fnKU9.mp4

@GLEBR1K
Copy link
Contributor Author

GLEBR1K commented Dec 6, 2024

This is probably out of scope of this PR but im going to mention it anyway. This was an upcoming video but i fetched it through my subscription page using RSS (see #3356 for more info on that) therefore it saved an incorrect publish date. The video is live now so i tried going to the video in the hope that the publish date would get updated in the playlist but it didnt.

@efb4f5ff-1298-471a-8973-3d47447115dc

Yeah, this is a little out of scope of a simple sorting options. With regular videos (which is most cases I believe) dates work fine though...

@efb4f5ff-1298-471a-8973-3d47447115dc

Everything lgtm, i sign off when @absidue does

@GLEBR1K
Copy link
Contributor Author

GLEBR1K commented Dec 6, 2024

A few observations on the dates issue...

There is a sort of mix of the "premiere" and "published" date definition in the list view (see ft-list-video.js:710-721). "publish" can become "premiere" in certain cases.

One more limitation is that when you playlist a video AFAIK it actually stores it's metadata as of current moment (see ft-list-video.js:820-832), so it won't update over the time, unlike in RSS feed when each time you receive fresh metadata.

@absidue
Copy link
Member

absidue commented Dec 6, 2024

I haven't reviewed this fully but I've noticed that instead of using the existing premiereDate or premiereTimestamp fields, this pull request does its own thing, could you please use one of the existing two properties instead.

@absidue
Copy link
Member

absidue commented Dec 6, 2024

@efb4f5ff-1298-471a-8973-3d47447115dc That is expected we never update data in the playlists after they have been added, you are thinking of the watch history.

auto-merge was automatically disabled December 6, 2024 20:21

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 6, 2024 20:21
@GLEBR1K
Copy link
Contributor Author

GLEBR1K commented Dec 6, 2024

I haven't reviewed this fully but I've noticed that instead of using the existing premiereDate or premiereTimestamp fields, this pull request does its own thing, could you please use one of the existing two properties instead.

@absidue

Alright, I've simplified code a little by reusing the existing premiereDate (premiereTimestamp as a fallback) logic.

@absidue
Copy link
Member

absidue commented Dec 7, 2024

Non-blocking: I just want to point out that if we ever add support for importing the playlists from Google Takeout exports, the method we would be using to get the information would not provide the published dates (wouldn't have been a problem before this pull request as FreeTube didn't save them itself).

Copy link
Collaborator

@kommunarr kommunarr left a comment

Choose a reason for hiding this comment

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

Thanks for the great work on this!

concern/chore: This PR is correctly staying consistent with how we've done it in 1 or 2 other cases, but the sorting logic for when the datum isn't present for a video is debatable. If you prefer to sort by oldest, the videos missing the necessary field pollute the top presented videos.

The top alternative in my mind would be to sort the videos with the missing field at the bottom of both sort orders, thus keeping both tops clean. The main problem with that, though, is that it makes the discoverability of those missing-datum videos very poor. This isn't relevant for anything needed to be done in this PR, though, just thinking out loud.

@FreeTubeBot FreeTubeBot merged commit d180612 into FreeTubeApp:development Dec 29, 2024
6 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 29, 2024
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Dec 30, 2024
* development: (75 commits)
  Bump lefthook from 1.10.0 to 1.10.1 (FreeTubeApp#6480)
  Bump bgutils-js from 3.1.0 to 3.1.1 (FreeTubeApp#6482)
  Translated using Weblate (Estonian)
  Translated using Weblate (Serbian)
  Translated using Weblate (Polish)
  Translated using Weblate (Czech)
  Translated using Weblate (English (United Kingdom))
  Translated using Weblate (Hungarian)
  Translated using Weblate (Hungarian)
  Translated using Weblate (German)
  Translated using Weblate (Italian)
  Translated using Weblate (French)
  Translated using Weblate (Chinese (Simplified Han script))
  FtRadioButton and FtCheckboxList v-model and composition API (FreeTubeApp#6463)
  Disable store strict mode, due to performance problems because of the amount of data in the store (FreeTubeApp#6469)
  [Feature] Playlist: Sort videos by published date (FreeTubeApp#6280)
  Migrate ChannelAbout to the composition API (FreeTubeApp#6470)
  Translated using Weblate (German)
  compress frappe svgs (FreeTubeApp#6467)
  Translated using Weblate (Hungarian)
  ...
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]: Ability to reorder videos in playlist by date uploaded.
6 participants