🐛
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import requests, imdb, discord, json, math, time, asyncio, os
|
import requests, imdb, discord, json, math, time, asyncio, os, concurrent.futures
|
||||||
from funcs import logThis
|
from funcs import logThis
|
||||||
|
|
||||||
radarrURL = "http://localhost:7878/api/v3/"
|
radarrURL = "http://localhost:7878/api/v3/"
|
||||||
@@ -7,11 +7,7 @@ qbittorrentURL = "http://localhost:1340/api/v2/"
|
|||||||
moviePath = "/media/plex/Server/movies/"
|
moviePath = "/media/plex/Server/movies/"
|
||||||
showPath = "/media/plex/Server/Shows/"
|
showPath = "/media/plex/Server/Shows/"
|
||||||
|
|
||||||
async def fileSize(fp):
|
def getSize(startPath,pathLength):
|
||||||
print(fp[:60],end="\r")
|
|
||||||
return os.path.getsize(fp)
|
|
||||||
|
|
||||||
async def getSize(startPath,pathLength):
|
|
||||||
logThis("Getting the size of "+startPath)
|
logThis("Getting the size of "+startPath)
|
||||||
totalSize = 0
|
totalSize = 0
|
||||||
for dirpath, dirnames, filenames in os.walk(startPath):
|
for dirpath, dirnames, filenames in os.walk(startPath):
|
||||||
@@ -19,10 +15,12 @@ async def getSize(startPath,pathLength):
|
|||||||
fp = os.path.join(dirpath, f)
|
fp = os.path.join(dirpath, f)
|
||||||
# skip if it is symbolic link
|
# skip if it is symbolic link
|
||||||
if not os.path.islink(fp):
|
if not os.path.islink(fp):
|
||||||
totalSize += await fileSize(fp)
|
print(fp[:60],end="\r")
|
||||||
|
totalSize += os.path.getsize(fp)
|
||||||
|
|
||||||
return totalSize
|
return totalSize
|
||||||
|
|
||||||
|
|
||||||
async def formatSize(size):
|
async def formatSize(size):
|
||||||
if size >= 1024**4:
|
if size >= 1024**4:
|
||||||
return ("%.1f" % (size/(1024**4))) + "TB"
|
return ("%.1f" % (size/(1024**4))) + "TB"
|
||||||
@@ -289,7 +287,9 @@ class BedreNetflix():
|
|||||||
if os.path.isfile(fp):
|
if os.path.isfile(fp):
|
||||||
size = os.path.getsize(fp)
|
size = os.path.getsize(fp)
|
||||||
else:
|
else:
|
||||||
size = await getSize(fp,pathLength)
|
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||||
|
future = executor.submit(getSize,fp,pathLength)
|
||||||
|
size = future.result()
|
||||||
directories.append((str(f),size))
|
directories.append((str(f),size))
|
||||||
directories.sort(key=lambda tup: tup[1])
|
directories.sort(key=lambda tup: tup[1])
|
||||||
directories.reverse()
|
directories.reverse()
|
||||||
|
|||||||
Reference in New Issue
Block a user