gyng/save-in

Issues with Dynamic Downloads/Rename and Route rules with DeviantArt.com

LukasThyWalls opened this issue · 0 comments

Hello.

In DeviantArt.com, I have some issues with the filenames, seems related to some kind of filename rename made by the how the webpage when it downloads a file.

I'm going to use this image as example: https://www.deviantart.com/cryptid-creations/art/Daily-Paint-2181-Quillypad-772098538

At any image in DeviantArt (i think), you can download the image itself saving the image (Context Menu above the image -> Save Image or Save-In), but if you are logged in on DeviantArt, sometimes, there is a Download button (an icon below-left the image) that normally brings the Save dialog or shows the full size image.

Normally, in most images, if you download saving the image with the context menu, the filename is like title_by_author_filecode-fullview.ext (using the example it should be daily_paint_2181_quillypad_by cryptid_creations_dcror1m-fullview.png but it's not as i will explain later), and if there is a download icon, that files download with a name like title_by_author_filecode.ext (daily_paint_2181__quillypad_by_cryptid_creations_dcror1m.png in our test case).

However, with some specific images, It doesn't use those filenames, instead it downloads with filenames like xxxxxxx-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.ext (the first "word" is the "filecode"). Normally happens with some images with the download icon, with GIFs happens always with both, and sometimes with the saving in context menu, like in the example, that downloads an image with filename dcror1m-bd1fe78d-cf2b-4c0f-ab93-08eaadfc4e88.png. You don't know when is going to use the normal filenames or the weird ones, normally are the normal but the other ones are very common.

Using Save-In, it does the same as using the normal save: You can save using the Context Menu -> Save In above the image, or using Context-Menu -> Save In above the download icon, and they respect the filenames.

But to avoid those weird filenames, I learned about Dynamic Downloads/Rename and Route options in Save In, and I tried to catch those filenames with weird names and auto-rename them when they appear. So I added this to the Save In Rename and Route configuration:

filename: ([a-z0-9]{7})\-[a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12}\.[a-z0-9]{3}
pagedomain: www.deviantart.com
pagetitle: (.+) on DeviantArt
capture: filename,pagetitle
into: :$3:-:$1:.:fileext:

I did like that because I would like to maintain the same filenames that use DeviantArt, although i would like to change the spaces and other characters to underscores (I asked about that here #187).

Anyway, when I add that configuration something happens, and ALL downloads using the Download icon are renamed by Save In using that rename configuration, including the ones I didn't have issues with those weird names.

You can see that in the example image, without the renaming rules above, using Save In in the Download button, it downloads an image with filename daily_paint_2181__quillypad_by_cryptid_creations_dcror1m.png, however, with the renaming rules, they are executed and i have a filename like Daily Paint 2181. Quillypad by Cryptid-Creations-dcror1m.png although it shouldn't because the filename is not something like dcror1m-bd1fe78d-cf2b-4c0f-ab93-08eaadfc4e88.png that is what triggers the renaming rules.

In reality, the image filename IS dcror1m-bd1fe78d-cf2b-4c0f-ab93-08eaadfc4e88.png, as you can see in the Download icon URL (https://www.deviantart.com/download/772098538/dcror1m-bd1fe78d-cf2b-4c0f-ab93-08eaadfc4e88.png?token=...), but when the file began to download (with Save In or not) is renamed by some kind of extra info provided by the DeviantArt webpage. But if you use any rename rules in Save In, it uses the original filename, and not that "renamed" filename, that will be the desired behaviour.

So the point is:

  • Is possible to use that "final" filename to match the rename/route rules in the Save In instead that original filename?
  • A workaround that fits in my case is to have the ability to replace characters in the filename (as i explained here #187), so I can replicate the same kind of filenames that use DeviantArt in any case scenario with the Page title and original file name.

Thanks in advance!