From: Chris Hulan Date: 2012-12-08T10:32:43+09:00 Subject: Re: strange syntax error on rename --f46d042f9d484659df04d04d4cf4 Content-Type: text/plain; charset=ISO-8859-1 i updated the gist, but i haven't actually run the code ;) On Fri, Dec 7, 2012 at 8:29 PM, Chris Hulan wrote: > is this happening every time? > possibly some non-mp3 files in the dir? > > also, Dir.foreach does not give the full path > so may have to append the path, > > > On Fri, Dec 7, 2012 at 8:14 PM, peteV wrote: > >> On 12/07/2012 07:54 PM, Chris Hulan wrote: >> >> here's how i'd do it: https://gist.github.com/4237869 >> >> >> On Fri, Dec 7, 2012 at 7:45 PM, Chris Hulan wrote: >> >>> I think the error is due to a missing 'end' >>> you have 2 'do' blocks but only 1 'end' >>> >>> Note 'file' is a string so no need to '.to_s' nor "#{..}" >>> >>> >>> On Fri, Dec 7, 2012 at 6:28 PM, peteV wrote: >>> >>>> On 12/07/2012 05:17 PM, peteV wrote: >>>> >>>>> >>>>> >>>>> File.rename ( "#{file}","#{tag.title}-#{tag.artist}.mp3") >>>>> >>>>> end # File is automatically closed at block end >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> >>>>> here is the error dump >>>>> ./taglibex.rb:15: syntax error, unexpected ',', expecting ')' >>>>> File.rename ( "#{file}","#{tag.title}-#{tag.artist}.mp3") >>>>> ^ >>>>> ./taglibex.rb:15: syntax error, unexpected ')', expecting keyword_end >>>>> >>>>> >>>>> >>>>> of course the error dump needed to contain the "#{tag.title}" :-[ >>>> I had copied a previous error dump by mistake from the cmd line >>>> >>>> >>>> >>> >> thanks guys that got me passed the syntax error. >> >> hey Chris, these are the errors I get now using your code solution >> >> TagLib: FileRef::tag() - Called without a valid file. >> TagLib: FileRef::tag() - Called without a valid file. >> TagLib: FileRef::audioProperties() - Called without a valid file. >> >> >> > --f46d042f9d484659df04d04d4cf4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable i updated the gist, but i haven't actually run the code ;)



On Fri, Dec= 7, 2012 at 8:29 PM, Chris Hulan <chris.hulan@gmail.com>= wrote:
is this happening every time?
possibly s= ome non-mp3 files in the dir?

also, Dir.foreach do= es not give the full path
so may have to append the path,=A0


On Fri, Dec 7, 2012 at 8:14 PM, peteV <p= ete0verse@gmail.com> wrote:
=20 =20 =20
On 12/07/2012 07:54 PM, Chris Hulan wrote:
here's how i'd do it:=A0https://gist.github.com/42= 37869


On Fri, Dec 7, 2012 at 7:45 PM, Chris Hulan <chris.hulan@gmail.com> wrote:
I think the error is due to a missing 'end'
you have 2 'do' blocks but only 1 'end'<= /div>

Note 'file' is a string so no need to '.to_s= ' nor "#{..}"


On Fri, Dec 7, 2012 at 6:28 PM, peteV <pete0verse@= gmail.com> wrote:
On 12/07/2012 05:17 PM, peteV wrote:


=A0 File.rename ( "#{file}","#{tag= .title}-#{tag.artist}.mp3")

end =A0# File is automatically closed at block end

-------------------------------------------------= -----------------------------
here is the error dump
./taglibex.rb:15: syntax error, unexpected ',', expecting ')'
=A0 File.rename ( "#{file}","#{tag= .title}-#{tag.artist}.mp3")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 ^
./taglibex.rb:15: syntax error, unexpected ')', expecting keyword_end



of course the error dump needed to contain the "#{tag.title}" :-[
I had copied a previous error dump by mistake from the cmd line




thanks guys that got me passed the syntax error.

hey Chris, these are the errors I get now using your code solution

TagLib: FileRef::tag() - Called without a valid file.
TagLib: FileRef::tag() - Called without a valid file.
TagLib: FileRef::audioProperties() - Called without a valid file.




--f46d042f9d484659df04d04d4cf4--