programming:python:libgal3
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
programming:python:libgal3 [2010/12/26 00:10] – [Images] jay | programming:python:libgal3 [2023/11/10 20:02] – [Donations] jay | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== What is it? ====== | + | ====== Python Gallery 3 Library ====== |
+ | |||
+ | ===== What is it? ===== | ||
This is a library to wrap the new Gallery 3 REST API in a nice, handy Python library. | This is a library to wrap the new Gallery 3 REST API in a nice, handy Python library. | ||
This is still an early release, but it functions quite well and has some nice features from a performance standpoint like //lazy// access to sub-items (the images in an album, for example). | This is still an early release, but it functions quite well and has some nice features from a performance standpoint like //lazy// access to sub-items (the images in an album, for example). | ||
- | ====== License | + | ===== License ===== |
This project is licensed under the GPLv3. | This project is licensed under the GPLv3. | ||
- | ====== Downloading | + | ===== Downloading ===== |
- | You can download the package here: {{: | + | You can download the package here: {{: |
You can also track this project on [[https:// | You can also track this project on [[https:// | ||
- | ====== | + | ===== Donations |
+ | By no means should anyone feel they //have// to donate. | ||
+ | |||
+ | |||
+ | ===== Installing | ||
Install is pretty easy if you've ever installed another Python package. | Install is pretty easy if you've ever installed another Python package. | ||
< | < | ||
- | $ tar -xvzf pylibgal3-*.tar.gz | + | # tar -xvzf pylibgal3-*.tar.gz |
- | $ cd pylibgal3-* | + | # cd pylibgal3-* |
- | $ sudo python setup.py install | + | # sudo python setup.py install |
</ | </ | ||
That's about it for the install. | That's about it for the install. | ||
- | ====== Usage ====== | + | ===== Usage ===== |
- | ===== Logging In ===== | + | ==== Logging In ==== |
This is a pretty simple to use library. | This is a pretty simple to use library. | ||
Line 40: | Line 46: | ||
# access with ssl=True. | # access with ssl=True. | ||
# standard ssl port of 443, you would use this for your constructor: | # standard ssl port of 443, you would use this for your constructor: | ||
- | # gal = libg3.Gallery3(hostname , apiKey , g3Base=g3Base , port=443 , ssl=True | + | # gal = libg3.Gallery3(hostname , apiKey , g3Base=g3Base , port=443 , ssl=True) |
</ | </ | ||
We'll get to usage on the '' | We'll get to usage on the '' | ||
Line 56: | Line 62: | ||
Now that you have your Gallery3 object, let's get to what you can do with it. | Now that you have your Gallery3 object, let's get to what you can do with it. | ||
- | ===== Core Gallery Items ===== | + | ==== Core Gallery Items ==== |
First, lets give you a brief explanation of the basic elements you will be dealing with, There are a total of five core Gallery elements that we will explore here. | First, lets give you a brief explanation of the basic elements you will be dealing with, There are a total of five core Gallery elements that we will explore here. | ||
- **Album** - Basically, this is a container to hold other items, including other albums. | - **Album** - Basically, this is a container to hold other items, including other albums. | ||
Line 65: | Line 71: | ||
- | ===== Exploring the Root Album ===== | + | ==== Exploring the Root Album ==== |
As you may, or may not, be aware, the root of your gallery is considered to be an album just like any other album you create within it. This means that it is the base of a tree structure you create. | As you may, or may not, be aware, the root of your gallery is considered to be an album just like any other album you create within it. This means that it is the base of a tree structure you create. | ||
Line 148: | Line 154: | ||
updatedDatetime = root.getUpdDT() | updatedDatetime = root.getUpdDT() | ||
</ | </ | ||
- | An important thing to note with some of the above. | + | An important thing to note with some of the above. |
- | ===== Images | + | ==== Images ==== |
Now, let's take a look at a RemoteImage: | Now, let's take a look at a RemoteImage: | ||
<code python> | <code python> | ||
Line 224: | Line 230: | ||
</ | </ | ||
- | ===== Comments | + | ==== Comments ==== |
We will only look at comments (and tags) briefly. | We will only look at comments (and tags) briefly. | ||
Line 259: | Line 265: | ||
</ | </ | ||
- | ===== Tags ===== | + | ==== Tags ==== |
Tags are a bit like comments. | Tags are a bit like comments. | ||
<code python> | <code python> | ||
Line 285: | Line 291: | ||
</ | </ | ||
- | ===== Additional Info ===== | + | ==== Additional Info ==== |
That about finishes up with the basics of the readable attributes for each of the core items. | That about finishes up with the basics of the readable attributes for each of the core items. | ||
* pydoc libg3.G3Items.Album | * pydoc libg3.G3Items.Album | ||
Line 296: | Line 302: | ||
Now, let's move on to working with our different items. | Now, let's move on to working with our different items. | ||
- | ===== Working With Albums | + | ==== Working With Albums ==== |
This is about as easy as it gets. You just call the '' | This is about as easy as it gets. You just call the '' | ||
<code python> | <code python> | ||
Line 333: | Line 339: | ||
To do the same with a movie, just use " | To do the same with a movie, just use " | ||
- | ===== Working With Images | + | ==== Working With Images ==== |
Now, there are not as many things you can do with images (or movies) as you can with albums so this will be brief. | Now, there are not as many things you can do with images (or movies) as you can with albums so this will be brief. | ||
Line 360: | Line 366: | ||
# Then you can just write this out as a local file | # Then you can just write this out as a local file | ||
open(newRemoteImage.name , ' | open(newRemoteImage.name , ' | ||
+ | |||
+ | # Get a handle to the resized image and download it | ||
+ | resized = firstImage.getResizeHandle() | ||
+ | outfile = open(' | ||
+ | outfile.write(resized.read()) | ||
+ | outfile.close() | ||
+ | |||
+ | # Get a handle to the resized image and download it | ||
+ | thumb = firstImage.getThumbHandle() | ||
+ | outfile = open(' | ||
+ | outfile.write(thumb.read()) | ||
+ | outfile.close() | ||
</ | </ | ||
Line 370: | Line 388: | ||
You can perform all these same operations with a RemoteMovie object as well. | You can perform all these same operations with a RemoteMovie object as well. | ||
- | ===== Another Item of Interest | + | ==== Another Item of Interest ==== |
It should also be pointed out that almost all of the functionality described above can also be done with different objects and method calls to your main Gallery3 object. | It should also be pointed out that almost all of the functionality described above can also be done with different objects and method calls to your main Gallery3 object. | ||
<code python> | <code python> | ||
Line 389: | Line 407: | ||
</ | </ | ||
It's worth noting that calling '' | It's worth noting that calling '' | ||
- | ===== The Future | + | ==== The Future ==== |
As you can see, there is a good deal of functionality here, but it is by no means complete. | As you can see, there is a good deal of functionality here, but it is by no means complete. | ||
* Make images and thumbnails resizable | * Make images and thumbnails resizable | ||
- | * Access to thumbnail downloads | ||
* Reordering of members in an album | * Reordering of members in an album | ||
* Make all editable properties editable | * Make all editable properties editable | ||
- | * I'm not sure about member access with large albums (over 100 images). | ||
If anyone has any problems, suggestions or whatever, feel free to email me directly at < | If anyone has any problems, suggestions or whatever, feel free to email me directly at < |
programming/python/libgal3.txt · Last modified: 2023/11/10 20:06 by jay