simon-r / dr14_t.meter

Compute the DR14 of a given audio file according to the procedure described by the Pleasurize Music Foundation
http://dr14tmeter.sourceforge.net
GNU General Public License v3.0
125 stars 33 forks source link

Allow processing a provided list of files instead of a directory #5

Closed Hawke closed 9 years ago

Hawke commented 12 years ago

We’re looking into using this application with Musicbrainz as a plugin to Picard, and in order to process an entire release to calculate the release-level DR (“DR Album” or “Official DR value” in the log), we need it to accept a list of files instead of just a directory or a single file.

simon-r commented 12 years ago

What do you mine exactly for a "list of files"?

kepstin commented 12 years ago

Currently the application just takes a directory name, like

dr14_tmeter Artist/Album

In order to better integrate with Picard, which knows exactly which files correspond to an album, I would like dr14_tmeter to take parameters like

dr14_tmeter Artist/Album/01.mp3 Artist/Album/02.mp3 ...

and treat all the files passed together as a single album.

simon-r commented 12 years ago

There are two possibility. 1) using an external file with the list, for example in /tmp/music_list.txt and give a command like:

dr14_tmeter --file_list /tmp/music_list.txt

2) As described above send the file list via command line:

dr14_tmeter --file_list "Artist/Album/01.mp3 Artist/Album/02.mp3"

The problem with the second method is that parsing a string list like this is a bit difficult, normally the filenames ere strange with spaces strange characters ....

Don't exclude a situation like this:

dr14_tmeter --file_list "Artist/Album/01 - @ xyz.mp3 Artist/Album/02.mp3"

I prefer the first method. What do you think?

Hawke commented 12 years ago

The second method seems better to me. As far as I know, handling filenames with spaces and special characters is a Solved Problem.

simon-r commented 12 years ago

For me it's OK if you accept to send pre formatted files-names; like this ....

/media/xfs_hd/data/Music/Music_2/Led\ Zeppelin\ -\ Houses\ of\ the\ Holy/01\ -\ The\ Song\ Remains\ The\ Same.mp3

Or maybe we should try to detect the complete file-name via extensions (that's a simple regexp .. )

kepstin commented 12 years ago

I think it would be best if it could take each filename as a separate argument, so you could do

$ dr14_tmeter "/home/cwalton/Some Artist/Some Album/01 - The First Track.mp3" "/home/cwalton/Some Artist/Some Album/02 - The Second Track.mp3"

and so on. The program can check whether the type of the argument is a file or directory to decide which mode to use, or you could make it explicit by having a --file option that says you're giving multiple files.

simon-r commented 12 years ago

And another possibility ... Sending the file list via STDIN:

You start the process and the application read the stdin, and you send your file-list in the application stdin by using a string.

Something like this: http://stackoverflow.com/questions/163542/python-how-do-i-pass-a-string-into-subprocess-popen-using-the-stdin-argument

Hawke commented 12 years ago

yes, sending via STDIN should work fine too.

simon-r commented 12 years ago

In the current git version with the command:

dr14_tmeter --files_list

It wait for the stdin; for example:

dr14_tmeter --files_list < list.txt reads the file list stored in list.txt

or if you prefer via pipe:

cat list.txt | dr14_tmeter --files_list