Open derneuere opened 3 years ago
This should be a pretty trivial fix right? All we have to do is change a few lines of code in directory_watcher.py. Currently the function isValidNCMedia
reads:
def isValidNCMedia(file_obj):
file_attr = file_obj.attributes
filetype = file_attr.get("{DAV:}getcontenttype", "")
try:
return (
"jpeg" in filetype
or "png" in filetype
or "bmp" in filetype
or "gif" in filetype
or "heic" in filetype
or "heif" in filetype
)
except Exception:
util.logger.exception("An image throwed an exception")
return False
This could be changed to something like:
def isValidNCMedia(file_obj):
...
return (
"jpeg" in filetype
or "png" in filetype
or "bmp" in filetype
or "gif" in filetype
or "heic" in filetype
or "heif" in filetype
or "mov" in filetype
or "mp4" in filetype
)
...
Am I missing something here?
Yes, that would be an option, but there are more video formats. We solved that with magic, a python package here:
If you want that functionality now, you could open a pull request with a temporary solution by adding more file extensions.
I would then still be keeping this issue open. I think there must be some kind of API to get some information if it is a video in general, but I hadn't time to investigate it yet.
Hi. I actually added some additional file types to directory_watcher.py as a temporary solution and it worked. The videos also play while hovering over the thumbnail with the mouse but when clicking on them for full playback, audio is played but no video image is shown: Those thumbnail_big 404 error in the console appear when clicking on the videos for full playback.
Note 1: It might be related to https://github.com/LibrePhotos/librephotos/issues/379 but I'm not completely sure about it... Note 2: And yes, as test I did enable "Always transcode videos" and it worked but makes the whole thing slow, specially with long videos, so not sure whether that "experimental"? solution is meant as permanent...
Any idea/hint where to look next? Could this be a frontend issue? Thanks!
The issue is that you have x265 encoded videos. No browser handles this natively. On demand transcoding is still experimental as I haven't had the time to implement it properly yet.
Thanks for your quick reply! I will take a look at the experimental transcoding option because it seems to not work in Apple world, at least for Mac and iPad, and report back if I find something.
Just in case anyone else is looking for a work-around, it might be worth trying to mount the nextcloud photos directory directly to librephotos as mentioned in #55. This has a few benefits:
I haven't noticed any drawbacks from doing this yet, but perhaps there will be a performance hit (haven't noticed it yet).
That's a very interesting workaround, thanks for pointing it out as I had totally missed it in the issues search! Will most surely give it a try.
@sethgillett would you mind submitting a pull request for the temporary fix?
Yes, that would be an option, but there are more video formats. We solved that with magic, a python package here:
If you want that functionality now, you could open a pull request with a temporary solution by adding more file extensions.
I would then still be keeping this issue open. I think there must be some kind of API to get some information if it is a video in general, but I hadn't time to investigate it yet.
should we add the option of more file extensions, in case somebody scans a folder with other files (outside videos and photos) and then use Magic only for know video extensions? or is not making sense to do it that way?
Currently, the scan for Nextcloud only handles images. It should also include video files.