It is currently Thu May 08, 2025 8:22 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 16 posts ] 
Author Message
Offline
 Post subject: Looking for a mass-renamer go software
Post #1 Posted: Fri Mar 14, 2014 5:25 am 
Dies in gote

Posts: 37
Location: France - Britanny
Liked others: 5
Was liked: 14
Rank: kgs 4d
KGS: 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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #2 Posted: Fri Mar 14, 2014 5:30 am 
Oza

Posts: 2180
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Liked others: 237
Was liked: 662
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
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).

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #3 Posted: Fri Mar 14, 2014 5:40 am 
Dies in gote

Posts: 37
Location: France - Britanny
Liked others: 5
Was liked: 14
Rank: kgs 4d
KGS: 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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #4 Posted: Fri Mar 14, 2014 6:23 am 
Oza

Posts: 2264
Liked others: 1180
Was liked: 553
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/

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #5 Posted: Fri Mar 14, 2014 6:30 am 
Lives with ko

Posts: 159
Liked others: 5
Was liked: 36
Rank: EGF 3d
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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #6 Posted: Fri Mar 14, 2014 7:12 am 
Oza

Posts: 2180
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Liked others: 237
Was liked: 662
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
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).

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #7 Posted: Fri Mar 14, 2014 7:22 am 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: 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

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #8 Posted: Fri Mar 14, 2014 7:43 am 
Dies in gote

Posts: 37
Location: France - Britanny
Liked others: 5
Was liked: 14
Rank: kgs 4d
KGS: 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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #9 Posted: Fri Mar 14, 2014 7:57 am 
Beginner

Posts: 9
Liked others: 1
Was liked: 3
Rank: Kgs 1k
KGS: lemons
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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #10 Posted: Fri Mar 14, 2014 8:16 am 
Judan

Posts: 6269
Liked others: 0
Was liked: 796
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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #11 Posted: Fri Mar 14, 2014 9:20 am 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: 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

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #12 Posted: Fri Mar 14, 2014 9:22 am 
Lives with ko
User avatar

Posts: 248
Location: Arkansas, USA
Liked others: 193
Was liked: 21
Rank: KGS 8k
KGS: Azumi93
Online playing schedule: When I am in a mood for Go :D
I wonder whether it will be possible this to be done with Perl? Short program that is rum from the shell/CMD...

_________________
Stefany, web programmer

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #13 Posted: Fri Mar 14, 2014 9:50 am 
Dies in gote

Posts: 37
Location: France - Britanny
Liked others: 5
Was liked: 14
Rank: kgs 4d
KGS: 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.

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #14 Posted: Fri Mar 14, 2014 10:10 am 
Lives in gote
User avatar

Posts: 699
Location: Switzerland
Liked others: 485
Was liked: 166
Rank: DDK
KGS: aco
IGS: oca
OGS: 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

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #15 Posted: Sun Mar 16, 2014 2:37 pm 
Lives with ko
User avatar

Posts: 193
Liked others: 0
Was liked: 21
KGS: Rowen
Tygem: Kotaru
IGS: 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/

Top
 Profile  
 
Offline
 Post subject: Re: Looking for a mass-renamer go software
Post #16 Posted: Sun Mar 16, 2014 11:57 pm 
Lives in sente

Posts: 928
Location: UK
Liked others: 72
Was liked: 480
Rank: 5 dan
KGS: macelee
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


cgb, thanks for this. Sorry I have a big backlog of emails so I haven't got a chance to reply your email.

As someone already pointed out, it won't take a long time to write such a script to extract information from files and then rename them. I can do this fairly easily. So thanks a lot but you don't have to rename them for me. I can supply you a script if you need to have the file organised better.

And when compiling old games for my database, I normally need to go through each game and manually check the game information, compare the data against literatures. So it really doesn't matter how they are named. I can do this fairly efficiently (I processed about 8000 manually last year).

Thanks again for your help!

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group