Tremulous Forum

Mods => Mod Releases => Non-Gameplay Changing => Topic started by: Ingar on December 07, 2009, 10:19:49 pm

Title: Screenshot naming + gpp1 patch
Post by: Ingar on December 07, 2009, 10:19:49 pm
Update 2:
The number resets on date changes now, demos (except autorecord) and videos use the same naming convention.
http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp3.patch (http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp3.patch)

Update 1:

The format is now
yyyy-mm-dd-nnnn.jpg (or .tga)

nnnn is a number from 0000 to 9999, the client will continue numbering shots one the same day. If you happen to be playing at 0h 00m, it will not reset the numbering until you restart the client. If you make more than 10,000 screenshots on a single day you'll get an error message.

http://ingar.satgnu.net/files/tremulous/tremulous-gpp1-screenshot_timestamp2.patch (http://ingar.satgnu.net/files/tremulous/tremulous-gpp1-screenshot_timestamp2.patch)

Original post:

The default screenshot naming scheme isn't very convenient: if you like to make a lot of pictures and keep them organized it's easy get confused.

Personally, I like my screenshots to contain a timestamp. Such files are always neatly organised
in explorer and are much easier to find when you need them.

I propose the following format:
tremulous-yyyymmdd-hhmmss-nnnn.jpg or .tga

The nnnn part is somewhat interesting: it's a number from 0-9999 that gets reset to 0 every time
you start the client. That way you can have multiple screenshots per second and you also
have some kind of session numbering.

I made a small patch for gpp1 that does just that, you can find it here:
http://ingar.satgnu.net/files/tremulous/tremulous-gpp1-screenshot_timestamp1.patch (http://ingar.satgnu.net/files/tremulous/tremulous-gpp1-screenshot_timestamp1.patch)
The patch also removes the delay you experience when you make your first screenshot because
the client doesn't have to search for the first available screenshot number.

Title: Re: Screenshot naming + gpp1 patch
Post by: Norfenstein on December 08, 2009, 12:19:42 am
Would be nice to have the map name in there too, but maybe it's not worth making the file name even longer.
Title: Re: Screenshot naming + gpp1 patch
Post by: David on December 08, 2009, 12:24:42 am
Why the tremulous- at the start?  Surely its being in ~/.tremulous gives that away?

Also with thousands of them, maybe splitting into folders could help?  eg folder per day or whatever.
Title: Re: Screenshot naming + gpp1 patch
Post by: Demolution on December 08, 2009, 02:13:34 am
Substitute the "tremulous" part for a map name?
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on December 08, 2009, 04:44:26 am
Also I'd drop two of the yy just for simplicities' sake. I don't really see too much of a worry for Tremulous being played in the 22nd century. Shortens the file name too.
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on December 08, 2009, 06:27:08 pm
Would be nice to have the map name in there too, but maybe it's not worth making the file name even longer.
Might mess up chronological ordering of the files, unless the mapname comes after the timestamp.
Also, I have no idea where to find the mapname (code wise). It might be more difficult than it sounds,
but worth exploring.

Why the tremulous- at the start?  Surely its being in ~/.tremulous gives that away?
The best reason of all: lazyness. That way I can just upload screenshots
to my website without having to rename them.

