I can't write tags ???

The place for "I can't figure out how to..." questions.
Post Reply
lyapounov
User
Posts: 7
Joined: Sat Sep 17, 2016 4:02 am
Are you a spambot?: no

I can't write tags ???

Post by lyapounov » Tue Apr 18, 2017 4:30 am

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

James Heinrich
getID3() v1 developer
Posts: 1432
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: I can't write tags ???

Post by James Heinrich » Tue Apr 18, 2017 4:55 am

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

lyapounov
User
Posts: 7
Joined: Sat Sep 17, 2016 4:02 am
Are you a spambot?: no

Re: I can't write tags ???

Post by lyapounov » Tue Apr 18, 2017 5:14 am

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

lyapounov
User
Posts: 7
Joined: Sat Sep 17, 2016 4:02 am
Are you a spambot?: no

Re: I can't write tags ???

Post by lyapounov » Fri Apr 21, 2017 6:18 pm

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

James Heinrich
getID3() v1 developer
Posts: 1432
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: I can't write tags ???

Post by James Heinrich » Fri Apr 21, 2017 6:23 pm

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).

lyapounov
User
Posts: 7
Joined: Sat Sep 17, 2016 4:02 am
Are you a spambot?: no

Re: I can't write tags ???

Post by lyapounov » Fri Apr 21, 2017 9:48 pm

Thx James

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

James Heinrich
getID3() v1 developer
Posts: 1432
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: I can't write tags ???

Post by James Heinrich » Fri Apr 21, 2017 10:03 pm

getID3 does parse FLAC tags itself, so it's no problem to read FLAC tags, it's only writing where metaflac is required.

lyapounov
User
Posts: 7
Joined: Sat Sep 17, 2016 4:02 am
Are you a spambot?: no

Re: I can't write tags ???

Post by lyapounov » Sat Apr 22, 2017 4:28 pm

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.

Post Reply