-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export author in highlights and sticky notes #27
Conversation
Hi matteosecli, I haven't tested, but I think the only change needed is something like this in
and similar to the Would you like to give it a try and see that does what you want? |
Skip NULL strings when joining firstName and lastName of highlights authors. NULL fields appear sometimes, apparently if the local database was not synchronized; trying to join them blidly caused crashes.
Hi @Xunius, sorry for the (very) late reply; I was waiting for a friend of mine to help me carrying out some tests. I've set up a collaborative folder in Mendeley in order to test what happens when multiple people annotate the same document; I'll go step by step.
Yes, by 'author' I mean the Mendeley user that created the highlight, not the author of the article.
I have to say that I actually missed that! However, there are a couple of objections:
As a final note, I've realized that if |
Hi matteosecli, Many thanks for coming back and all the work. I've merged your PR #28. Thanks again for the contribution. |
By multiple attachment issue you are referring to #26, right? Anyway, for me it's ok either way! I don't know the extent of the new changes; I think this PR can wait until you commit all the new changes related to that issue and then see if has conflicts or not at that point. If it has conflicts which are better resolved by rewriting these changes from scratch and you think it would be more efficient for you to directly incorporate them, it's totally fine for me! Or if you don't have time I can make a new PR as well. 😉 So, I'd say to check back here once you commit those changes. In the meantime, I'm looking into something else – which I hope I can report in a new thread for a discussion as soon as I have some minimal working examples/data. |
This is re-implementing the changes suggested in this PR: #27 The author of the highlights and sticky notes are now retrieved and saved to exported pdfs In menotexport.py: getUserName() does a filtering before joining. getHighlights() queries "author" field, if empty, use user_name. Similar in getNotes(). In exportpdf.py: exportPdf() passes the new "author" argument.
Hi matteosecli I've implemented your suggested changes (with minor differences) and pushed. Here is what I did:
Would you like to give it a test and see it works as intended? |
Hi @Xunius, I've tested the latest I'll try to explain better, maybe I was a bit messy last time. What I was doing was the following:
So, your lines Lines 453 to 455 in 6a8ba45
always set myself as the author of every highlight. Instead the change I was proposing, i.e. the lines Lines 411 to 414 in fa6f644
set the name linked to the highlight's profileUuid as the correct author of the highlight. So
What do you think it would be better to do? If you don't want to rewrite these bits and you are not planning to do any incompatible changes, I can do these modifications, test them, and send them as a PR in the next few days. If instead you prefer to write directly the code, I'm always here to test anyways. 😉 |
I got your points now, because I never did co-authoring before so I thought that's why my I have some free time tomorrow, so how about me re-doing these changes as we understand each other quite well already, and I'll let you continue on the "Wrong coordinate ordering in "Rectangle Highlight"" fix (#29) as you have a much better understanding in that regard? |
That sounds totally fine for me! 😃 |
In menotexport.py getHighlights() and getNotes() funcs query 2 more columns: Profiles.firstName and Profiles.lastName for the author of highlights/notes. See #27 I didn't use the dictionary approach as no notable diff in speed.
I've noticed that, by opening an exported PDF file with a PDF reader, the
author
field was empty. So I looked into my Mendeley database and I've found that theauthor
field was empty, too; however, there was aprofileUuid
that links to profile information (& that doesn't seem to change even if you change your email address).I've added this information into the query to the database; the author is by default the
author
field in the database; however, if this field is empty, the author's name is constructed by merging thefirstName
andlastName
fields of the database.I've also added an
author
field to the highlights dictionary because it was completely missing, although the relevant functionpdfannotation.createHighlight()
already had all the things in place.I've tested the changes with my database and Mendeley 1.18, although I don't know whether these fields were present or not in much older versions of Mendeley's databases (imho I don't think so, because an account was required even for much older versions; I've checked on Mendeley 1.17.11 and they are there).
I'm not a Python or even more a SQL expert (never used SQL in my life), so I apologize in advance for any mistakes!
PS: The ordering of the new fields looks a bit random, but it's just because I've tried to change the code as little as possible.