Page 2 of 2

Re: TagLib

Posted: Wed Nov 18, 2009 4:43 am
by lexvictory
I managed to get 1.6 compiled for x86 and x64
http://demonioardente.us.to/pb/taglib1.6_msvc_bin.zip

you'll probably need to change the import lines. this compilation has tag_c lib files (as pb uses the C binding).

Re:

Posted: Sun Jul 29, 2012 8:09 pm
by ricardo
Rings wrote:i would also use that stuff under windows, but
some polink errors occurs.
maybe i did only use wrong names.
I just download the binarys from the website and did:

Code: Select all

CompilerSelect #PB_Compiler_OS
 CompilerCase #PB_Compiler_OS = #PB_OS_Linux
  ImportC "/usr/lib/libtag_c.so"
 CompilerCase #PB_OS_Windows
  ImportC #PB_Compiler_Home + "\PureLibraries\Windows\Libraries\tag_c.lib"
  ImportC #PB_Compiler_Home + "\PureLibraries\Windows\Libraries\tag.lib"
 CompilerEndSelect
any help would be fine Inner, to make this piece of code
cross-compatible ;)

Where can we get the needed .lib files?

Founded at: https://github.com/alho/PB-MP3-Dupe-Finder/downloads

One question how to get APE tags?

Re: TagLib

Posted: Tue Jul 31, 2012 11:37 am
by lexvictory
http://thiakil.com/public/pb/taglib1.6_msvc_bin.zip

thats the zip i posted for TagLib 1.6

Re: TagLib

Posted: Mon Aug 06, 2012 1:43 am
by ricardo
How to get id3v2 apic?

Re: TagLib

Posted: Sat Jun 15, 2013 2:38 pm
by erion
Hi all,

I needed this for a project, so I have compiled v1.8 (x86 only), and have updated Inner's wrapper for the C bindings. Sadly it's MSVC 10, so it depends on a few dlls, but it works nicely.

I have also included Inner's ported reader example.

http://erion.tdrealms.com/taglib

Cheers,
Erion

Re: TagLib

Posted: Thu Mar 27, 2014 6:20 pm
by Sebert
Hi there,

first of all I am a newbie to Purebasic, so forgive me If I've made a rookie mistake here.

I tried the example_reader code with a mp3 file:

Code: Select all

XIncludeFile "tag_c.pbi"

file=taglib_file_new("Sarajevo 2014.mp3")
If file
 Debug "Open"
 tag = taglib_file_tag(file);
  properties = taglib_file_audioproperties(file)
OpenConsole()
 PrintN("-- TAG --");
 PrintN("title - \"+PeekS(taglib_tag_title(tag)))
 PrintN("artist - \"+PeekS(taglib_tag_artist(tag)))
 PrintN("album - \"+PeekS(taglib_tag_album(tag))) 
 PrintN("year  - \"+Str(taglib_tag_year(tag)))
 PrintN("comment - \"+PeekS(taglib_tag_comment(tag)))
 PrintN("track - \"+Str(taglib_tag_track(tag)));
 PrintN("genre - \"+PeekS(taglib_tag_genre(tag)));

 seconds = taglib_audioproperties_length(properties) % 60
 minutes = (taglib_audioproperties_length(properties) - seconds) / 60

 PrintN("-- AUDIO --");
 PrintN("bitrate  - "+Str(taglib_audioproperties_bitrate(properties)))
 PrintN("sample rate - "+Str(taglib_audioproperties_samplerate(properties)))
 PrintN("channels  - "+Str(taglib_audioproperties_channels(properties)))
 PrintN("length   - "+Str(minutes)+":"+Str(seconds));

 taglib_tag_free_strings()

 taglib_file_free(file)
Else
PrintN("Unable to open file.")
EndIf
Input()
CloseConsole()
a) I got the console output. It showed the correct values/tags.
b) No Debug Messages ?

Then I tried your example for writing with the very same file.
I used Erions updated version of your wrapper:
http://erion.tdrealms.com/taglib

Code: Select all

XIncludeFile "tag_c.pbi"

Debug "Start"

file=taglib_file_new("Sarajevo 2014.mp3")
If file
  Debug "Open"
  tag = taglib_file_tag(file);
 
  Debug taglib_tag_set_artist(tag,"muhahahaha")
  Debug taglib_tag_set_title(tag,"muhahahaha")
  taglib_file_save(file)

  taglib_tag_free_strings()
  taglib_file_free(file)
EndIf 
Nothing. I tried it with and without the Debug command in front of the taglib_tag_set.
No debug messages, no changed tags.

What am I missing here?
I know it is a bold attempt for a newbie, but I am really interested what I am doing wrong.

Best Regards

Sebert

Re: TagLib

Posted: Fri Apr 04, 2014 3:32 pm
by erion
Hello,

I have just updated TagLib to v1.9.1.

Setting tags seem to work, I tested with an mp3 file. Perhaps that was a bug in 1.8...
Please redownload and see if this fixes anything.

Erion

Re: TagLib

Posted: Mon Apr 07, 2014 8:07 pm
by Sebert
Hi,

thank you for the update.

Unfortunately writing tags still doesn't work for me :-(

Re: TagLib

Posted: Tue Apr 08, 2014 2:10 pm
by erion
Hello,
I have tested the latest Taglib v1.9.1, specifically with ogg files, and I got positive results in all cases.
Here's the code I used:

Code: Select all

XIncludeFile "tag_c.pbi"

file=taglib_file_new("test.ogg")
If file
 Debug "Open"
 tag = taglib_file_tag(file);
  properties = taglib_file_audioproperties(file)
OpenConsole()
 PrintN("-- TAG --");
 taglib_tag_set_title(tag, "This is a test")
 PrintN("title - \"+PeekS(taglib_tag_title(tag)))
 PrintN("artist - \"+PeekS(taglib_tag_artist(tag)))
 PrintN("album - \"+PeekS(taglib_tag_album(tag))) 
 PrintN("year  - \"+Str(taglib_tag_year(tag)))
 PrintN("comment - \"+PeekS(taglib_tag_comment(tag)))
 PrintN("track - \"+Str(taglib_tag_track(tag)));
 PrintN("genre - \"+PeekS(taglib_tag_genre(tag)));
taglib_file_save(file)
 seconds = taglib_audioproperties_length(properties) % 60
 minutes = (taglib_audioproperties_length(properties) - seconds) / 60

 PrintN("-- AUDIO --");
 PrintN("bitrate  - "+Str(taglib_audioproperties_bitrate(properties)))
 PrintN("sample rate - "+Str(taglib_audioproperties_samplerate(properties)))
 PrintN("channels  - "+Str(taglib_audioproperties_channels(properties)))
 PrintN("length   - "+Str(minutes)+":"+Str(seconds));
   taglib_tag_free_strings()

 taglib_file_free(file)
Else
PrintN("Unable to open file.")
EndIf
Input()
CloseConsole()
I was using the latest PB 5.22 x86 (32 bit) version, with unicode mode disabled.

If it still doesn't work, here are a few things to try:
1. taglib_file_save() returns a boolean, i.e. 1 on success, 0 on failure. Put Debug or a MessageRequester around it, and see what it returns for you. Remember to enable the debugger in the debug menu of PB's ide if you are using Debug
2. If you get a 0, and you run Windows Vista or above, UAC can block access to the file, depending on where test.ogg is located. For example, UAC will not allow you to write to the root of your C drive, the Program Files directory, etc. Make sure you have write permission.
3. If you are monitoring the changed tags via a media player (Winamp/Foobar 2000, etc), they could lock the file if it is open or under playback. Make sure nothing has opened the file when you are saving the tags via TagLib.
If it still fails, the cause could be a damaged file. Try a different file, see if it writes the tags properly.

These are all the things I could think of for now.

Hth,
Erion

Re: TagLib

Posted: Tue Apr 08, 2014 5:22 pm
by Sebert
Hi Erion,

thank you very much for your help.
Reading tags works just fine, so I'll give your suggestions 1 & 2 a try in the next few days and get back to you!

Edit: As long as I include "tag_c.pbi", I don't get any debug messages. I tried

Code: Select all

XIncludeFile "tag_c.pbi"
Debug "DebugTest"
and the Debugger stays "silent".....

Regards

Sebastian

Re: TagLib

Posted: Mon Apr 14, 2014 4:24 am
by Poshu
Could anyone build an osx and a linux version? That could be a great addon to purebasic if it was multi platform.

Re: TagLib

Posted: Mon Apr 21, 2014 9:11 pm
by Sebert
erion wrote:Hello,
I have tested the latest Taglib v1.9.1, specifically with ogg files, and I got positive results in all cases.
Here's the code I used:

Code: Select all

XIncludeFile "tag_c.pbi"

file=taglib_file_new("test.ogg")
If file
 Debug "Open"
 tag = taglib_file_tag(file);
  properties = taglib_file_audioproperties(file)
OpenConsole()
 PrintN("-- TAG --");
 taglib_tag_set_title(tag, "This is a test")
 PrintN("title - \"+PeekS(taglib_tag_title(tag)))
 PrintN("artist - \"+PeekS(taglib_tag_artist(tag)))
 PrintN("album - \"+PeekS(taglib_tag_album(tag))) 
 PrintN("year  - \"+Str(taglib_tag_year(tag)))
 PrintN("comment - \"+PeekS(taglib_tag_comment(tag)))
 PrintN("track - \"+Str(taglib_tag_track(tag)));
 PrintN("genre - \"+PeekS(taglib_tag_genre(tag)));
taglib_file_save(file)
 seconds = taglib_audioproperties_length(properties) % 60
 minutes = (taglib_audioproperties_length(properties) - seconds) / 60

 PrintN("-- AUDIO --");
 PrintN("bitrate  - "+Str(taglib_audioproperties_bitrate(properties)))
 PrintN("sample rate - "+Str(taglib_audioproperties_samplerate(properties)))
 PrintN("channels  - "+Str(taglib_audioproperties_channels(properties)))
 PrintN("length   - "+Str(minutes)+":"+Str(seconds));
   taglib_tag_free_strings()

 taglib_file_free(file)
Else
PrintN("Unable to open file.")
EndIf
Input()
CloseConsole()
I was using the latest PB 5.22 x86 (32 bit) version, with unicode mode disabled.

If it still doesn't work, here are a few things to try:
1. taglib_file_save() returns a boolean, i.e. 1 on success, 0 on failure. Put Debug or a MessageRequester around it, and see what it returns for you. Remember to enable the debugger in the debug menu of PB's ide if you are using Debug
2. If you get a 0, and you run Windows Vista or above, UAC can block access to the file, depending on where test.ogg is located. For example, UAC will not allow you to write to the root of your C drive, the Program Files directory, etc. Make sure you have write permission.
3. If you are monitoring the changed tags via a media player (Winamp/Foobar 2000, etc), they could lock the file if it is open or under playback. Make sure nothing has opened the file when you are saving the tags via TagLib.
If it still fails, the cause could be a damaged file. Try a different file, see if it writes the tags properly.

These are all the things I could think of for now.

Hth,
Erion
1.taglib_tag_set_artist(tag,"muhahahaha") returns 2
taglib_file_save(file) returns 1
2. UAC is deactivated
3. Made no difference
Tried several files and several formats....

Regards

Sebastian

Re: TagLib

Posted: Sun May 04, 2014 2:35 pm
by erion
Hi,
This is very interesting. It appears that everything works as expected here, yet something goes wrong inside TagLib, despite the fact that it reports everything being fine.
If you have another computer, you could try the same example code on the same audio file. Other than that, unfortunately, I have no idea what to do next, especially because this does not seem to be a PB issue. TagLib seems to write out the tags properly, but they are not reflected in the actual file.

You may be able to get some help regarding this issue if you send an email explaining your problem to taglib-devel(at)kde(dot)org
Replace (at) and (dot) to @ and . respectively.

Sorry for not being able to help more!

Best,
Erion