Updated VOD Thumbnailer, added icon gen logic
This commit is contained in:
@@ -145,7 +145,6 @@ class Controller_Data:
|
||||
|
||||
|
||||
selected_files = state.icon_grid.get_selected_items()
|
||||
# if self.selected_files:
|
||||
if selected_files:
|
||||
state.selected_files = self.format_to_uris(state.store, state.wid, state.tid, selected_files, True)
|
||||
|
||||
|
@@ -147,7 +147,7 @@ class WindowMixin(TabMixin):
|
||||
ctx.remove_class("notebook-unselected-focus")
|
||||
ctx.add_class("notebook-selected-focus")
|
||||
|
||||
self.window.set_title(f"SolarFM ~ {dir}")
|
||||
self.window.set_title(f"{app_name} ~ {dir}")
|
||||
self.set_bottom_labels(tab)
|
||||
|
||||
def set_path_text(self, wid, tid):
|
||||
|
@@ -30,7 +30,7 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
||||
if file.lower().endswith(self.fvideos): # Video icon
|
||||
thumbnl = self.create_thumbnail(dir, file)
|
||||
elif file.lower().endswith(self.fimages): # Image Icon
|
||||
thumbnl = self.create_scaled_image(full_path, self.video_icon_wh)
|
||||
thumbnl = self.create_scaled_image(full_path)
|
||||
elif full_path.lower().endswith( ('.desktop',) ): # .desktop file parsing
|
||||
thumbnl = self.parse_desktop_files(full_path)
|
||||
|
||||
@@ -38,13 +38,13 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
||||
except Exception as e:
|
||||
return None
|
||||
|
||||
def create_thumbnail(self, dir, file):
|
||||
def create_thumbnail(self, dir, file, scrub_percent = "65%"):
|
||||
full_path = f"{dir}/{file}"
|
||||
try:
|
||||
file_hash = hashlib.sha256(str.encode(full_path)).hexdigest()
|
||||
hash_img_pth = f"{self.ABS_THUMBS_PTH}/{file_hash}.jpg"
|
||||
if isfile(hash_img_pth) == False:
|
||||
self.generate_video_thumbnail(full_path, hash_img_pth)
|
||||
self.generate_video_thumbnail(full_path, hash_img_pth, scrub_percent)
|
||||
|
||||
thumbnl = self.create_scaled_image(hash_img_pth, self.video_icon_wh)
|
||||
if thumbnl == None: # If no icon whatsoever, return internal default
|
||||
@@ -57,7 +57,10 @@ class Icon(DesktopIconMixin, VideoIconMixin):
|
||||
return GdkPixbuf.Pixbuf.new_from_file(f"{self.DEFAULT_ICONS}/video.png")
|
||||
|
||||
|
||||
def create_scaled_image(self, path, wxh):
|
||||
def create_scaled_image(self, path, wxh = None):
|
||||
if not wxh:
|
||||
wxh = self.video_icon_wh
|
||||
|
||||
try:
|
||||
if path.lower().endswith(".gif"):
|
||||
return GdkPixbuf.PixbufAnimation.new_from_file(path) \
|
||||
|
@@ -7,9 +7,9 @@ import subprocess
|
||||
|
||||
|
||||
class VideoIconMixin:
|
||||
def generate_video_thumbnail(self, full_path, hash_img_pth):
|
||||
def generate_video_thumbnail(self, full_path, hash_img_pth, scrub_percent = "65%"):
|
||||
try:
|
||||
proc = subprocess.Popen([self.FFMPG_THUMBNLR, "-t", "65%", "-s", "300", "-c", "jpg", "-i", full_path, "-o", hash_img_pth])
|
||||
proc = subprocess.Popen([self.FFMPG_THUMBNLR, "-t", scrub_percent, "-s", "300", "-c", "jpg", "-i", full_path, "-o", hash_img_pth])
|
||||
proc.wait()
|
||||
except Exception as e:
|
||||
self.logger.debug(repr(e))
|
||||
|
Reference in New Issue
Block a user