Snkea / nekopaw

Automatically exported from code.google.com/p/nekopaw
1 stars 0 forks source link

Problem with filesystem... #237

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Honestly, I'm so stupid, I never caught this before...

I keep my computer set with Region to Japan. This means that instead of the 
backslash being the divider between folders, it's the \ symbol.

Sadly, I've found that this is a problem for anyone with a setting like mine, 
as that then generates bad folder directories, (which I still can't find a way 
to remove, though I can move their contents away just fine)

I'm not sure what would be a good fix for this... Since most people (I assume) 
aren't set to Japan Region, having the \ symbol in a directory is no problem, 
and could be annoying if it got replaced with an underscore or something, if 
they are wanting the full original name of an artist/artwork that includes it.

Original issue reported on code.google.com by JarieSui...@gmail.com on 21 Aug 2014 at 3:28

GoogleCodeExporter commented 9 years ago
So, if I got you right, in Japanese locale "\" is not banned symbol for names?
I'll check, if I can do it "right way" (i.e. recognise automatically), in the 
worst case i'll make a "ban list" changeable.

Original comment by catgirlfighter on 21 Aug 2014 at 3:34

GoogleCodeExporter commented 9 years ago
Hmm, looks like I actually got you wrong.

Are you trying to say that's in common Japanese app you use "yen" symbol 
instead of backslash, but in your case "\" should work just fine?
Grabber 2 an an unicode based app, and shoudn't inherit old "yen" symbol. I 
think I need more examples to clarify, what did you mean.

Original comment by catgirlfighter on 21 Aug 2014 at 3:44

GoogleCodeExporter commented 9 years ago
Ah, sorry, I should have shown an example. (Now I think about it, this could 
possibly happen with other image names, if they for some reason had a standard 
backslash in the name...)

On a system with Locale set to Japan, the backslash key's entry changes from 
"backslash" to "\" (Japanese-key layout causes this). (I literally am not sure 
how to actually input a standard backslash in this setting... never cared to 
look it up since I'd never had any problems. -_-; )

It will replace instances of a backslash to a \, and treat any that do get 
generated the same as normal, so replacing one with the other is a bad idea...

Thus, a directory looks like this:

C:\Users\Username\Desktop\New Folder\Image.jpg

The problem is, if an image downloaded is named something like:
ひかる¥少女.jpg
and then saved in the example directory, you expect an image file inside the 
folder New Folder. However, what you get is this:
C:\Users\Username\Desktop\New Folder\ひかる¥少女.jpg
which results in the filename being treated simultaneously as both a folder, 
named ひかる and a file, named 少女.jpg. This results in a bad situation 
where resulting folder is unable to be renamed or deleted, because the system 
is treating it as no single thing it recognizes (or something like that), even 
if you move the file from within to a different directory.

Original comment by JarieSui...@gmail.com on 21 Aug 2014 at 5:01

GoogleCodeExporter commented 9 years ago
I see. Now I know, where to start from. I'll try to do something tomorrow.

Original comment by catgirlfighter on 21 Aug 2014 at 5:18

GoogleCodeExporter commented 9 years ago
Looks like only secure method to handle ¥ is replace it, because in older 
systems (win XP or less or FAT filesystem) unicode ¥ automatically changes to 
ANSI version of it (and in japanese is the same symbol as folder separator). 
So, to prevent any issues with different OS and filesystems, I just HAVE to 
replace such symbols.

Original comment by catgirlfighter on 21 Aug 2014 at 5:30

GoogleCodeExporter commented 9 years ago
That's ok. Better that than cause directory problems for others who don't 
suspect it.

Probably just have it replace any instance of a directory-problematic digit 
(since there is a list of digits specifically meant to not be allowed in a 
directory) with an underscore?

Feels sad though, like there should still be a way to indicate what it should 
be... -_-; I can't think of anything though.

Original comment by JarieSui...@gmail.com on 21 Aug 2014 at 5:38

GoogleCodeExporter commented 9 years ago
Made an update.
Now grabber additionally check symbols for "ANSI capability", i.e. if symbol 
becomes forbidden after converting "from unicode to system locale", it will 
replace it with "_". Yen and Won is not only symbols that have to be replaces 
in another locales, so I didn't made any special symbols for them.

Original comment by catgirlfighter on 22 Aug 2014 at 1:14

GoogleCodeExporter commented 9 years ago
hello. I ran into a problem but I'll write it here since I was reading around I 
noticed the problem in this thread and the solution you did might be the cause 
of the problem I am facing, not to mention it was working fine until I updated 
a minute ago.

