-
Notifications
You must be signed in to change notification settings - Fork 179
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
Filenames with :
in them do something odd in MediaInfoList
#1359
Comments
Oops... |
I found this while looking for how to ask for info on lists of files. It might be nice to have a mode to ask for details on multiple files at once. That way if I have:
I will get the same results from |
IIRC In any case, AFAIK both commands work, what is the issue with them?
|
Sorry bad example, it turns out you need more then 24 frames in a sequence for it to be detected, so you need
Running it with bash expanding the * to a long list of files means that they are // In MediaInfoList
size_t Open (const std::vector<String> &Files, const fileoptions_t Options=FileOption_Nothing); |
Something like this maybe? #1360 |
I think I get it, if a directory the sequence is detected but if a list of files the sequence is not detected. There is definitely a lot to do for a more coherent interface. But I prefer to have the time to refactor all well instead of touching a part without being sure I improve the overall coherency. e.g. in your PR, there is a regression for people using the ":" feature. So it would be the addition of an option, unset by default, for accepting filenames with ":", with a warning (not implemented) saying that default will change in the future in case of ":" is used, then option is set by default at some point. In the ":" case, I think that a quick and less risky fix is to invert the Note that we do C++03 for the moment due to the support of very old versions of some platforms (hello macOS <= 10.8), we plan to trash that soon but for the moment no |
Currently running mediainfocli on the folder finds the sequence, running it on the first frame finds the sequence, but running it on the list of all the frames (provided on command line) finds the sequence many times (i.e 1-25, 2-25, 3-25, 4-25, etc).
What is the definition of the ":" feature? If it is a list of file names it is already broken, this doesnt work
I'm on it 😄 |
Maybe not with the CLI, but by calling the lib.
OK, this is bad, and good reason for changing the behavior. We have regression tests on our todo-list, when we have some free time for that... At long term it would help, but never easy to prioritize that over sponsored features. |
I haven't changed any functionality to do with the ':' at all. Here is that part of my diff with the whitespace removed ( diff --git a/Source/MediaInfo/MediaInfoList_Internal.cpp b/Source/MediaInfo/MediaInfoList_Internal.cpp
index 14dfd464..6db110a8 100644
--- a/Source/MediaInfo/MediaInfoList_Internal.cpp
+++ b/Source/MediaInfo/MediaInfoList_Internal.cpp
@@ -76,6 +76,14 @@ MediaInfoList_Internal::~MediaInfoList_Internal()
//---------------------------------------------------------------------------
size_t MediaInfoList_Internal::Open(const String &File_Name, const fileoptions_t Options)
+{
+ vector<String> File_Names;
+ File_Names.push_back(File_Name);
+ return Open(File_Names, Options);
+}
+
+//---------------------------------------------------------------------------
+size_t MediaInfoList_Internal::Open(const vector<String> &File_Names, const fileoptions_t Options)
{
//Option FileOption_Close
if (Options & FileOption_CloseAll)
@@ -86,6 +94,8 @@ size_t MediaInfoList_Internal::Open(const String &File_Name, const fileoptions_t
//Get all filenames
ZtringList List;
+ for (const auto& File_Name : File_Names)
+ {
size_t Pos=File_Name.find(__T(':'));
if (Pos!=string::npos && Pos!=1)
List.push_back(File_Name);
@@ -96,7 +106,8 @@ size_t MediaInfoList_Internal::Open(const String &File_Name, const fileoptions_t
#if defined(MEDIAINFO_DIRECTORY_YES)
else
{
- List=Dir::GetAllFileNames(File_Name, (Options&FileOption_NoRecursive)?Dir::Include_Files:((Dir::dirlist_t)(Dir::Include_Files|Dir::Parse_SubDirs)));
+ ZtringList LocalList=Dir::GetAllFileNames(File_Name, (Options&FileOption_NoRecursive)?Dir::Include_Files:((Dir::dirlist_t)(Dir::Include_Files|Dir::Parse_SubDirs)));
+ List.insert(List.end(), LocalList.begin(), LocalList.end());
sort(List.begin(), List.end());
if (List.empty())
List.push_back(File_Name); // Try directly the file name e.g. "-" for pipe
@@ -118,6 +129,7 @@ size_t MediaInfoList_Internal::Open(const String &File_Name, const fileoptions_t
#endif //MEDIAINFO_ADVANCED
}
#endif //defined(MEDIAINFO_DIRECTORY_YES)
+ }
#if defined(MEDIAINFO_DIRECTORY_YES)
Reader_Directory().Directory_Cleanup(List); |
On closer inspection maybe ':' is not meant for lists, maybe it is meant for detecting URLs? |
Ooops, too tired, right. |
I actually think that this bug is now fixed. My other PR is useful but fixes a different bug (sequences are reported multiple times if you do |
I'm not sure what this code is trying to do? Was there meant to be a mode where lots of filenames could be provided as a string which was ':' separated? ':'s can occur in filenames (on macOS at least).
:.png
will go through the top code path anda.png
will go through the other onehttps://github.com/MediaArea/MediaInfoLib/blob/master/Source/MediaInfo/MediaInfoList_Internal.cpp#L89
The text was updated successfully, but these errors were encountered: