Add auto search for thumbnail based on .png in addition to .jpg and .jpeg

This commit is contained in:
LecygneNoir 2021-04-10 11:40:27 +02:00
parent 2f7629ef1e
commit 0a53e77bd6
2 changed files with 6 additions and 3 deletions

View file

@ -12,7 +12,7 @@ Usage:
prismedia --version prismedia --version
Options: Options:
-f, --file=STRING Path to the video file to upload in mp4. This is the only mandatory option. -f, --file=STRING Path to the video file to upload. This is the only mandatory option.
--name=NAME Name of the video to upload. (default to video filename) --name=NAME Name of the video to upload. (default to video filename)
-d, --description=STRING Description of the video. (default: default description) -d, --description=STRING Description of the video. (default: default description)
-t, --tags=STRING Tags for the video. comma separated. -t, --tags=STRING Tags for the video. comma separated.
@ -40,8 +40,7 @@ Options:
DATE should be in the past DATE should be in the past
--auto-originalDate Automatically use the file modification time as original date --auto-originalDate Automatically use the file modification time as original date
--thumbnail=STRING Path to a file to use as a thumbnail for the video. --thumbnail=STRING Path to a file to use as a thumbnail for the video.
Supported types are jpg and jpeg. By default, prismedia search for an image based on video name followed by .jpg, .jpeg or .png
By default, prismedia search for an image based on video name followed by .jpg or .jpeg
--channel=STRING Set the channel to use for the video (Peertube only) --channel=STRING Set the channel to use for the video (Peertube only)
If the channel is not found, spawn an error except if --channelCreate is set. If the channel is not found, spawn an error except if --channelCreate is set.
--channelCreate Create the channel if not exists. (Peertube only, default do not create) --channelCreate Create the channel if not exists. (Peertube only, default do not create)

View file

@ -126,6 +126,8 @@ def searchThumbnail(options):
options['--thumbnail'] = video_directory + options.get('--name') + ".jpg" options['--thumbnail'] = video_directory + options.get('--name') + ".jpg"
elif isfile(video_directory + options.get('--name') + ".jpeg"): elif isfile(video_directory + options.get('--name') + ".jpeg"):
options['--thumbnail'] = video_directory + options.get('--name') + ".jpeg" options['--thumbnail'] = video_directory + options.get('--name') + ".jpeg"
elif isfile(video_directory + options.get('--name') + ".png"):
options['--thumbnail'] = video_directory + options.get('--name') + ".png"
# Then, if we still not have thumbnail, check for thumbnail based on videofile name # Then, if we still not have thumbnail, check for thumbnail based on videofile name
if not options.get('--thumbnail'): if not options.get('--thumbnail'):
video_file = splitext(basename(options.get('--file')))[0] video_file = splitext(basename(options.get('--file')))[0]
@ -133,6 +135,8 @@ def searchThumbnail(options):
options['--thumbnail'] = video_directory + video_file + ".jpg" options['--thumbnail'] = video_directory + video_file + ".jpg"
elif isfile(video_directory + video_file + ".jpeg"): elif isfile(video_directory + video_file + ".jpeg"):
options['--thumbnail'] = video_directory + video_file + ".jpeg" options['--thumbnail'] = video_directory + video_file + ".jpeg"
elif isfile(video_directory + video_file + ".png"):
options['--thumbnail'] = video_directory + video_file + ".png"
# Display some info after research # Display some info after research
if not options.get('--thumbnail'): if not options.get('--thumbnail'):