croot / my-imouto-booru

Automatically exported from code.google.com/p/my-imouto-booru
0 stars 0 forks source link

How to modify filename parsing? #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I know it's possible to edit the filename_parsing_methods model to change how 
the tagging based on filenames works, but I'm not exactly sure what I need to 
change. My goal is to name my images what I want them to be tagged as and have 
the tags grabbed from the filename. It does this already with the 
yande.re/moe.imouto images, but I want it to grab the tags from the file names 
even if I don't have moe/yandere in the filename.

Original issue reported on code.google.com by Bob.Flem...@gmail.com on 31 Dec 2012 at 12:56

GoogleCodeExporter commented 9 years ago
I can help you with the regular expression, but I need to know the pattern you 
want. How do your filenames look like exactly? "12345 tag_1 tag_2.ext"?

Original comment by asterixvader on 31 Dec 2012 at 11:19

GoogleCodeExporter commented 9 years ago
If possible, just "tag_1 tag_2.ext", if not, then yes, the "12345 tag_1 
tag_2.ext" will do fine :)

Original comment by Bob.Flem...@gmail.com on 31 Dec 2012 at 2:45

GoogleCodeExporter commented 9 years ago
Actually, now that I think about it, the  "12345 tag_1 tag_2.ext" may be the 
better choice as it would eliminate the issue of duplicate named files on the 
Windows end...so yes, "12345 tag_1 tag_2.ext".

Original comment by Bob.Flem...@gmail.com on 31 Dec 2012 at 5:43

GoogleCodeExporter commented 9 years ago
In the filename_parsing_methods, inside the "private function 
_parse_filename_tags" you will see this:

if (!preg_match("/^(?:yande\.re|moe) \d+ (.*)$/", $this->tempfile_name, $m))

Change the line for this:

if (!preg_match("/^(?:yande\.re|moe )?\d+ (.*)$/", $this->tempfile_name, $m))

It should now match tags with name like "12345 tag_1 tag_2"

Original comment by asterixvader on 31 Dec 2012 at 11:17

GoogleCodeExporter commented 9 years ago
Those lines of code are identical :p So I'm not sure what I'm supposed to 
change it to lol.

Also, have a nice new year!

Original comment by Bob.Flem...@gmail.com on 1 Jan 2013 at 12:27

GoogleCodeExporter commented 9 years ago
They aren't identical, notice this part:
/^(?:yande\.re|moe) \d+
against:
/^(?:yande\.re|moe )?\d+

Have a nice new year you too!

Original comment by asterixvader on 1 Jan 2013 at 12:30

GoogleCodeExporter commented 9 years ago
Ahhh you're right. Thank you so much :)

Original comment by Bob.Flem...@gmail.com on 1 Jan 2013 at 12:42

GoogleCodeExporter commented 9 years ago

Original comment by asterixvader on 7 Jan 2013 at 4:00

GoogleCodeExporter commented 9 years ago
Hi again. Ever since I restored my old filename parsing model when upgrading to 
1.0.0, the my filenames are not parsing. I'm ending up with "tagme" whenever I 
name the files as "1234 tag_1 tag_2" and upload them. Did something change?

Original comment by Bob.Flem...@gmail.com on 14 Jan 2013 at 6:06