I admit the number thingy does bother me somewhat, maybe I should limit it to two digits.
Title: Re: Screenshot naming + gpp1 patch
Post by: David on December 08, 2009, 06:55:37 pm
I seem to recall there being a mapname cvar, although that may be server only.
Title: Re: Screenshot naming + gpp1 patch
Post by: Bissig on December 08, 2009, 11:24:58 pm
Maybe put the map name into an exif (http://en.wikipedia.org/wiki/Exchangeable_image_file_format) field?
Title: Re: Screenshot naming + gpp1 patch
Post by: kevlarman on December 08, 2009, 11:30:23 pm
I seem to recall there being a mapname cvar, although that may be server only.
it is, but the client has easy access to the mapname anyway (how would it load it otherwise?), see the cl_autorecorddemo code.
Title: Re: Screenshot naming + gpp1 patch
Post by: Norfenstein on December 08, 2009, 11:57:38 pm
Would be nice to have the map name in there too, but maybe it's not worth making the file name even longer.
Might mess up chronological ordering of the files, unless the mapname comes after the timestamp.
Also, I have no idea where to find the mapname (code wise). It might be more difficult than it sounds,
but worth exploring.
After all the numbers was what I was thinking. And David's right, if you wanted tremulous- in front of all the file names you could easily mass rename them yourself. Agree with mooseberry too.
Title: Re: Screenshot naming + gpp1 patch
Post by: UniqPhoeniX on December 09, 2009, 11:04:55 am
If Tremulous had a time cvar: bind f11 screenshotJPEG tremulous-\$time\-\$mapname\. At least in Tremfusion, the mapname part works already and I could get gametime with a script that starts counting time when I enter a game. The nnnn part can be made to work too. Why can't Tremulous have scripting?
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on December 09, 2009, 06:08:08 pm
I did think about a cvar but it's just overkill. I don't feel like writing a parser for it.
I'll take a look at how tremfusion does it and maybe steal a good idea or two.
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on December 17, 2009, 02:16:41 pm
The format in the new patch is:
yyyy-mm-dd-nnnn.jpg (or .tga)

nnnn is a number from 0000 to 9999, the client will continue numbering shots one the same day. If you happen to be playing at 0h 00m, it will not reset the numbering until you restart the client. If you make more than 10,000 screenshots on a single day you'll get an error message.

http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp2.patch (http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp2.patch)

This way the funky number does something useful, I noticed it's quite confusing to find screenshots between a bunch of timestamps so I removed it and made the date a bit more readable.

I looked into adding the mapname but it seems slightly complicated, volunteers are always appreciated ;D

@moosberry:
I don't like 2-digit year numbers. It's like a different kind of soda: It sounds good
but I like my usual brand better.

Title: Re: Screenshot naming + gpp1 patch
Post by: gimhael on December 17, 2009, 04:50:54 pm
The renderer stores the map name is in tr.world->baseName (this is the file name of the .bsp without extension), but be careful: tr.world may be NULL when no map is loaded !
Title: Re: Screenshot naming + gpp1 patch
Post by: Demolution on December 17, 2009, 05:23:33 pm
Is there something similar to this for demos?

If you make more than 10,000 screenshots on a single day you'll get an error message.

aww..
Title: Re: Screenshot naming + gpp1 patch
Post by: kevlarman on December 17, 2009, 05:35:44 pm
The format in the new patch is:
yyyy-mm-dd-nnnn.jpg (or .tga)

nnnn is a number from 0000 to 9999, the client will continue numbering shots one the same day. If you happen to be playing at 0h 00m, it will not reset the numbering until you restart the client. If you make more than 10,000 screenshots on a single day you'll get an error message.

http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp2.patch (http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp2.patch)

This way the funky number does something useful, I noticed it's quite confusing to find screenshots between a bunch of timestamps so I removed it and made the date a bit more readable.

I looked into adding the mapname but it seems slightly complicated, volunteers are always appreciated ;D

@moosberry:
I don't like 2-digit year numbers. It's like a different kind of soda: It sounds good
but I like my usual brand better.


cl_main.c:2928 (http://projects.mercenariesguild.net/projects/tremulous/repository/entry/trunk/src/client/cl_main.c#L2928)
Code: [Select]
                       Q_strncpyz( mapName, COM_SkipPath( cl.mapname ), sizeof( cl.mapname ) );
                        COM_StripExtension(mapName, mapName, sizeof(mapName));
Title: Re: Screenshot naming + gpp1 patch
Post by: MitSugna on December 17, 2009, 06:32:19 pm
That would be awesome if all I did was taking screenshots
Title: Re: Screenshot naming + gpp1 patch
Post by: khalsa on December 17, 2009, 06:48:59 pm
This patch should be for both demo's and sshots.

My vote is for yyyy-mm-dd-nnnn-mapname
Title: Re: Screenshot naming + gpp1 patch
Post by: KillerWhale on December 17, 2009, 09:19:01 pm
I'd prefer to see yyyy-mm-dd-mapname-nnnn for better sorting, in my opinion. Either that or, mapname-yyyy-mm-dd-nnnn.

Both of those ways will group the shots from a map together, where Khalsa's way would group all of the first shots from every map together, which doesn't sound too intuitive to me.

Having this on demos and on screenshots sounds very nice. I don't like "screenshot0001" and "demo0001". :P
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on December 18, 2009, 02:40:02 am
I'd prefer to see yyyy-mm-dd-mapname-nnnn for better sorting, in my opinion. Either that or, mapname-yyyy-mm-dd-nnnn.

Both of those ways will group the shots from a map together, where Khalsa's way would group all of the first shots from every map together, which doesn't sound too intuitive to me.

Having this on demos and on screenshots sounds very nice. I don't like "screenshot0001" and "demo0001". :P


yyyy-mm-dd-nnnn-mapname seems the best way to me.

That would make the picture be 2009-12-17-0001-atcs.jpg. That doesn't make a ton of sense logically but I think it would be easiest to sort by. Knowing what map the picture was take on is nice, but I don't really see the need to ever sort by mapname (unless you're going back through old photos looking for pictures on a specific map.) It seems to me most of the time you will want it sorted by date.

And, you can name demos, but of course, this will make it a lot nicer if you don't bother to name them.
Title: Re: Screenshot naming + gpp1 patch
Post by: kevlarman on December 18, 2009, 03:04:35 am
cl_autorecorddemo has already done this for ages...
Title: Re: Screenshot naming + gpp1 patch
Post by: KillerWhale on December 18, 2009, 06:00:28 am
Well, I am confused as to the number. Is the number +1 for every shot taken on that day, or for on that map on that day?
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on December 18, 2009, 06:01:52 pm
@KillerWhale
patch number 2 does +1 on a new day, it doesn't have mapname yet.

I did add the mapname, in fact it was rather easy thanks to the tips in this thread.
BUT it screws chronological order. bigtime. Think playing the same maps, in a different order,
in several games on a single day.

mapname and number don't mix, so it's either

- full timestamp (down to the millisecond)
- short timestamp (date and/or time) + number
- full timestamp + mapname

There is a perfectly sound technical reason but I won't bore you with it.
Title: Re: Screenshot naming + gpp1 patch
Post by: UniqPhoeniX on December 19, 2009, 01:50:38 am
yyyy-mm-dd-nnnn-mapname shouldn't mess with cronological order tho.
Title: Re: Screenshot naming + gpp1 patch
Post by: Paradox on December 19, 2009, 10:49:30 pm
I like the idea of dumping mapname in EXIF data. Bissig said it, i believe
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on December 20, 2009, 12:11:59 am
I like the idea of dumping mapname in EXIF data. Bissig said it, i believe

Only problem is for the average user they will not know what this is or how to view it.
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on December 20, 2009, 12:07:29 pm
yyyy-mm-dd-nnnn-mapname shouldn't mess with cronological order tho.

The basic problem is I can't check if a filename yyyy-mm-dd-nnnn-* exists.
And after closer inspection, it will screw up in other situations as well.

I need to think this over.
Title: Re: Screenshot naming + gpp1 patch
Post by: David on December 20, 2009, 01:04:44 pm
Make it yyyy-mm-dd/nnnn-mapname, then all you have to do is count the number of nodes in the directory.
Title: Re: Screenshot naming + gpp1 patch
Post by: A Spork on December 20, 2009, 02:59:56 pm
Shouldn't mapname be before nnnn?
Otherwise you will get
0000atcs
0000niveus
0000nexus6
0001atcs
0002atcs

It should goup by map IMHO.
Title: Re: Screenshot naming + gpp1 patch
Post by: David on December 20, 2009, 05:04:14 pm
The numbers keep going up even if the map changes.
Title: Re: Screenshot naming + gpp1 patch
Post by: A Spork on December 20, 2009, 09:22:28 pm
Whatever, still makes more sense to me to have
mapnam before nnnn...
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on December 21, 2009, 06:21:23 am
Whatever, still makes more sense to me to have
mapnam before nnnn...

Whatever, but read the thread you are posting in for it to make more sense.
Title: Re: Screenshot naming + gpp1 patch
Post by: A Spork on December 21, 2009, 06:48:14 pm
What?
how does it not make sense?
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on December 21, 2009, 08:42:33 pm
What?
how does it not make sense?

Hm... Again you should read what people say.

I said read the whole thread carefully to better understand why things are what.

So what are you asking me "how does it not make sense?" for.

(I'll save you time, that was a rhetorical question.)
Title: Re: Screenshot naming + gpp1 patch
Post by: A Spork on December 21, 2009, 10:58:00 pm
Your wording sucks.
And I did read the thread, and I didn't see any reason why mapname has to be last.
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on December 21, 2009, 11:32:32 pm
Your wording sucks.
And I did read the thread, and I didn't see any reason why mapname has to be last.
:(
Title: Re: Screenshot naming + gpp1 patch
Post by: UniqPhoeniX on December 21, 2009, 11:44:56 pm
<date>-0000-atcs
<date>-0001-tremor
<date>-0002-atcs
is better than
<date>-atcs-0000
<date>-atcs-0002
<date>-tremor-0001
Title: Re: Screenshot naming + gpp1 patch
Post by: David on December 22, 2009, 12:09:50 am
Give them all random junk names, and make a lots of text files all indexed different ways.  Or could make tons and tons of symlinks to make everyone happy.  Or a cvar to let you choose it.  Or do whatever you want safe in the knowledge no one will care enough to submit a rival patch.
Title: Re: Screenshot naming + gpp1 patch
Post by: UniqPhoeniX on December 22, 2009, 01:23:10 am
Or wait until Tremfusion adds a cvar containing date and time (maybe game time too :P).
Title: Re: Screenshot naming + gpp1 patch
Post by: Paradox on December 22, 2009, 02:30:34 am
Why not just mapname/yyyy-mm-dd.jpg?
Title: Re: Screenshot naming + gpp1 patch
Post by: David on December 22, 2009, 08:24:19 am
Because then I have to go through a stack of folders to find all of todays shots.
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on January 06, 2010, 06:57:57 pm
mapname can't be done because I have to be able to check if a file with a certain number already exists.
I can't use wildcards.

In any case, I cleaned up the patch some more, format stays the same (yyyymmdd-nnnn) but the number resets to 0
on date changes. Demos and videos now use the same naming convention. (I did not change the autorecord demo names).

http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp3.patch (http://ingar.satgnu.net/tremulous/files/tremulous-gpp1-screenshot_timestamp3.patch)
Title: Re: Screenshot naming + gpp1 patch
Post by: Thorn on January 06, 2010, 09:31:30 pm
How many Ingar's does it take to change a screenshot?
Title: Re: Screenshot naming + gpp1 patch
Post by: David on January 06, 2010, 10:47:06 pm
Six.  One to write the patch and 5 to fight off the ravaging hordes.
Title: Re: Screenshot naming + gpp1 patch
Post by: gimhael on January 07, 2010, 07:20:23 am
mapname can't be done because I have to be able to check if a file with a certain number already exists.
I can't use wildcards.

Wouldn't it make things alot simpler if you just add an archived cvar that holds the date and number of the last screenshot/avi ? Then you don't need to check for existing files at the start, you just continue where you last stopped.
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on January 07, 2010, 08:11:57 pm
mapname can't be done because I have to be able to check if a file with a certain number already exists.
I can't use wildcards.

Wouldn't it make things alot simpler if you just add an archived cvar that holds the date and number of the last screenshot/avi ? Then you don't need to check for existing files at the start, you just continue where you last stopped.


The last used number is stored in a static int but it still has to scan the first time. It seems a bit overkill
to make it more complicated  ;)

How many Ingar's does it take to change a screenshot?
Six.  One to write the patch and 5 to fight off the ravaging hordes.

I have an infinite number of scary monkeys.
(http://www.invaderzim.tv/images/scary monkey show.jpg)
Title: Re: Screenshot naming + gpp1 patch
Post by: Lakitu7 on February 08, 2010, 04:47:17 pm
So is this now done, tested, and ready to go in, with people generally happy about the results?
Title: Re: Screenshot naming + gpp1 patch
Post by: Liskey on February 08, 2010, 09:55:37 pm
Silence means consent - so it must be all good :-)

But since I'm snowed in and bored, I'll ask why would wildcards even be mentioned as an issue.  Don't you need to read all the filenames anyway in order to find the latest?  Just parse out the date and sequence number and ignore the rest -- it makes no difference how filenames are formatted or what else they contain.

Code: [Select]
nextn = 0
today = current_date()
while (fname = readdir(dir)) {
  if (parse_date(fname) == today) {
     if (n=parse_nnnn(fname) >= nextn) nextn = n
  }
}
nextn += 1
 
Title: Re: Screenshot naming + gpp1 patch
Post by: Winnie the Pooh on February 08, 2010, 10:01:00 pm
Ingar has become a developer?
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on February 09, 2010, 01:57:51 am
What are you talking about?
Title: Re: Screenshot naming + gpp1 patch
Post by: Winnie the Pooh on February 09, 2010, 02:27:07 am
What are you talking about?
I'm talking about Ingar's work going straight into the official Final.
So is this now done, tested, and ready to go in, with people generally happy about the results?
Title: Re: Screenshot naming + gpp1 patch
Post by: mooseberry on February 09, 2010, 03:06:28 am
What are you talking about?
I'm talking about Ingar's work going straight into the official Final.
So is this now done, tested, and ready to go in, with people generally happy about the results?

I don't think/didn't know he is official dev, (although I could be wrong for sure) but this is open source, so anyone can create something useful, and "anything" could "potentially" end up being included in 1.2.
Title: Re: Screenshot naming + gpp1 patch
Post by: gimhael on February 09, 2010, 06:56:35 am
Silence means consent - so it must be all good :-)

But since I'm snowed in and bored, I'll ask why would wildcards even be mentioned as an issue.  Don't you need to read all the filenames anyway in order to find the latest?  Just parse out the date and sequence number and ignore the rest -- it makes no difference how filenames are formatted or what else they contain.

Code: [Select]
nextn = 0
today = current_date()
while (fname = readdir(dir)) {
  if (parse_date(fname) == today) {
     if (n=parse_nnnn(fname) >= nextn) nextn = n
  }
}
nextn += 1
 

Ingar keeps the current file number in a variable, but the variable is lost when you quit and restart tremulous, so it has to scan the existing files to find the highest existing number. After the first screenshot it's just a matter of incrementing a counter.

An other possibility to fix this is to keep the counter value over restarts by storing it in the autogen.cfg.
Title: Re: Screenshot naming + gpp1 patch
Post by: Liskey on February 10, 2010, 09:57:40 pm
Yes of course, he explained all that.
mapname can't be done because I have to be able to check if a file with a certain number already exists. I can't use wildcards.
That was the question - mapname can certainly be included in filenames, there is no reason to use wildcards, and you can check if a file already exists using readdir.
Title: Re: Screenshot naming + gpp1 patch
Post by: Ingar on February 28, 2010, 10:37:07 am
What are you talking about?
I'm talking about Ingar's work going straight into the official Final.
So is this now done, tested, and ready to go in, with people generally happy about the results?

I don't think/didn't know he is official dev, (although I could be wrong for sure) but this is open source, so anyone can create something useful, and "anything" could "potentially" end up being included in 1.2.

Sorry for the somewhate late response, but I still wanted to clear this up:

I am not an official developer, but I knew how to write code before I could make maps.
When there's something about a program that bothers me, I sometimes take the time to
correct it, make a patch and offer it to the developers. I already did this for a lot
of programs, not just tremulous.

In general, developers tend to pay more attention to patches than to random suggestions.