Re: Bug/crash due to date comparison

2017-01-13 Thread Chris Green
On Fri, Jan 13, 2017 at 11:36:07AM +0100, Martin Kos wrote:
> On 10.01.2017 11:28, Chris Green wrote:
> > The changes required are trivial:-
> > 
> > Delete the lines with - by them, add the lines with + (obviously the
> > commented out lines starting with # can just be deleted if you want).
> > The first block of changes is for albums, the second block for image
> > files, so you might just want to do the first single line change.
> > 
> > Note that I have reversed the 'other' and 'self', I couldn't get the
> > albums in ascending order otherwise.
> > 
> > Hope this helps, please ask if you want to know more, and sorry if I'm
> > teaching grandmother to suck eggs with too much detail.
> 
> Works like a charm, perfect, thanks. And yes, I know what a diff/patch
> file is ;-)
> 
Excellent, glad to be of help.

-- 
Chris Green
___
PhotoFloat mailing list
PhotoFloat@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/photofloat


Re: Bug/crash due to date comparison

2017-01-10 Thread Chris Green
On Tue, Jan 10, 2017 at 11:07:52AM +0100, Martin Kos wrote:
> On 09.01.2017 10:57, Chris Green wrote:
> > To get the ordering I want I have simply changed the __cmp__
> > functions in PhotoAlbum.py to compare filename/path name rather than
> > date.  My images are named sequentially (e.g. the tenth slide film I
> > took in 1974 has images named p1974_10_01.jpg to p1974_10_36.jpg) so
> > this works as I want.  Not all the file dates, nor the EXIF dates
> > reflect the actual image date and anyway, in some cases, I don't know
> > the actual date.
> 
> Chris, I would be interested in that "patch" too. (or even as command
> line option). I have my files named similiarly, and in most cases the
> EXIF date & file timestamp are set by jhead, but in some cases, and
> especially for folders, the timestamps are wrong, but the folder name
> would sort it the right way.
> 
> > Lovely program, I ran it against my whole images tree (30k images) 
> > yesterday and eveything is just as I want.
> 
> I like photofloat very much too and would like too see it evolve and
> e.g. be used for NextCloud photo gallery (or at least the simple but
> efficient concept with the json/javascript/single html page).
> 
The changes required are trivial:-

chris@esprimo$ git diff PhotoAlbum.py
diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py
index 372ef32..3c620bf 100644
--- a/scanner/PhotoAlbum.py
+++ b/scanner/PhotoAlbum.py
@@ -39,7 +39,7 @@ class Album(object):
return self._photos[-1].date
return max(self._photos[-1].date, self._albums[-1].date)
def __cmp__(self, other):
-   return cmp(self.date, other.date)
+   return cmp(other.path, self.path)
def add_photo(self, photo):
self._photos.append(photo)
self._photos_sorted = False
@@ -326,10 +326,10 @@ class Photo(object):
return correct_date

def __cmp__(self, other):
-   date_compare = cmp(self.date, other.date)
-   if date_compare == 0:
+   # date_compare = cmp(self.date, other.date)
+   # if date_compare == 0:
return cmp(self.name, other.name)
-   return date_compare
+   # return date_compare
@property
def attributes(self):
return self._attributes


Delete the lines with - by them, add the lines with + (obviously the
commented out lines starting with # can just be deleted if you want).
The first block of changes is for albums, the second block for image
files, so you might just want to do the first single line change.

Note that I have reversed the 'other' and 'self', I couldn't get the
albums in ascending order otherwise.

Hope this helps, please ask if you want to know more, and sorry if I'm
teaching grandmother to suck eggs with too much detail.


-- 
Chris Green
___
PhotoFloat mailing list
PhotoFloat@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/photofloat


Re: Bug/crash due to date comparison

2017-01-09 Thread Joachim Tingvold

On 8 Jan 2017, at 14:06, Chris Green wrote:
No need, the new/patched version at 
http://git.jocke.no/photofloat/?h=patches

fixes the problem, sorry for the noise!  :-)


I believe this was fixed in the stock version (which is incorporated in 
the ‘patches’-branch you used above).


--
Joachim
___
PhotoFloat mailing list
PhotoFloat@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/photofloat