! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
File type determination is not flexible enough
Status:
RESOLVED: MOVED
Severity:
enhancement
Product:
Thunar-media-tags-plugin
Component:
General

Comments

Description Moritz Heiber editbugs 2006-12-01 01:12:05 CET
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: 

As discussed on the IRC the underlying taglib library guesses the filetype on the input based on the extension if not provided with a filetype to test for.
This process needs more flexibility added to it, possibly by using thunar-vfs in the first place to determine a filetype and only use taglib's own (kind of flawed) detection as the only way out.

Reproducible: Always

Steps to Reproduce:
1. Rename a media file to use a different extension than it usually should have
2. Try to use the media-tags-plugin's provided functionality
Actual Results:  
Due to taglib not properly recognizing the media file regardless of its extension thunar does not provide the necessary interface to use the media-tags-plugin due to the media-tags-plugin telling it that the file taglib just inspected is unsupported. 

Expected Results:  
The media-tags-plugin should provide a proper file type recognition (probably won't happen without either submitting a patch to the taglib developers or supplying a function on our own).

IRC transcript:

2006 Dec 01 00:40:56  <Moe> JPohlmann: btw .. does your plugin identify a filetype by its extension?
2006 Dec 01 00:43:13  <JPohlmann> Moe: No. It identifies it by checking if it is supported by TagLib.
2006 Dec 01 00:43:28  <Moe> hm
2006 Dec 01 00:43:32  <Moe> The thing is
2006 Dec 01 00:43:33  <JPohlmann> There is a function creating a TagLibFile (or something like that). It returns NULL if the file is unsupported.
2006 Dec 01 00:44:26  <Moe> When I rename an mp3 to like .. mp3.1 .. its idenfied correctly by thunar (as an mp3) yet, in the properties dialog the audio tab is missing (supposedly provided by your plugin)
2006 Dec 01 00:44:29  <Moe> So I'm wondering
2006 Dec 01 00:44:41  <Moe> Try it yourself
2006 Dec 01 00:46:03  <JPohlmann> Hmm, let me see. Maybe TagLib checks the file extensions.
2006 Dec 01 00:48:56  <JPohlmann> Moe: You're right. I think it's TagLib's fault.
[...]
2006 Dec 01 00:49:09  <JPohlmann> So I can't do anything about it.
2006 Dec 01 00:49:19  <Moe> If so you might want to rely thunar's file recognition BEFORE tablib's
2006 Dec 01 00:49:56  <psyBSD> thunar-vfs's?
2006 Dec 01 00:50:00  <Moe> nod
2006 Dec 01 00:50:18  <JPohlmann> Moe: No, that wouldn't work.
2006 Dec 01 00:50:25  <JPohlmann> See, what I do is this:
2006 Dec 01 00:50:40  <JPohlmann> 1. Thunar asks my plugin whether a file is supported by the renamer or properties page
2006 Dec 01 00:50:41  <Moe> (Sorry, I didn't take a look at the code myself .. shooting in the dark here)
2006 Dec 01 00:51:17  <JPohlmann> 2. I try to create a TagLib_File (that's the name of the struct) by calling taglib_file_new(filename)
2006 Dec 01 00:51:32  <Moe> hm
2006 Dec 01 00:51:42  <Moe> And that either fails or succeeds
2006 Dec 01 00:51:57  <JPohlmann> 3. I check if the returned TagLib_File is NULL. If it is, TagLib will fail to operate on the file, so I tell Thunar that the file not supported.
2006 Dec 01 00:52:34  <Moe> There's no function in taglib for file support checking?
2006 Dec 01 00:52:57  <JPohlmann> Moe: Ever wrote programs in C? Most times, a returned NULL means that something is not supported.
2006 Dec 01 00:53:07  <Moe> Of course I did
2006 Dec 01 00:53:15  <Moe> Just thought there might be another way out
2006 Dec 01 00:53:17  <JPohlmann> In C++/Java, the constructor would raise something like a FileNotSupportedError, hehe.
2006 Dec 01 00:53:20  <JPohlmann> No, not really.
2006 Dec 01 00:53:30  <Moe> Another function yanno
2006 Dec 01 00:53:48  <Moe> btw, I hate C++/Java .. I'm a die hard C fan
2006 Dec 01 00:54:15  <Moe> And as I said .. just shooting in the dark
[...]
2006 Dec 01 00:55:09  <JPohlmann> Moe: Take a look at /usr/include/taglib/tag_c.h, lines 81-88.
[...]
2006 Dec 01 00:55:50  <JPohlmann>  * Creates a TagLib file based on \a filename.  TagLib will try to guess the file
2006 Dec 01 00:55:50  <JPohlmann>  * type.
2006 Dec 01 00:55:50  <JPohlmann>  * 
2006 Dec 01 00:55:50  <JPohlmann>  * \returns NULL if the file type cannot be determined or the file cannot
2006 Dec 01 00:55:51  <JPohlmann>  * be opened.
2006 Dec 01 00:55:52  <JPohlmann>  */
2006 Dec 01 00:56:26  <JPohlmann> Moe: Oh, but were somewhat right.
2006 Dec 01 00:56:26  <Moe> And it only guesses based on the filetype extension?
2006 Dec 01 00:56:29  <JPohlmann> There is another function.
2006 Dec 01 00:56:34  <JPohlmann> TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type);
2006 Dec 01 00:56:37  <Moe> :D
2006 Dec 01 00:56:41  <JPohlmann>  * Creates a TagLib file based on \a filename.  Rather than attempting to guess
2006 Dec 01 00:56:41  <JPohlmann>  * the type, it will use the one specified by \a type.
[...]
2006 Dec 01 00:56:57  <JPohlmann> Would you mind to file a bug report with this information later?
2006 Dec 01 00:57:02  <Moe> Not at all
2006 Dec 01 00:57:30  <JPohlmann> Shouldn't be too hard to check the MIME type of the file by querying ThunarVFS.
2006 Dec 01 00:57:40  <Moe> exactly
2006 Dec 01 00:57:53  <Moe> (s'what I thought of earlier)
2006 Dec 01 00:58:02  <JPohlmann> Hehe, sorry.
2006 Dec 01 00:58:08  <Moe> Nevermind
[...]
Comment 1 Benedikt Meurer editbugs 2006-12-21 22:24:23 CET
Plugins can access the MIME type guessed by thunar-vfs via the thunarx API already.
Comment 2 Git Bot editbugs 2020-05-20 21:14:55 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/thunar-plugins/thunar-media-tags-plugin/-/issues/1.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #2625

Reported by:
Moritz Heiber
Reported on: 2006-12-01
Last modified on: 2020-05-20

People

Assignee:
Jannis Pohlmann
CC List:
0 users

Version

Version:
unspecified

Attachments

Additional information