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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

GLEBR1K
Copy link

@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
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
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
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
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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: waiting for review For PRs that are complete, tested, and ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Ability to reorder videos in playlist by date uploaded.
3 participants