TagLib::FileRef() could not open file!

Mathias Panzenböck grosser.meister.morti at gmx.net
Sat Jul 9 01:57:27 CEST 2011


TagLib uses iostreams, so it can't handle file URIs with a file:// prefix. You have to pass a plain 
file name: 
"/home/phongcao/Music/Umbrella___Rihanna_ft._._Jay_Z___T%E1%BA%A3i__lyrics__nh%E1%BA%A1c_ch%E1%BB%9D_b%C3%A0i_h%C3%A1t_1f0aa2470844ab6afb3d45c284e6aff7.mp3"

	-panzi

On 07/09/2011 01:46 AM, Phong Cao wrote:
> Hello everybody,
>
> I am trying to write a program that read tag from a media file and store it in a database. This is
> what I tried: I got the file's URI and then passed the URI as argument to TagLib::FileRef():
>
> TagLib::FileRef file(uri.c_str());
>
>
> However, I could not get TagLib to open my file. Here is the error:
>
> phongcao at phongcao-laptop ~ $ /home/phongcao/main
> TagLib: Could not open file
> file:///home/phongcao/Music/Umbrella___Rihanna_ft._._Jay_Z___T%E1%BA%A3i__lyrics__nh%E1%BA%A1c_ch%E1%BB%9D_b%C3%A0i_h%C3%A1t_1f0aa2470844ab6afb3d45c284e6aff7.mp3
>
>
> I have read the TagLib example and the TagLib::FileRef() usage in the example is something like this:
>
> int main(int argc, char *argv[]) {
>    for (int i = 1; i < argc; i++) {
>      TagLib::FileRef f(argv[i]);
>    }
>
>    /* extract tags here */
>
> return 0;
> }
>
> So my question here is what I need to pass to TagLib::FileRef()? An URI or FileName? According to
> the example code in the TagLib homepage it seems that I just need to pass the file's URI. However,
> the online documentation does not say so. I am kind of confused here.
>
> If you guys can figure out the error please let me know! Thank you and have a good weekend!
>
>
> Best regards,
>
>
> --
> Phong V. Cao
> phngcv at gmail.com <mailto:phngcv at gmail.com>
> caoph at rider.edu <mailto:caoph at rider.edu>
>
>
>
>
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel



More information about the taglib-devel mailing list