Commands to Execute
tyeeman opened this issue · comments
Great addition to this gallery. I'm trying it now but getting errors about public folder.
shutil.copytree(data_dir / 'public', public_dir, dirs_exist_ok=True)
TypeError: copytree() got an unexpected keyword argument 'dirs_exist_ok'
Do I have to run the original command of "gallery-init" to initialize your version here, and then run "gallery-bulkcreation config.ini"?
Hi, what version of Python are you using. Seems to be that something in the shutil
module changed.
Can you provide following output:
python --version
python -m pip freeze
Version is Python 3.7.2
and which OS are u using? If it's Windows, I've never tested it there :/
ok, it is not the OS. Just checked, the the option dirs_exist_ok
of shutil.copytree
was introduced in Python 3.8.
Thus this whole package currently just supports Python version 3.8 or higher. Sorry that this was not highlighted anywhere.
Are you able to use a newer Python version?
I will also backport this package to older versions as far as I have some time.
Yes, I use Windows. Thanks for the info.
Hi @tyeeman,
I just released a new version 0.2.0 (https://pypi.org/project/simple-photo-gallery-bulkcreation/) which should also support your Python version 3.7.
Please check and feedback. Afterwards I will close this issue.
ok, thanks. I'm not sure if I have to run "gallery-init" first or just run "gallery-bulkcreation" first? And what about "gallery-build". Please specify the order of the 3 commands.
Update - Yes, it works fine, thanks a lot! The sort order is alphabetical I believe because I have incrementing number at the beginning of each filename and it sorts in order.
Question - How to change the number of images per row in the main gallery page? I've added 3 galleries and have only 2 images per row. I would like 3 or 4. Also where is the main page template? I want to add some menu items to it. It would be nice to have these menu items show up on all pages.
Update for anyone else - You don't have to run "gallery-init" or "gallery-build". Just make the "config.ini" and then run "gallery-bulkcreation" and it works.
You just have to prepare the config file (an example you can find here: https://github.com/hille721/simple-photo-gallery-bulkcreation/blob/master/example/config-example.ini) and then run the gallery-bulkcreation
command.
No need to run gallery-init
or gallery-build
, they are in gallery-bulkcreation
included. In fact, you can't use those commands together, you would break things.
Question - How to change the number of images per row in the main gallery page? I've added 3 galleries and have only 2 images per row. I would like 3 or 4.
Could you send a screenshot? Normally this should be adjusted automatically, dependent on your screen size.
Also where is the main page template? I want to add some menu items to it. It would be nice to have these menu items show up on all page
https://github.com/hille721/simple-photo-gallery-bulkcreation/blob/master/src/simplegallery_bulkcreation/data/templates/index_template.jinja
This is the template for the overview page. For the single galleries the template is coming directly from the simplegallery package.
I don't seem to have that template for the overview page even though the gallery built somehow.
My bulkcreation folder only has "config.ini" and my "gallery" folder. In that "gallery" folder I have my 3 gallery folders (containing photos) plus a "gallery_data" folder with it containing a "templates" folder and "images_data.json" and "gallery.json".
So I wonder where the "index_template.jinja" is for the overview page?
Here is my overview page showing 2 galleries per row - I have my PC set up for text to display at 150% of normal. Would that have anything to do with it?
There are two possibilities, the easiest would be to directly change the index.html files after the creation and not the templates before. The index.html
files are located under gallery/public
, e.g. :
└── public
├── 2017-11-01_15-20-23.jpg
├── Greece_2019
│ ├── css
│ ├── images
│ ├── index.html
│ └── js
├── Mexico_2019
│ ├── css
│ ├── images
│ ├── index.html
│ └── js
├── Oman_2020
│ ├── css
│ ├── images
│ ├── index.html
│ └── js
├── css
│ ├── default-skin.css
│ └── main.css
└── index.html
You can see, there is a index.html
directly under gallery/public
which is the index file for the overview page, and then there are index files belox each gallery.
But be careful, if you run the gallery-bulkcreation
command again, changes in those files will be overwritten again
The other possibility is to change the templates. For that you have to find out, where pip installed the packages, e.g. via the pip show
command:
$ pip show simple-photo-gallery-bulkcreation
Name: simple-photo-gallery-bulkcreation
Version: 0.2.0
Summary: Plugin for the simple-photo-gallery to provide a config based bulk creation
Home-page: https://github.com/hille721/simple-photo-gallery-bulkcreation/
Author: Christoph Hille
Author-email: hille721@gmail.com
License: MIT License
Location: /home/hille/test/.venv/lib/python3.9/site-packages
Requires: Jinja2, simple-photo-gallery
Required-by:
In the location line you can see, where the package is installed. From there you will find the templates under simplegallery_bulkcreation/data/templates/
for the overview page and simplegallery/data/templates/
for each gallery.
The advantage of this method is, that the changes are persistent and you can run the gallery-bulkcreation
again and again. Also if you add new galleries, they will directly have the correct layout.
Here is my overview page showing 2 galleries per row - I have my PC set up for text to display at 150% of normal. Would that have anything to do with it?
If I have three galleries it is looking as this with a wide screen:
But on a smaller screen there are just two galleries per row, or on my smartphone just one. This is really dynamic and optimized for the screen size.
Thus yes, in your case it is probably because of the 150% , you set up for text to display.
Can you have your code copy the overview page template and individual gallery page template from the php area to the root folder of the gallery when gallery-bulkcreation
is run and use them from there instead to build the galleries? That would solve it easily, then everything is in one place.
My location is Location: c:\python37\lib\site-packages
. So when gallery-bulkcreation
is run copy them to my gallery root.
Then you would also have the problem that rerunning the command will overwrite everything again.
Running the command the first time or any other time - the first time copy the templates to the root and build from there. All builds can use these root templates. When building just check first to see if they are already there, if yes, build using them, if they are not there (only the first time) then copy then build using them.
Oh yeah, but then how does the original app do it. I added menu items there and it works well. Let me check where the original app stores the templates.
Ok, the templates for the main page are in a templates
folder in my root gallery folder. index_template.jinja
is there along with gallery_macros.jinja
. There are also 2 other files in my root gallery folder, images_data.json
and gallery.json
.
Yes in Simplegallery you have those two steps, init and build. After the first init you can change the templates and run the build command again and again.
In this bulkcreation command you run always both steps, thus the templates will be copied every time. There I was kind of lazy when I've implemented it. 😃
I will check what I can do that it works as you expects.
I edited my post two posts up, please re-read about checking the templates for existing every time a build is run.
Ok, the templates for the main page are in a templates folder in my root gallery folder. index_template.jinja is there along with gallery_macros.jinja. There are also 2 other files in my root gallery folder, images_data.json and gallery.json.
You have this with bulkcreation as well. But there the templates will be overwritten if you run the command again.
But as I said, I will think about a solution, how to solve this 😉
I've created #6 to track this enancement.