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

Output Filename Prefix and/or Suffix #144

Open
rzcat opened this issue May 20, 2018 · 5 comments
Open

Output Filename Prefix and/or Suffix #144

rzcat opened this issue May 20, 2018 · 5 comments

Comments

@rzcat
Copy link

rzcat commented May 20, 2018

Hi, thanks for the amazing project.
I use annie to batch download videos from Bilibili mainly. The default output name would be the title of that video page. Like:

annie url1
annie url2
annie url3

gets you

title1.mp4
title2.mp4
title3.mp4

However, if two videos have a same title, there would be a conflict. I know we can specify a name manually, but that input string does not contain the original title. I hope annie would implement a feature that would add a Prefix and/or Suffix to the output filename, like(prefix):

av13600078_title1.mp4
av13617148_title2.mp4

or suffix just as youtube-dl does, which has an awesome naming template feature allowing you to put uploader's id and upload date into the filename.
youtube-dl url1 -o "%%(title)s_[%%(id)s_%%(uploader)s_%%(upload_date)s].%%(ext)s"
Besides, is there an option to download the danmaku of the video? I saw cid was kind of fetched but was never used later?

@iawia002
Copy link
Owner

https://github.com/iawia002/annie#specify-the-output-path-and-name

Can this option solve your problem?

Besides, is there an option to download the danmaku of the video? I saw cid was kind of fetched but was never used later?

yep, not yet supported

@rzcat
Copy link
Author

rzcat commented May 20, 2018

@iawia002
No, adding "-O filename" means renaming the output file into filename, which is a static string🧐

@rzcat
Copy link
Author

rzcat commented May 25, 2018

@iawia002
for now I have a workaround, the following example code can run under windows as Windows Batch File:

@echo off
set annie="D:\annie.exe"
set outputdir=D:\annie_download
set outputdirtemp=D:\annie_download\temp
rem ---
call :bilibili av13600078 "%outputdirtemp%"
rem ---
goto eof
:bilibili
%annie% -o "%outputdirtemp%" -p https://www.bilibili.com/video/%1/
for /f "delims=" %%f in ('dir/b/s/a-d %outputdirtemp%\*.*') do ren "%%f" "%1_%%~nxf"
move "%outputdirtemp%\*.*" "%outputdir%"
:eof

to download multiple files, just add more lines starting with call.
this solves my problem temporarily(No danmaku still)🧐you can put this feature request behind, sorry for any inconvenience caused

@iawia002
Copy link
Owner

Glad you find a temporary solution.

Add the prefix and suffix is a little tricky after #146, I'll handle it as soon as I'm free (danmaku also had to wait, I will raise a new issue about this).

@mo-han
Copy link

mo-han commented Mar 25, 2020

why not just implement a formatting-string template just like what youtube-dl is doing?
with youtube-dl, i can just specify all the output filename as a format of %%(title)s [%%(id)s][%%(uploader)s].%%(ext)s, the keys inside which would be scrapped from the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants