Page 1 of 1

I can't write tags ???

Posted: Tue Apr 18, 2017 4:30 am
by lyapounov
Hello

for the first time, I am trying the write function of this great tool

I have made a test, with a little tweak : I only want to change one tag (composer)

So I copied the "simple write" php file, and tried to change only the 'composer' tag. My music file is a flac file.

First issue is that even when it says "successful" the file is not changed at all; even the date of the file is the old one, and the tag is not changed.

Second issue : the $tagwriter->tagformats value
whatever the value, I have an error message

- value to array('id3v2.3') returns
failed to write tags!Tag format "id3v2.3" is not allowed on "flac.flac" files

- value to array('metaflac') which seems to be the correct one for flac file returns either

Warning: Invalid argument supplied for foreach() in /share/CACHEDEV1_DATA/Web/Musique/getid3/write.metaflac.php on line 41
Failed to write tags!WriteMetaFLAC() failed with message(s):<pre><ul><li>System call to metaflac failed with this message returned: </li><li></li><li>sh: metaflac: command not found</li></ul></pre>

when $tagwriter->overwrite_tags is set to TRUE (which I don't want as I want to change only one parameter

or

Warning: Invalid argument supplied for foreach() in /share/CACHEDEV1_DATA/Web/Musique/getid3/write.php on line 614
Fatal error: Uncaught exception 'Exception' with message '$this->overwrite_tags=false is known to be buggy in this version of getID3. Will be fixed in the near future, check www.getid3.org for a newer version.' in /share/CACHEDEV1_DATA/Web/Musique/getid3/write.php:417
Stack trace:
#0 /share/CACHEDEV1_DATA/Web/Musique/getid3/write.php(633): getid3_writetags->MergeExistingTagData('vorbiscomment', Array)
#1 /share/CACHEDEV1_DATA/Web/Musique/getid3/write.php(640): getid3_writetags->FormatDataForVorbisComment()
#2 /share/CACHEDEV1_DATA/Web/Musique/getid3/write.php(303): getid3_writetags->FormatDataForMetaFLAC()
#3 /share/CACHEDEV1_DATA/Web/Musique/applications/fct_Tags.php(72): getid3_writetags->WriteTags()
#4 /share/CACHEDEV1_DATA/Web/Musique/cli/compo.php(85): writeFullTags(Array, '/share/Musique/...')
#5 /share/CACHEDEV1_DATA/Web/Musique/cli/compo.php(69): goArbo('1) Renaissance/...', '98')
#6 /share/CACHEDEV1_DATA/Web/Musique/cli/compo.php(43): goArbo('1) Renaissance/...', '98')
#7 {main}
thrown in /share/CACHEDEV1_DATA/Web/Musique/getid3/write.php on line 417

when $tagwriter->overwrite_tags is set to FALSE (which I want)

Again, if I comment this line i.e. //$tagwriter->tagformats I have a nice message which says it is perfect, but the file is unchanged;

Thx for any hint : what am I doing wrong ??

Best

Re: I can't write tags ???

Posted: Tue Apr 18, 2017 4:55 am
by James Heinrich
Tag writing (for all file and tag formats) is barely alpha-quality code, and needs considerable rewriting, and is generally unsupported.

At quick glance it would seem your problem is:

Code: Select all

sh: metaflac: command not found
You need to have metaflac installed since that's what's doing the tag writing.
Depending what you're trying to do it may actually be easier to call metaflac directly:
https://github.com/JamesHeinrich/getID3 ... ac.php#L84

Re: I can't write tags ???

Posted: Tue Apr 18, 2017 5:14 am
by lyapounov
Thank you James !!

I love your code, very high quality. I just use it for two types of files : flac and dsf. One day, I should extract the subpart of it which I need.

Will try this command. Though is it on a qnap NAS; I hope metaflac works on this environment; and recent Qnap don't allow ipkg anymore...

Best

Re: I can't write tags ???

Posted: Fri Apr 21, 2017 6:18 pm
by lyapounov
James

thx for your help.

Unfortunatly, metaflac is not available on a NAS (Qnap in my case).

Is there a work around you may think of ? I am just a modest php programmer :-)

FYI I am building a web site to manage my music (4000 albums, 95% in flac, 5% is dsf) including tag managment on a NAS, without the need to access those files as a local HD, and of course without the need to copy, change tags, and transfer back to the NAS.

Best

Serge

Re: I can't write tags ???

Posted: Fri Apr 21, 2017 6:23 pm
by James Heinrich
getID3 does not make any attempt to generate FLAC tags itself, it lets metaflac do all the hard work. If that is not available, then you're out of luck (as far as I know).

Re: I can't write tags ???

Posted: Fri Apr 21, 2017 9:48 pm
by lyapounov
Thx James

though getID3 can read the tags from flac files. So how can it be possible while metaflac is not available ?

Re: I can't write tags ???

Posted: Fri Apr 21, 2017 10:03 pm
by James Heinrich
getID3 does parse FLAC tags itself, so it's no problem to read FLAC tags, it's only writing where metaflac is required.

Re: I can't write tags ???

Posted: Sat Apr 22, 2017 4:28 pm
by lyapounov
James, I got the solution.

ffmpeg can do the job, and is available on most NAS

cf. https://wiki.multimedia.cx/index.php/FFmpeg_Metadata

the main drawback is to write in another file, as it does not replace the same file.

Now I have to find how to write for dsf files.