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

Save Library File #1880

Closed
sirinath opened this issue Dec 3, 2013 · 16 comments
Closed

Save Library File #1880

sirinath opened this issue Dec 3, 2013 · 16 comments

Comments

@sirinath
Copy link

@sirinath sirinath commented Dec 3, 2013

Is it possible to add library support which would be in a text format by default in the same directory. His will have download meta data. This can be used on operation on the library like renaming to another name and moving. If done through the command line this will be updated. Also ability to create sub library files based on different filter criteria.

@phihag
Copy link
Contributor

@phihag phihag commented Dec 3, 2013

Have you looked into the --write-info-json and --download-archive options? Both should work just fine. Instead of renaming the videos manually, have a look at the variety of filename options (-o).

I'm closing this issue now, but feel free to comment. Please make sure to check all the points in our issue reporting checklist, in particular the context part.

@phihag phihag closed this Dec 3, 2013
@sirinath
Copy link
Author

@sirinath sirinath commented Dec 3, 2013

It will be good if you can build a DB of all the files you have with where you downloaded if from, where it is stored, original name, download options used, when it was downloaded etc.

Also adding file related / library operation mean you can keep track of the files and your library.

Also this can be shared in which case another user can download the same using the same directory to a particular root.

This can be analogous to the library in a media player and can help house keeping and track of all downloads. If you do any changes using YDL then this will be recorded in the DB like a file rename or move.

Perhaps this can be in Org Mode format (orgmode.org)

@phihag
Copy link
Contributor

@phihag phihag commented Dec 3, 2013

I don't see any support for orgmode in common video players like vlc. In general, the filesystem is already the library, so there is no index file needed. However, if you have a specific index file format and use case (which at least one common video player like vlc or mplayer should support), please name it and we'll reopen this issue.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 3, 2013

Since YDL is command line best is that it can do a text based index also this it can consider native / default and ability to put this into any other format specified. This can have more info than just a library format. This can have downlaod information also.

Some formats to consider for playlists:
XSPF
M3U
ASX
PLS
VLC
WPL
PLS
SMIL
ZPL
PLA
FPL

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 3, 2013

Well the default / native format ideally should fulfil:

  1. Text based DB format
    1.1) Easy manual editing and adding info
  2. Should have download info to be shared or backed up to re download if needed
  3. Should have local download location

In addition:
4) YTDL should get a new set of commands for maintaining and working with this library
4.1) Renaming
4.2) Moving
4.3) Applying a different naming option (might even move the file)
4.4) Store, edit tag / meta data like author, description (perhaps scraped from the site), conference, etc
5) Save playlist to media player playlist format

@phihag
Copy link
Contributor

@phihag phihag commented Dec 3, 2013

I'm sorry, but such a large list of operations is definitely out of scope scope for youtube-dl. It is far easier to simply store everything right in the filesystem. In particular, I do not think it there is a sensible reason to want to rename files after downloading them. You are welcome to contribute code that does manage a central database and employs locking, like --download-archive already does, but multimedia library management operations are better off in another tool.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 4, 2013

See the other tool will not have the knowledge of which playlist, user, tag the videos where downloaded for. This will mean this will need manually create the play list.

In this case as a starting point can you default to -o '%(uploader)s/%(playlist)s/%(playlist_index)s-%(upload_date)s-%(title)s-%(id)s.%(ext)s' for play lists, and -o '%(uploader)s/%(upload_date)s-%(title)s-%(id)s.%(ext)s' for user level downloads, etc. (upload_date - in case the video gets updated it is easier to sort, and auto number should be 4 or 3 digits with leading 0s to be safe for proper sorting)

Having meaningful defaults like this would make YDL baby proof for 1st time users.

Next step would be if you have already a download downloaded with a particular -o option given the old -o option parameters and the new -o option parameters the ability to rename the downloads to the new format without re downloading what has been downloaded.

