mirror of
https://github.com/Relintai/ytdl_link_gen.git
synced 2024-12-20 01:16:50 +01:00
Only wait if a channel download happened.
This commit is contained in:
parent
0c6cfd452a
commit
00470654f5
@ -651,6 +651,8 @@ class ChannelEntry:
|
|||||||
|
|
||||||
video_file_data = None
|
video_file_data = None
|
||||||
|
|
||||||
|
was_cached = False
|
||||||
|
|
||||||
|
|
||||||
def parse_config_line(self, l):
|
def parse_config_line(self, l):
|
||||||
#d = {
|
#d = {
|
||||||
@ -687,6 +689,8 @@ class ChannelEntry:
|
|||||||
#self.output_command_data_file = "result/" + self.category + "/dl.sh"
|
#self.output_command_data_file = "result/" + self.category + "/dl.sh"
|
||||||
self.output_command_data_file = "dl.sh"
|
self.output_command_data_file = "dl.sh"
|
||||||
|
|
||||||
|
self.was_cached = False
|
||||||
|
|
||||||
def load_data(self):
|
def load_data(self):
|
||||||
if not os.path.exists(self.data_file) or not os.path.isfile(self.data_file):
|
if not os.path.exists(self.data_file) or not os.path.isfile(self.data_file):
|
||||||
|
|
||||||
@ -738,6 +742,8 @@ class ChannelEntry:
|
|||||||
if exists(self.temp_data_file):
|
if exists(self.temp_data_file):
|
||||||
with open(self.temp_data_file) as f:
|
with open(self.temp_data_file) as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
|
self.was_cached = True
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -839,10 +845,13 @@ if command == "gen":
|
|||||||
ce.process()
|
ce.process()
|
||||||
ce.unload_data()
|
ce.unload_data()
|
||||||
|
|
||||||
|
if not ce.was_cached:
|
||||||
|
# TODO make this customizable from the command line
|
||||||
|
sleep_range(10, 5)
|
||||||
|
|
||||||
ce = None
|
ce = None
|
||||||
|
|
||||||
collected = gc.collect()
|
collected = gc.collect()
|
||||||
print("Garbage collector: collected", "%d objects." % collected)
|
print("Garbage collector: collected", "%d objects." % collected)
|
||||||
|
|
||||||
# TODO make this customizable from the commadn line
|
|
||||||
sleep_range(10, 5)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user