Fixed weird iterator error
This commit is contained in:
parent
38aaaaef7e
commit
68b22b7401
@ -1,3 +1,9 @@
|
|||||||
|
# Python imports
|
||||||
|
import os, threading, time
|
||||||
|
from os.path import isdir, isfile, join
|
||||||
|
from os import listdir
|
||||||
|
|
||||||
|
|
||||||
# Gtk imports
|
# Gtk imports
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
@ -8,10 +14,6 @@ from gi.repository import Gdk as gdk
|
|||||||
from gi.repository import GLib as glib
|
from gi.repository import GLib as glib
|
||||||
from gi.repository import GdkPixbuf
|
from gi.repository import GdkPixbuf
|
||||||
|
|
||||||
# Python imports
|
|
||||||
import os, threading, time
|
|
||||||
from os.path import isdir, isfile, join
|
|
||||||
from os import listdir
|
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from .Icon import Icon
|
from .Icon import Icon
|
||||||
@ -48,6 +50,7 @@ class Grid:
|
|||||||
self.grid.connect("button_release_event", self.iconSingleClick, (self.grid,))
|
self.grid.connect("button_release_event", self.iconSingleClick, (self.grid,))
|
||||||
|
|
||||||
def setNewDirectory(self, path):
|
def setNewDirectory(self, path):
|
||||||
|
self.store.clear()
|
||||||
self.currentPath = path
|
self.currentPath = path
|
||||||
dirPaths = ['.', '..']
|
dirPaths = ['.', '..']
|
||||||
vids = []
|
vids = []
|
||||||
@ -99,7 +102,7 @@ class Grid:
|
|||||||
|
|
||||||
# Wait till we have a proper index...
|
# Wait till we have a proper index...
|
||||||
while len(self.store) < (start + 1):
|
while len(self.store) < (start + 1):
|
||||||
time.sleep(.200)
|
time.sleep(.800)
|
||||||
|
|
||||||
i = start
|
i = start
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -108,14 +111,12 @@ class Grid:
|
|||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def updateGrid(self, model, dirPath, file, i):
|
def updateGrid(self, model, dirPath, file, i):
|
||||||
# Sinking errors b/c too lazy to find why we get some invalid tree paths when starting..
|
|
||||||
# I really should take time to figure it out...buuuutttt....it's non-fatal. (For now.)
|
|
||||||
# Images don't seem to always load which is curious...
|
|
||||||
try:
|
try:
|
||||||
image = self.iconFactory.createThumbnail(dirPath, file).get_pixbuf()
|
image = self.iconFactory.createThumbnail(dirPath, file).get_pixbuf()
|
||||||
iter = model.get_iter_from_string(str(i))
|
iter = model.get_iter_from_string(str(i))
|
||||||
glib.idle_add(self.replaceInGrid, (iter, image,))
|
glib.idle_add(self.replaceInGrid, (iter, image,))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
# Errors seem to happen when fillVideoIcons index wait check is to low
|
||||||
print("widgets/Grid.py sinking errors on updateGrid method...")
|
print("widgets/Grid.py sinking errors on updateGrid method...")
|
||||||
|
|
||||||
def addToGrid(self, dataSet):
|
def addToGrid(self, dataSet):
|
||||||
@ -132,7 +133,6 @@ class Grid:
|
|||||||
fileName = model[item][1]
|
fileName = model[item][1]
|
||||||
dir = self.currentPath
|
dir = self.currentPath
|
||||||
file = dir + "/" + fileName
|
file = dir + "/" + fileName
|
||||||
self.store.clear()
|
|
||||||
|
|
||||||
if fileName == ".":
|
if fileName == ".":
|
||||||
self.setNewDirectory(dir)
|
self.setNewDirectory(dir)
|
||||||
|
@ -207,7 +207,7 @@ class Icon:
|
|||||||
# Get frame roughly 35% through video
|
# Get frame roughly 35% through video
|
||||||
grabTime = str( int( float( duration.split(".")[0] ) * 0.35) )
|
grabTime = str( int( float( duration.split(".")[0] ) * 0.35) )
|
||||||
command = ["ffmpeg", "-ss", grabTime, "-an", "-i", fullPath, "-s", "320x180", "-vframes", "1", hashImgPth]
|
command = ["ffmpeg", "-ss", grabTime, "-an", "-i", fullPath, "-s", "320x180", "-vframes", "1", hashImgPth]
|
||||||
proc = subprocess.Popen(command)
|
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Video thumbnail generation issue in thread:")
|
print("Video thumbnail generation issue in thread:")
|
||||||
|
Loading…
Reference in New Issue
Block a user