This would be simpler than above?

Also this will maintain the file system as the library but still help in by providing a URL list (perhaps if this can also be given from a file and saved to a file it would be great also providing the list from command line - not the same as archive as this will point to starting point given), the original -o option and root directory and new -o options and root directory. Also ability to figure the files from title and id if it is in the name in case there some manual renames of the original files.

@phihag
Copy link
Contributor

@phihag phihag commented Dec 4, 2013

Personally - and this seems to echo with most users - I don't care who uploaded a video. Even if I'm downloading a playlist, I don't want to create a myriad of subfolders. Therefore, we'll keep the default filename format as is. But these options and the configuration files exist for good reason, so that you can

The auto number is five digits long. That's a little bit more on the safe side than 4 or 3, and will stay. In your case, using %(playlist_index)s in the format will lead to shorter filenames.

I am not under the impression that many of our users are regularly changing there file naming formats. This is sounds like a better task for a small script. But as I said above, you are welcome to contribute code that implements a central database and limited re-moving options. It may also worthwile to investigate the use of alternate data streams on Windows to store filename, URL etc.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 4, 2013

In which can you add an option to just list out (without downloading - since this is to organise already downloaded files) the the file names generated by the -o option for a given URL / URL list to console or a file in a bare format. I can take it up from there.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 4, 2013

Basically a DIR /B like function on the given URL

@phihag
Copy link
Contributor

@phihag phihag commented Dec 4, 2013

Did you get my email? It includes a link to the list of all options (you can also call youtube-dl --help). You seem to be looking for the --get-filename option.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 4, 2013

Got the mail

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 4, 2013

What I have been thinking is if you use

-o "@ren c:\download%(title)s-%(id)s.%(ext)s c:\download%(playlist)s/%(playlist_index)s-%(upload_date)s-%(title)s-%(id)s.%(ext)s" --get-filename URL > mantain.cmd

this will replace %(*)s and print the output to console without downloading the file you can generate a script to do the maintenance you want.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 4, 2013

Is there a way to suppress character substitution in the -o option and also introduce non printable characters line new line perhaps by using [] to suppress character substitution (e.g. %[title]s will be the raw title)? Also the URL name like:

-o "#EXTINF:%(id)s, %[title]s %(newline) %(title)s-%(id)s.%(ext)s %(newline) %[url]s" --get-filename URL > playlist.m3u

This way I can generate my play lists as many formats are text based.

Any way if there is a possibility can you provide a option to differentiate the 1st last odd and even file name templates and the ability to print a separator between file names (before & after). (ideally different for the 1st last odd and even file names) May be a header and footer also. This will help writing out XML playlist formats. Similarly user can generate any other file format.

May be control over the %(id)s say %(id1) no leading 0, %(id2) 2 digit id etc.

Also if I can get the name of the local thumbnail file with the -o option I can write out a HTML output to console which can similarly saved to create the local HTML file.

If you want to take a step further you can add a separate option and the ability to sage a config file which will do these processing when downloading and sage the files. Also a list of post processing commands to system commands to run either from command line or from the saved script.

I would like to contribute but I do not know Python. Let me know if there is any interest in this perhaps rolling this hack? This would be very useful in script files.

@phihag
Copy link
Contributor

@phihag phihag commented Dec 5, 2013

I am not sure what you mean by character substitution. --get-filename will print filenames, nothing more. If you want to rename files in some way, write a script that does that.

If you want youtube-dl to save all downloaded videos in a playlist, just open an issue and make sure you have all the entries in the checklist checked, in particular Is there enough context?. In this case, you should describe the format and why you need a playlist file in the first place, and what you do with the playlist file.

Any internal scripting capabilities are out of scope for youtube-dl. Write a shell or Python script.

@sirinath
Copy link
Author

@sirinath sirinath commented Dec 5, 2013

You don't seem to understand what I have been saying. Let me try to reward it.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.