Looking for a mass-renamer go software

General conversations about Go belong here.
cgbspender
Dies in gote
Posts: 37
Joined: Wed Sep 01, 2010 6:20 am
Rank: kgs 4d
GD Posts: 0
KGS: cgbspender
Location: France - Britanny
Has thanked: 5 times
Been thanked: 14 times

Looking for a mass-renamer go software

Post by cgbspender »

Hi !

I have those sgf files, downloaded while I was wandering on go websites, and not necessarily english ones...
They are sometimes named as numbers.sgf or by using acronyms LCHvsGL.sgf

I wish I could rename them by using their tags to give a proper name : LeeChangHo-GuLi-Event-Date-Result.sgf for instance.
I found this project on senseis : http://senseis.xmp.net/?SGFOrganizer

but the project is obviously abandonned (too bad !)

So do you know other freewares that would allow me to do this ? renaming them one by one is too time-consuming... especially when you have to rewrite the whole syntax again and again.

Please help !

cgb
Staying true to myself.
DrStraw
Oza
Posts: 2180
Joined: Tue Apr 27, 2010 4:09 am
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Has thanked: 237 times
Been thanked: 662 times
Contact:

Re: Looking for a mass-renamer go software

Post by DrStraw »

I don't know of any, but it seems like it would be a trivial matter to write a short program to do it for anyone with a minimal amount of programming knowledge. I'm sure I could do it in 5 minutes in VB if I knew the syntax of the file.
Still officially AGA 5d but I play so irregularly these days that I am probably only 3d or 4d over the board (but hopefully still 5d in terms of knowledge, theory and the ability to contribute).
cgbspender
Dies in gote
Posts: 37
Joined: Wed Sep 01, 2010 6:20 am
Rank: kgs 4d
GD Posts: 0
KGS: cgbspender
Location: France - Britanny
Has thanked: 5 times
Been thanked: 14 times

Re: Looking for a mass-renamer go software

Post by cgbspender »

The syntax looks like this in sgf files :

(;GM[1]FF[4]SZ[19]CA[UTF-8]PW[Akedo Kazumi]PB[Hamanaka Takamitsu]WR[6p]BR[4p]KM[0]RE[B+R]EV[Oteai]PC[Nihon Ki-in, Central Japan Branch]DT[1986-05-29]RO[Round1]

With those tags I would like to rename the file(s) so that it becomes :
PW[X]WR[6p] VS PB[Y]BR[4p] - EV[ZZZ]RO[] - DT[YYYY-MM-DD].sgf

For this example, it would give this :

AkedoKazumi 6P VS Hamanaka Takamitsu 4P - Oteai R1 - 19860529.sgf

Best would be to able to rename all the sgf files in a directory, all at once

If someone can help :p
Staying true to myself.
xed_over
Oza
Posts: 2264
Joined: Mon Apr 19, 2010 11:51 am
Has thanked: 1179 times
Been thanked: 553 times

Re: Looking for a mass-renamer go software

Post by xed_over »

DrStraw wrote: I'm sure I could do it in 5 minutes in VB if I knew the syntax of the file.

http://www.red-bean.com/sgf/
kivi
Lives with ko
Posts: 159
Joined: Mon Mar 21, 2011 7:14 am
Rank: EGF 3d
GD Posts: 0
Has thanked: 5 times
Been thanked: 36 times

Re: Looking for a mass-renamer go software

Post by kivi »

Are you familiar with godrago and kombilo? They organize sgf files into a searchable database. So you don't need to care about filenames to find a game between your favorite pro's.
DrStraw
Oza
Posts: 2180
Joined: Tue Apr 27, 2010 4:09 am
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Has thanked: 237 times
Been thanked: 662 times
Contact:

Re: Looking for a mass-renamer go software

Post by DrStraw »

xed_over wrote:
DrStraw wrote: I'm sure I could do it in 5 minutes in VB if I knew the syntax of the file.

http://www.red-bean.com/sgf/


I did not say "if I could find a site which tells me what it is and which I would need to spend some time digesting and understanding." What I meants was if I knew it off the top of my head and did not need to give it any thought. I was merely trying to say it would be very easy for someone fully conversant with the forat.
Still officially AGA 5d but I play so irregularly these days that I am probably only 3d or 4d over the board (but hopefully still 5d in terms of knowledge, theory and the ability to contribute).
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: Looking for a mass-renamer go software

Post by oca »

I have done something very similare for my self.
The problem is that I did that with a script written in groovy (and groovy need java to be installed on the computer)...

So two solutions here :

1) you have java on your computer and then I can send you a program and instruction to rename you files.
2) I can do the work for you, but you will then need to send me a zip file with your sgf files.
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
cgbspender
Dies in gote
Posts: 37
Joined: Wed Sep 01, 2010 6:20 am
Rank: kgs 4d
GD Posts: 0
KGS: cgbspender
Location: France - Britanny
Has thanked: 5 times
Been thanked: 14 times

Re: Looking for a mass-renamer go software

Post by cgbspender »

