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

custom filename templates #717

Closed
ascpixi opened this issue Sep 7, 2024 · 2 comments
Closed

custom filename templates #717

ascpixi opened this issue Sep 7, 2024 · 2 comments
Labels
feature request New feature or request

Comments

@ascpixi
Copy link

ascpixi commented Sep 7, 2024

describe the feature you'd like to see

A custom filename format feature would be useful for e.g. those that like to have a consistent naming scheme when archiving videos or audio. For example, if cobalt were to support an arbitrary JavaScript snippet, one could specify the following template:

`[${service.toUpperCase()}] ${name} (${id})`

...where the variables are defined as follows:

service = "YouTube"
name = "Rick Astley - Never Gonna Give You Up (Official Music Video)"
id = "dQw4w9WgXcQ"

...cobalt would download the file as [YOUTUBE] Rick Astley - Never Gonna Give You Up (Official Music Video) (dQw4w9WgXcQ).mp4. As audio and video files have different parameters, the user would be able to specify a different template for videos and audio.

As I have not contributed to cobalt, I'm not sure if eval would be a security risk (I don't know if the filename is determined client-side or server-side). If it is, a simple token replacement would also be great, e.g. [$service] $name ($id), where cobalt would simply do:

filenameTemplate
  .replaceAll("$service", serviceName)
  .replaceAll("$name", mediaName)
  .replaceAll("$id", mediaId);
@ascpixi ascpixi added the feature request New feature or request label Sep 7, 2024
@KwiatekMiki
Copy link
Contributor

#228

@ascpixi
Copy link
Author

ascpixi commented Sep 7, 2024

#228

Ah, I see, thanks. Closing as a duplicate.

@ascpixi ascpixi closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants