#20 [Playlists] Use name instead of display name to check if playlist exists on Peertube

Closed
opened 2 years ago by LecygneNoir · 5 comments
Owner

Hello,

A problem we actually have with Peertube is we used the playlist's display name to check if a playlist exists.

But the name for a playlist could only contains 20 characters, minuscule, no spaces and no special char, where the display name is totally free.

So, it's possible we get playlist with identical names BUT different display name, so prismedia will try to create a playlist with a name that already exists (thus getting an HTTP error 409)

To reproduce, create a playlist with name: thisatestplaylistwithcharacters

Then, create a new playlist with name: thisisatestplaylistwithoutcharacters

While the display name is different, the name would be thisatestplaylistwi for both, which create conflicts...

To fix, we could use name instead of display name to check if playlist exists :-)

Hello, A problem we actually have with Peertube is we used the playlist's display name to check if a playlist exists. But the name for a playlist could only contains 20 characters, minuscule, no spaces and no special char, where the display name is totally free. So, it's possible we get playlist with identical names BUT different display name, so prismedia will try to create a playlist with a name that already exists (thus getting an HTTP error 409) To reproduce, create a playlist with name: `thisatestplaylistwithcharacters` Then, create a new playlist with name: `thisisatestplaylistwithoutcharacters` While the display name is different, the name would be `thisatestplaylistwi` for both, which create conflicts... To fix, we could use name instead of display name to check if playlist exists :-)
LecygneNoir added the
bug
label 2 years ago
Zykino commented 2 years ago
Poster

Just so we are in the same page:
The problem is when creating a playlist with Prismedia there is a chance that the generated (short) name is already used. And this produce an error.

My opinion is that we are "forced" to use the display name if we want the user to upload on Youtube and Peertube in the same way :

  • Playlists can be renamed in the web interfaces.
  • Playlists can have space or special characters in the web interfaces.
  • Display names are more highlighted in the web interfaces.
  • Peertube legacy name are not compatibles with the new format: "name": "a917a881-5855-4d41-855d-2381a88cb95f"
  • Youtube does not allow the management of short name (as far as I know).

To me the problem is here because the --playlistCreate option is more a management option than an upload one. (And Prismedia is intended to upload videos, not manage a channel.) So it is ok to fail with a graceful error message.
Or add an optional parameter like: --playlistCreate[=shortname]. Bonus point if we can tell the user that the "shortname" will be used in the url and can not be modified.

Just so we are in the same page: The problem is when creating a playlist with Prismedia there is a chance that the generated (short) `name` is already used. And this produce an error. My opinion is that we are "forced" to use the display name if we want the user to upload on Youtube and Peertube in the same way : - Playlists can be renamed in the web interfaces. - Playlists can have space or special characters in the web interfaces. - Display names are more highlighted in the web interfaces. - Peertube legacy `name` are not compatibles with the new format: ` "name": "a917a881-5855-4d41-855d-2381a88cb95f"` - Youtube does not allow the management of short name (as far as I know). To me the problem is here because the `--playlistCreate` option is more a management option than an upload one. (And Prismedia is intended to upload videos, not manage a channel.) So it is ok to fail with a graceful error message. Or add an optional parameter like: `--playlistCreate[=shortname]`. Bonus point if we can tell the user that the "shortname" will be used in the url and can not be modified.
Poster
Owner

Mmmmh, I thought about using the display name as parameters, but compile the name for the search, as we need to compile the name anyway to create the playlist.

Interesting point that prismedia does'nt have to create playlist as it's not upload things.

For me it's more practical to avoid connecting to Youtube and Peertube to create the playlists. You just set it in prismedia, and prismedia takes care for you, but your point is good enough as you are totally right about people using the web interface! (I am a command line man, I regularly forgot that xD)

Indeed Peertube ask for the name of the playlist when creating it (at least, the 1.0 asks for me :thinking), but one could choose a name totally different from the Display name! In this case, we'll be unable to find the playlist with prismedia if we compile the name from the display name :/

I am not fan of adding an optional parameters, it's complex to explain and serve only in very special cases, with user perfectly knowing what they do, and if they do they can go to the web interface :)

So I tend to let the playlistCreate options here as it's easier for people (like me :p) that does'nt use web interface anymore, but we should

  • search for playlist with Display Name
  • if not found, we are reasonably sure the user has not created the playlist from web interface
  • so if not found, try to create the playlist (compiling name from display name)
  • if it failed, then probably a playlist with same name already exists. Either the user made a typo, or he has some playlist with same short name.
  • if it failed, we could display a graceful error, perhaps with the direct link to go to the web interface for manage playlists.

Is such a scenario correct?
Should we stop the upload if creating the playlist failed, or just display a message and continue without adding video to the playlist?

Mmmmh, I thought about using the display name as parameters, but compile the name for the search, as we need to compile the name anyway to create the playlist. Interesting point that prismedia does'nt have to create playlist as it's not upload things. For me it's more practical to avoid connecting to Youtube and Peertube to create the playlists. You just set it in prismedia, and prismedia takes care for you, but your point is good enough as you are totally right about people using the web interface! (I am a command line man, I regularly forgot that xD) Indeed Peertube ask for the name of the playlist when creating it (at least, the 1.0 asks for me :thinking), but one could choose a name totally different from the Display name! In this case, we'll be unable to find the playlist with prismedia if we compile the name from the display name :/ I am not fan of adding an optional parameters, it's complex to explain and serve only in very special cases, with user perfectly knowing what they do, and if they do they can go to the web interface :) So I tend to let the `playlistCreate` options here as it's easier for people (like me :p) that does'nt use web interface anymore, but we should - search for playlist with Display Name - if not found, we are reasonably sure the user has not created the playlist from web interface - so if not found, try to create the playlist (compiling name from display name) - if it failed, then probably a playlist with same name already exists. Either the user made a typo, or he has some playlist with same short name. - if it failed, we could display a graceful error, perhaps with the direct link to go to the web interface for manage playlists. Is such a scenario correct? Should we stop the upload if creating the playlist failed, or just display a message and continue without adding video to the playlist?
Zykino commented 2 years ago
Poster

It sounds good to me. (The 2 last point are together right? : If it fails there probably is an error and so we show an error.)

I like the idea to give the playlist URL to the user (we have it in "videoChannels": [{"url": "...",}]).

I don't really know if we should still upload to the default playlist. I think we should do the same as if the playlist did not exist and we did not use the --playlistCreate option.

It sounds good to me. (The 2 last point are together right? : If it fails there probably is an error and so we show an error.) I like the idea to give the playlist URL to the user (we have it in `"videoChannels": [{"url": "...",}]`). I don't really know if we should still upload to the default playlist. I think we should do the same as if the playlist did not exist and we did not use the `--playlistCreate` option.
Poster
Owner

I confirm last 2 points come together ^^

Failing and not uploading is ok for me, I'll work on the fix so :-)

Thanks for your help!

I confirm last 2 points come together ^^ Failing and not uploading is ok for me, I'll work on the fix so :-) Thanks for your help!
Poster
Owner

Fixed by 9426ca465c

Fixed by 9426ca465c750aa0c9abc386f7df63374f5e5e99
LecygneNoir closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.