I do use Kombilo, which doesn't allow mass-renaming of the files.
You are right to say it does display the tags, but my original files names are kinda nonsense sometimes, so I'd like to rename them all.

If it were just for me, I wouldn't mind using nonsensical names for those files, as I can view the tags via kombilo, but those files are meant to be sent to macelee (go4go.net) so that he can add them on the website. For convenience issues, I have to have them rewritten, so that macelee won't have to spend months renaiming them. (there is likely to be a few thousands)

cgb
Staying true to myself.
lemon
Beginner
Posts: 9
Joined: Sat Jan 26, 2013 11:10 am
Rank: Kgs 1k
GD Posts: 0
KGS: lemons
Has thanked: 1 time
Been thanked: 3 times

Re: Looking for a mass-renamer go software

Post by lemon »

cgbspender wrote:I do use Kombilo, which doesn't allow mass-renaming of the files.
You are right to say it does display the tags, but my original files names are kinda nonsense sometimes, so I'd like to rename them all.

If it were just for me, I wouldn't mind using nonsensical names for those files, as I can view the tags via kombilo, but those files are meant to be sent to macelee (go4go.net) so that he can add them on the website. For convenience issues, I have to have them rewritten, so that macelee won't have to spend months renaiming them. (there is likely to be a few thousands)

cgb


I'll whip something together tomorrow. I'm currently working on some software that does sgf parsing so it would be easy enough to adapt it to your needs.
RobertJasiek
Judan
Posts: 6272
Joined: Tue Apr 27, 2010 8:54 pm
GD Posts: 0
Been thanked: 797 times
Contact:

Re: Looking for a mass-renamer go software

Post by RobertJasiek »

Batch renaming of file names:

ReNamer
http://www.den4b.com/?x=products&product=renamer

Replacing strings within a file:
Use some software with batch processing of Regular Expressions.

Since Pascal script can be added to ReNamer, you might try to use it to create exactly what you want (extract contents of a file to create file names), but I am not sure.
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: Looking for a mass-renamer go software

Post by oca »

just for curious, a quick and dirty groovy script for renaming files
package oca.go

def srcPath = "D:/my/go/sgf/9x9" // path where the sgf files are
new File(srcPath).eachFile { File file ->
if (file.getName().endsWith(".sgf")) {
def content = file.getText()
def props = content.split(";")[1].replaceAll("\n","")

def pw = findValue("PW", props)
def wr = findValue("WR", props)
def pb = findValue("PB", props)
def br = findValue("BR", props)
def ev = findValue("EV", props)
def ro = findValue("RO", props)
def dt = findValue("DT", props)
// ...
// ...
// do what ever you want here
def newName = "$pw $wr VS $pb $br - $ev $ro - $dt"
file.renameTo(newName+".sgf");
}
}

def findValue(prop,props ) {
def m = props =~ /.*/+prop+/\[(.*?)\]/
return (m.matches()) ? m[0][1] : "___"
}
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
User avatar
Stefany93
Lives with ko
Posts: 248
Joined: Wed Jun 23, 2010 12:39 pm
Rank: KGS 8k
GD Posts: 0
KGS: Azumi93
Online playing schedule: When I am in a mood for Go :D
Location: Arkansas, USA
Has thanked: 193 times
Been thanked: 21 times
Contact:

Re: Looking for a mass-renamer go software

Post by Stefany93 »

I wonder whether it will be possible this to be done with Perl? Short program that is rum from the shell/CMD...
cgbspender
Dies in gote
Posts: 37
Joined: Wed Sep 01, 2010 6:20 am
Rank: kgs 4d
GD Posts: 0
KGS: cgbspender
Location: France - Britanny
Has thanked: 5 times
Been thanked: 14 times

Re: Looking for a mass-renamer go software

Post by cgbspender »

That sounds very helpful to my newb ears, oca... but as a newbie, my silly question will be, how to use this ?

I create a text file which I rename as .go and paste all this in it ? and then run it ?
just like for a .sh ?
Staying true to myself.
User avatar
oca
Lives in gote
Posts: 699
Joined: Wed Feb 19, 2014 2:53 am
Rank: DDK
GD Posts: 0
KGS: aco
IGS: oca
OGS: oca
Location: Switzerland
Has thanked: 485 times
Been thanked: 166 times

Re: Looking for a mass-renamer go software

Post by oca »

I will post the procedure next week
Bon week end
Converting the book Shape UP! by Charles Matthews/Seong-June Kim
to the gobook format. last updated april 2015 - Index of shapes, p.211 / 216
User avatar
Rowen
Lives with ko
Posts: 194
Joined: Sat Nov 09, 2013 9:35 am
GD Posts: 0
KGS: Rowen
Tygem: Kotaru
IGS: Rowen
Been thanked: 21 times

Re: Looking for a mass-renamer go software

Post by Rowen »

I've used Advanced Renamer before, it works nicely. I think it might do what your wanting.

Here is the URL (its free): http://www.advancedrenamer.com/
Post Reply