Anyway: for exhentai, source set to "album's url", with $tag$ in the saving 
path used to produce single folders per source based on said source's url, for 
example D:\example\http_exhentai.org_g_717877_dd89743723_\. It was working good 
and nice like that until just now. But right now it is doing 
D:\example\http_\exhentai.org\g\717877\dd89743723\. That and it can't download 
anything and keeps returning the error (I'll copy paste the thing it return 
with this example):

21:42:16 Cannot create file 
"D:\Test\exhen\http_\exhentai.org\g\12924\2192e6b800\12924-1.jpg". The system 
cannot find the path specified
21:42:21 Cannot create file 
"D:\Test\exhen\http_\exhentai.org\g\12924\2192e6b800\12924-2.jpg". The system 
cannot find the path specified
21:51:46 Cannot create file 
"D:\Test\exhen\http_\exhentai.org\g\717877\dd89743723\717877-1.jpg". The system 
cannot find the path specified

repeat until end of source, nothing downloaded.

Yeah, those \

Original comment by xefroxme...@gmail.com on 22 Aug 2014 at 1:56

GoogleCodeExporter commented 9 years ago
Thanks for fast response. Hotfixed it.

Original comment by catgirlfighter on 22 Aug 2014 at 2:08

GoogleCodeExporter commented 9 years ago
Alright, that fixed it. Great job :D

Original comment by xefroxme...@gmail.com on 22 Aug 2014 at 3:50

GoogleCodeExporter commented 9 years ago

Original comment by catgirlfighter on 25 Aug 2014 at 8:24

GoogleCodeExporter commented 9 years ago
Sorry to come back to this one, but I just tested it... and still has the same 
problem. Makes a broken folder that can't be deleted/renamed/etc.

Original comment by JarieSui...@gmail.com on 31 Aug 2014 at 2:23

GoogleCodeExporter commented 9 years ago
Looks like I have to use a japanese locale by myself to fix it. Can you provide 
some examples with sources?

Original comment by catgirlfighter on 1 Sep 2014 at 9:01

GoogleCodeExporter commented 9 years ago
Ok, to try to make this example useful, I set directories as:
Root:/folders/(artistID) 'artist'/'artist' - title (ImageID)

Therefore, when I download image 28860432 from Pixiv, the relevant tags are
ArtistID: 3563359
Artist: 强襲型黑兎
ImageID: 28860432
Title: \アッカリ~ン~~_HAPPY BIRTHDAY

Which creates this directory listing:
C:/test/(3563359) '强襲型黑兎'/'强襲型黑兎' - 
\アッカリ~ン~~_HAPPY BIRTHDAY (28860432)

But if it's in Japanese locale, the listing has all backslash replaced with 
Yen, making the problem:
C:\test\(3563359) '强襲型黑兎'\'强襲型黑兎' - 
\アッカリ~ン~~_HAPPY BIRTHDAY (28860432)

The Title tag contains a "\" symbol, which will be treated as the indication of 
a sub-folder, but be a broken and irremovable folder.

(When testing these, I recommend to have the target folder be on a spare flash 
drive, so you can just format it and get rid of the broken folders...)

Original comment by JarieSui...@gmail.com on 1 Sep 2014 at 2:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I disabled replacing for symbol '\' for fields, because it would be useful to 
use it in resources like deviantart, where you can use field %folder%, which 
looks like "digital\pixelart\isometric". Now I understand that was a dumb idea. 
New fix will be in a new update. It will be delayed a bit, because I making 
some quite big changes.

Original comment by catgirlfighter on 3 Sep 2014 at 2:05

GoogleCodeExporter commented 9 years ago
^_^; Yeah, that could have been cool, if not for breaking folders.

I look forward to it, and will return with feedback at that time!

Original comment by JarieSui...@gmail.com on 3 Sep 2014 at 4:25

GoogleCodeExporter commented 9 years ago
Uploaded a new version. Try it.

Original comment by catgirlfighter on 5 Sep 2014 at 10:34

GoogleCodeExporter commented 9 years ago
My test download shows it working right! So much better!
If I come up with a way to keep those symbols, I'll let you know, but for now, 
this is perfect!
Thank you!

Original comment by JarieSui...@gmail.com on 7 Sep 2014 at 12:53

GoogleCodeExporter commented 9 years ago
You're welcome.

Original comment by catgirlfighter on 8 Sep 2014 at 9:41