LackeyCCG

LackeyCCG Forum => Plugins & Plugin Creation Forum => Topic started by: clutchonline on September 16, 2019, 07:35:32 PM

Title: Using GeneralURL to get card images from Google Drive
Post by: clutchonline on September 16, 2019, 07:35:32 PM
Hey it's me again with another question. What I want to know is, if I turn on link sharing for a google drive folder, and then use CardGeneralURLs to link to the folder online in Drive, if that folder has several subfolders (one for each set), will card images be able to update?

Here's the link by the way

https://drive.google.com/drive/u/4/folders/1_JOLgjDGFUSOInGLzWNC5eKWq94fF0y6
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: CrazyChucky on September 17, 2019, 07:48:47 AM
CardGeneralURLs can work just fine with subfolders?that's how the Magic plugin does it. The general URL is http://magicplugin.normalitycomics.com/cardimages/, and each individual card then has an imageFile field like "mma/37". Lackey then downloads http://magicplugin.normalitycomics.com/cardimages/mma/37.jpg (http://magicplugin.normalitycomics.com/cardimages/mma/37.jpg); the only weird part is that it saves it to setimages/mma/mma/37.jpg, since it treats the imageFile field like the file name to save within the set folder. But it loads just fine, and users who don't go mucking about in the plugin files will never even notice.

However, I'm not sure Google Drive is going to be as clean a solution for this as one might hope. Ideally you'd be able to give the Aaron Loup card in Lackey the image name "aaronloup.png". Lackey will append that and the set name to your CardGeneralURL and try to access a file at https://drive.google.com/open?id=1_JOLgjDGFUSOInGLzWNC5eKWq94fF0y6/2019S2/aaronloup.png. But if you try that link, it doesn't work.

The actual shareable link for that card is https://drive.google.com/open?id=1MltxhcT76ht--G5FrhAhroKq_RT6Ysr0. (Although that opens it in Google Drive; to access the image itself, you need to change the URL to https://drive.google.com/uc?export=view&id=1MltxhcT76ht--G5FrhAhroKq_RT6Ysr0.) You would need to set "https://drive.google.com/uc?export=view&id=" as the CardGeneralURL, and then save the ID string in the ImageFile field of each card.

Thankfully, there is a way to automate this instead of clicking on each individual card and separately pasting it: see this StackExchange question (https://webapps.stackexchange.com/questions/88769/get-share-link-of-multiple-files-in-google-drive-to-put-in-spreadsheet). From there, you could do a search-and-replace to eliminate everything but the IDs, and paste it into your card data spreadsheet or whatever you're using to build your data files.
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: clutchonline on September 18, 2019, 02:41:46 PM
Do you know a better hosting option than Google Drive? I'm in no way tied to google. My carddata.txt file by the way references the names of the actual files ( so aaronloup.png), and has set as 2018S1 for that card.
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: CrazyChucky on September 20, 2019, 07:24:47 AM
I use Namecheap for both my domain registration and my hosting. It comes out to like... maybe $3 a month or so? And then you have an actual, legit webhost with no hacks or workarounds.
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: xdarkgeox on September 21, 2019, 11:09:19 AM
amazon aws is also a good place to host https://aws.amazon.com/ its free however if you choose to use it you have download s3 bowser so you can upload many files at once.
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: IceshadeComets on October 02, 2019, 05:09:18 PM
Untrue, after a year aws costs a small amount, for me with over 20000 images it's around 0.57 cents a month
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: xdarkgeox on October 03, 2019, 07:27:01 PM
you right but if you hosting not that many files its basically have no cost. its cheap af nevertheless
Title: Re: Using GeneralURL to get card images from Google Drive
Post by: IceshadeComets on October 04, 2019, 05:10:21 PM
In that case, yes I agree with you it's very cheap.