So I was up late last night trying to get my script working again. Turns out the the script worked the whole time but since I upgraded my distro it turns out the the uploader simply doesn't work at all on my linux box. I don't have time to do any more testing or prep for other OSes until about a week from now but I've added the second phase script to the zip file for those that want to venture on with very little instruction. Basically the Synology assistant doesn't actually have any code in it to work on media files it is bundled with other utilities which it calls. The utility it uses to create thumbnails is convert (convert.exe on windows). So the second phase gets put in place of this file and rather than generating thumbnails it simply copies the thumbnails that were generated in phase 1 where Synology Assistant expects them to be. On Mac and Linux this should just work as long as you name the script convert with no extension, set execute permissions and replace the convert file bundled with Synology Assistant with the script (on Mac you'll have to right click on the .app file and hit show package contents to browse around). On windows it is more complicated. Windows doesn't treat scripts and executables the same from a shell perspective and the file is called convert.exe so an executable binary is expected. I haven't been able to test it but you can make an executable binary with py2exe just follow the tutorial here (obviously you'll need to install py2exe). I'm not sure if you'll run into any strange problems don't forget that a py2exe executable will need all the generated support files not just the convert.exe I'll get this sorted out in a week or two but I'm out for now. Good luck to anyone who attempts and remember I provide no warranty whatsoever the file is provided as is but I'm more than happy to respond to comments if there are any.
- Remember if you used the original script to change the folder with the thumbnails to customThumbs (remove the 2 if it is there.)
- Make sure that on linux and OS X the file is convert not convert.py (a file manager might hide the extension on you.) and on Windows convert.exe made with py2exe
- The script was originally supposed to use .customThumbs to hide the files and make the uploader ignore it but I thought that might be confusing for people who can't see hidden files. Anyway I left everything at customThumbs but the assistant thinks the folders are jpegs… I can fix this pretty easy when I get back by changing the extension of the folders too anyway you're going to get a bunch of "couldn't generate thumbnail errors" while it uploads a bunch of empty folders in all the customThumb folders but that is because those are folders and not files just let the system run its course and go to your photo share and delete all the customThumbs folders at the end. I don't have time to retype this post but in retrospect that is probably what happened on my linux box… Hours spent debugging…
- If you want the convert script to run even faster you can change the shutil.copy to a shutil.move near the end of the convert script. This will only speed things up if your photos are on the same hard drive as where Synology Assistant stores temporary files ( /tmp on linux and probably on OS X but I haven't checked Windows\temp on windows.) This way the thumbnails don't have to be copied but they will be deleted by Synology Assistant (I'm guessing you probably don't care :) )
- This is all the time I have to explain for now. Best of luck to any who attempt.
So in case anyone who is waiting on this hasn't noticed I updated the instructions below as I forgot and thought that PIL came with the standard python distro. Anyway the hold up with the second step is that my windows machine is being rather unsupportive. I had a hard drive corruption issue yesterday and since the reinstall it has not been shy about blue screens. The method I have already works on Unix-like OSes but I need to convert the script to an exe file for it to work on windows. So I either need to export it with py2exe or I need to write the same script in C++ and compile it for windows. I was going to do the latter but I don't think my system will be stable enough for development work for a while (formatting a 2TB drive right now and the system is pretty touchy about doing other things at the same time.) So I went with Py2exe and I'm just waiting to do some testing before releasing stage 2. Should be tomorrow at the latest.
I'll update this post when I have more. I'm helping someone on windows get their photos uploaded and this is the first stage in the process. Here are the instructions for this part:
- Install python on whatever OS you like (this stage works on any OS or at least should :) );
- Install the Python imaging library (forgot you had to do this separate so if you tried the script and it didn't work this is probably what's wrong.) http://www.pythonware.com/products/pil/
- Take the photos that you have and put them in a directory by themselves. It is ok to have subfolders. symbolic and hard links are a bad idea;
- Download the script here;
- Run this script with the working directory set to the directory you just made. The easiest way to do this is to paste the script in the same directory as the images then go into a shell (cmd on windows or the shell on a Unix-like OS) navigate to that directory and run the script.
- This is going to make thumbnail jpegs in a folder called customThumbs (because I was testing something and forgot to change it back the first version I put up will make it customThumbs2 please rename this folder to customThumbs if you used that version :)) and fill it with folders and .jpg2 files. These are just regular jpegs I used jpg2 so if you add more images to the folder and rerun the script it won't make thumbnails of the thumbnails. Right now the script will remake all thumbnails though, it doesn't check to see if they already exist.
- These files are provided as is with no warranty of any nature
- This doesn't touch videos and only works on jpegs. If you have RAW photos you'll need to convert them to jpegs. Personally I keep my RAWs backed up to a different folder then put my mastered jpegs on the photo station after all the thumbnails will all be jpegs regardless
- Link to original article
- If you're reading this please contact Synology and ask them to give me the details of the photo uploading protocol it would make this a lot easier, I asked them here search the page for RagingSloth
So this article is taking a while longer than I thought. Summer is a busy time for my job and I was assigned a few secondary positions in the last couple of months. I have made some progress but the big question is how to make it simple for people to use. It is simple for me right now but I'm a computer engineer who happens to have written it :) I asked Synology for information on the upload protocol here: http://blog.synology.com/blog/?p=221 (search for RagingSloth on the page) and never heard anything (I really don't know why they would keep it secret?) If you're reading this right now please contact Synology and ask them to give me the details so I can make a really good photo uploader app. Right now I rely on altering the synology photo uploader and a two step process that would take me a while to explain and isn't as efficient as I can make it (though it is massively faster than the synology one which does a really bad job of managing memory, pipelining and making use of multiple cores.)