[openlp-dev] OpenLP service file issues
Tomas Groth
second at tgc.dk
Mon Apr 2 16:15:28 EDT 2018
Hi all,
While looking into bug #1677037 (Powerpoint is slow to load) and trying to
add thumbnails to the service files I noticed some issues in the way the
service files are currently handled.
To illustrate the issues let me provide a few examples:
**First issue - loss of path**
I add some images, media and presentations to the mediamanager from these
paths:
/home/tgc/1.png
/home/tgc/tmp/1.png
/home/tgc/testvideo.mp4
/home/tgc/tmp/testvideo.mp4
/home/tgc/church-presentation.ppt
/home/tgc/tmp/church-presentation.ppt
I then add them to a service and saves it. In that file it is saved with
these paths:
home/tgc/1.png
home/tgc/tmp/1.png
home/tgc/testvideo.mp4
home/tgc/tmp/testvideo.mp4
home/tgc/church-presentation.ppt
home/tgc/tmp/church-presentation.ppt
But when the file is loaded again it is extracted without the paths in the
servicemanager folder, like this:
1.png
testvideo.mp4
church-presentation.ppt
Whoops! We lost half of the files!
The obvious fix seems to be to keep the path when extracting.
**Second issue - loss of drive**
I add 2 media files to a service while on Windows:
C:\Church\testvideo.mp4
D:\Church\testvideo.mp4
When the files are saved into a service-file where they are saved with
these paths:
Church\testvideo.mp4
Church\testvideo.mp4
Whoops! We lost the drive! So when extracting the files one will be
overwritted - paths or not.
A solution could be to prepend the drive as a folder, like this:
C\Church\testvideo.mp4
D\Church\testvideo.mp4
**Third issue - case sensitivity**
I add 2 media files to a service while on Linux:
/home/tgc/Testvideo.mp4
/home/tgc/testvideo.mp4
When the files are saved into a service-file where they are saved with
these paths:
home/tgc/Testvideo.mp4
home/tgc/testvideo.mp4
I then copy the file to a Windows box and open the file, but since Windows
is case insensitive, then one of the files will be overwritten when
extracted.
A solution could be to append a number to a file if potential clash is
detected, like this:
home/tgc/Testvideo.mp4
home/tgc/testvideo-2.mp4
So, in conclusion, our current service files loses the filepath and drives
and doesn't handle switching case sensitivity. While I admit that these
example are not some that are likely to occur very often (if at all), but I
still think we need to improve it. While it should be fairly simple to
implementing the fixes mentioned above, the question is if there is more
yet unknown issues... So maybe a new approach is needed, like the one
outlined below...
**Proposal for new service file format**
When we add a file to a service file, instead of adding it with its name,
we should rename it so its name reflects the sha256 checksum of the
filecontent. So is a file is called "church-presentation.ppt" it is saved
as "505911856c191c5a7c4a0dc4858a8627e21b7171a1d9189bd8bb39090eac982f.ppt",
and no path/folders will be included. The new filename will also be added
to the service-item data. Doing this will avoid any problems with paths,
and if any files has the same hash it will be because they are the same, so
no duplicate content.
Avoiding folders from included files also allow us to use folders for
something else, namely thumbnails (for presentations). So reusing the the
example above, we could create a folder in the servicefile named
"505911856c191c5a7c4a0dc4858a8627e21b7171a1d9189bd8bb39090eac982f" which
contains all the thumbnails (and slide notes and titles), which can then be
reused when loading the servicefile, thereby skipping the step of
recreating the thumbnails (and thereby fixing bug #1677037).
Any thought, ideas, comments?
Best regards,
Tomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openlp.io/pipermail/openlp-dev/attachments/20180402/7aee01ff/attachment.html>
More information about the openlp-dev
mailing list