Thread: [Solved] Folder watcher does not work
View Single Post
  #4  
Old 28.11.2020, 12:57
Amiganer Amiganer is offline
JD Beta
 
Join Date: Mar 2019
Posts: 59
Default

Example file (I think you will have a short one ):
Code:
chunks=0
autoConfirm=true
autoStart=true
deepAnalyseEnabled=true
enabled=true
extractAfterDownload=true
forcedStart=true
packageName=XXXGames_SERENITY CIRCLE
text=**External links are only visible to Support Staff**
A small helper in Python for now. start it in the directory, where are your ".crawljobs" in and it will give you a "save.txt"-File you can add the links manuelly:
Code:
#! python3
#
import os
#
#
ROOT = os.path.abspath(os.path.dirname(__file__))
#
#
def walk_files(dirpathname :str, recursive=False):
    """ walk on Disk, Only yield Files """
    
    for item in os.listdir(dirpathname):
        entry = os.path.join(dirpathname, item)
        if os.path.isfile(entry):
            yield entry
        elif recursive:
            yield from walk_files(entry, True)

def main(savefilename):
    linklist = dict()
    package = ""
    for filename in walk_files(ROOT):
        if "crawljob" in filename:
            with open(filename, "rt", encoding="utf-8") as readfp:
                for line in readfp:
                    if "packageName=" in line:
                        package = line.replace("\n", "").replace("packageName=", "").strip()
                        linklist[package] = list()
                    if "text=" in line:
                        linklist[package].append(line.replace("text=", ""))
                        
    with open(savefilename, "wt", encoding="utf-8") as writefp:
        for key, value in linklist.items():
            string = ""
            for line in value:
                string += "\n"+line
            writefp.write(key+string+"\n")
            
if __name__=='__main__':
    main(os.path.join(ROOT, "save.txt"))
Hope, that helps for awhile.

Bye, Christian

Last edited by Amiganer; 28.11.2020 at 13:08.
Reply With Quote