#2001
|
|||
|
|||
Quote:
|
#2002
|
|||
|
|||
Title bar would be fantastic as well. Can you do this please?
|
#2003
|
|||
|
|||
Quote:
Code:
/* Append next execution time to title bar */ var current = "|#TITLE|| - #SPEED/s|| - #UPDATENOTIFY|"; // Replace this with your current title pattern var date = new Date(Date.now() + interval).toString().substr(4, 20); var pattern = current + "|" + date; callAPI( "config", "set", "org.jdownloader.settings.GraphicalUserInterfaceSettings", null, "TitlePattern", pattern ) |
#2004
|
|||
|
|||
Quote:
|
#2005
|
|||
|
|||
Remove the relevant code from the script and manually restore the old name.
|
#2006
|
|||
|
|||
Quote:
Have a good day! |
#2007
|
|||
|
|||
Move only certain file types after extraction
Hi there and thanks for all the ideas around the EventScripter. I found this script somewhere above to move downloads after extraction,
Quote:
Many thanks for your support and ideas! KlaraBlik |
#2008
|
|||
|
|||
Quote:
Code:
/* Move extracted files Trigger: Archive extraction finished */ var source = "C:\\Downloads"; var destination = "C:\\Finished"; var fileTypes = ["mp3", "ex1", "ex2"]; archive.extractedFilePaths.forEach(function(filePath) { if (fileTypes.indexOf(filePath.extension) > -1) { var newFolder = filePath.parent.toString().replace(source, destination); filePath.moveTo(newFolder); } }) |
#2009
|
|||
|
|||
@mgpai: Thank you so much for your fast answer, I will give it a try! Only one question left: Is there a event which covers both downloaded and extracted mp3-files or would you recommend two scripts (one to move downloaded files which were not zipped) and one to move extracted files?
|
#2010
|
|||
|
|||
Custom Bubble Notify?
Is there anyway, perhaps with scripting, to send any custom bubble notifications? I'd like to have a bubble notify with package/link name on link added to the link grabber. Although I didn't try, it looks like there is an advanced setting to show the filename when downloads are added, but I'm looking to have something like that when links are added to the link grabber instead like from the clipboard.
|
#2011
|
|||
|
|||
Quote:
Packagizer rule: Code:
if > file name contains > *.mp3 then set > download directory > c:\downloads\JDownloader\downloaded\mp3 then do > move to > c:\downloads\JDownloader\extracted\mp3 The example rule uses different folders for normal and extracted files. Same/single folder can also be used for both. |
#2012
|
||||
|
||||
@mrjjones: You could use 3rd party tools/support for your OS/mobile...and then use script to send noticiation to this app/tool/service which then shows the notification for you.
__________________
JD-Dev & Server-Admin |
#2013
|
|||
|
|||
I hope you don't mind if I add another question into the mix, I'm not sure yet if this thread is ok for that, or whether I should open a new thread for each? Things seem to mix up here very quickly, but anyway.. let's have the question now. o)
I have problems moving folders with FilePath.moveTo(), renameTo(), renamePath(). In the meantime I started to write my own functions to copy/move folder structures around, but is that recommended? Should the mentioned methods work for folders as well, even across drives? tia! o) |
#2014
|
||||
|
||||
@tb21: move only works if src and dest are on same drive/mountpoint.
__________________
JD-Dev & Server-Admin |
#2015
|
|||
|
|||
Quote:
If anyone else needs, for linux there is notify-send (install with: sudo apt install libnotify-bin) and use a JDownloader script like: Code:
var linkName = link.getName(); callSync("notify-send",linkName+""); |
#2016
|
|||
|
|||
Ok, not optimal and I would think it doesn't even work correctly for same mountpoints/drives when folders are involved, but anyway, enough reason for me to carry on with the custom functions, thank you! o)
btw: Is there a (better) reference somewhere for the mentioned methods? I started to test whether each method wants just path or fullpath (including name), but got exhausted quickly, since testing all the methods and how they work for files/folders, different parameters and same/different mountpoint is quite tedious. |
#2017
|
||||
|
||||
@mrjjones: You're welcome nice and easy solution
@tb21: I could not reproduce issues with moveTo when on same drive/mountpoint. renameTo(returns false/true) is the same as rename(returns null/new File object): full path to file/folder rename/moves the file/folder but does NOT auto create parent folder. fails if parent folder does not exist moveTo(returns true/false): full path to file/folder rename/moves the file/folder but does auto create parent folder if not exist yet renameName: change name only -> new name of file/folder only renamePath: change parent of file/folder -> full path of new parent folder, name of file/folder is the same
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 05.11.2021 at 19:07. |
#2018
|
|||
|
|||
renamePath() seems to expect path for me, as it puts FilePathObj into the folder-path given.
It kind of makes sense for renamePath(), but you say it expects full path, which would include a new name for the target folder, which I did not experience. Code:
// moves files across drives (into existing path only), not folders var r = testFoldObj.renamePath( /* path */ "D:\\lala"); Code:
// always == false, it just copies the folder without content and does not delete src folder var r = testFoldObj.moveTo( /* fullPath */ ); // always == false, fails completely for folders, does nothing, new fullpath or just new name both fail var r = testFoldObj.renameTo( /* fullPath */ ); // always == null, fails completely for folders var r = testFoldObj.renamePath( /* fullPath */ ); renameTo(), rename(), renamePath() and renameName() - I get the last one at least I think.. o) |
#2019
|
|||
|
|||
Let me add..
I mostly tried folders which contain subfolders (iirc).. If there are no know bugs and you are sure all this works es expected.. I won't start a fight o). I think I can get along with copying single items, rebuilding folder structure with mkdirs() and delete things afterwards if I want to turn a copy-operation into a move. I would have like to prevent unnecessary copy and disk space requirements for "same mountpoint" moves of course, but it's not a show stopper for me. |
#2020
|
||||
|
||||
@tb21: I've updated my post https://board.jdownloader.org/showpo...postcount=2017
Reason for newer methods is that the old methods follows File Java class while newer return different object and work differently (eg auto create parent folder) Maybe the commands fail because of missing parent folder?
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 05.11.2021 at 19:08. |
#2021
|
|||
|
|||
Ok, thank you, I think that could answer some of my questions, I will try some more. o) So the newer methods return null/object and create parents, is there any drawback using the new methods or any reason to still use the old ones?
EDIT: Found the source for some of the file/folder methods here, seems helpful to explore the differences: github.com/mirror/jdownloader/blob/master/src/org/jdownloader/extensions/eventscripter/sandboxobjects/FilePathSandbox.java Last edited by tb21; 05.11.2021 at 21:04. |
#2022
|
|||
|
|||
I am guessing you are trying to move the entire folder using a single 'moveTo' call, which is not possible using this method.
You will have to use folder.getChildren() to recursively access/move each object in the folder. Using this method I have been able move entire folders with folder structure intact, even across different drives. It will however leave empty folders behind in the source location, which can also be removed using the same script. Another option (perhaps easier one) is to use external programs (OS or 3rd party) in eventscripter to move it. |
#2023
|
|||
|
|||
Yes, thank you for confirming, after analyzing the linked source file it is clear..
There is no recursive copy/move support in any of these methods. I did the getChildren() thing and did some new methods to make this work, I think they turned out nicely, will provide them here when final testing is done. Using an external tool is an option, yes, but that would tie the script to specific OS variants unless you branch depending on OS (I saw you have methods to do that). There's another downside with external tools though, in case things go wrong, it's much harder to get down to the problem (needs analyzing of std-err output or something?!). I am quite fine with the built in methods, the only thing I miss is being able to re-set the "modified" and "created" timestamps for copied/moved files. Losing timestamps is a severe disadvantage here. There is FilePath.getModifiedDate() already.. Who must I pay to add setModifiedDate(), getCreatedDate(), setCreatedDate()? To get fully working OS independent, recursive copy and move without losing timestamps? o) |
#2024
|
|||
|
|||
callSync with parameters
Does anyone know how to pass along parameters with callSync? I'm trying to send notifications with "notify-send" in ubuntu like:
Code:
callSync("notify-send","some text"); and that works fine, but if I want to add an icon, like with "-i battery" to the notify-send command, it does nothing. I tried many combinations with no luck. Thanks for any advice. |
#2025
|
|||
|
|||
Code:
callSync("notify-send", "some text", "-i", "battery"); |
#2026
|
|||
|
|||
Quote:
I use this script in the event scripter: Code:
var script = '/REDACTED/jdownloader-postprocess.sh' var package = archive.getDownloadLinks() ? archive.getDownloadLinks()[0].getPackage() : null var links = package ? package.getDownloadLinks() : [] function isReallyFinished() { for (var i = 0; i < links.length; i++) { if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) { return false } } return true } if (package && isReallyFinished()) { var command = [script, Extraction.customextractionpath(), package.getName(), package.getComment() ? package.getComment() : 'N/A', 'ARCHIVE_EXTRACTED'] log(command) log(callSync(command)) } |
#2027
|
|||
|
|||
Since I cannot access your screenshot, I cannot also know the exact error you are getting. But, the following method used in the script is invalid:
Code:
Extraction.customextractionpath() Try replacing it with: Code:
archive.getExtractToFolder(); |
#2028
|
|||
|
|||
Quote:
Note for the mod: When will my account be unlocked for "more" freely usage? |
#2029
|
|||
|
|||
@mgpai thank you very much. It seems so obvious now to split the -i and battery which is something I didn't try. Ugh.
|
#2030
|
||||
|
||||
@mrjjones
yes for some reason you cant have any spaces between switches and/or user defined section, must be all separated. @Gbyte unfortunately it has nothing todo with your account type, every user can post images/urls/etc but can not be viewed by anyone but moderators/admins. This is due to security/privacy concerns.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#2031
|
|||
|
|||
Quote:
|
#2032
|
|||
|
|||
Quote:
Code:
/* Interval > Add urls Trigger : Interval (Recommended 3600000 or more) */ var file = "Downloads/.torrent files/JDL Sync.txt"; // <- Set path to text file try { var links = readFile(getPath(file)); callAPI("linkgrabberv2", "addLinks", { links: links }) } catch (e) { alert(e.message); }; Pleas note, JD should be running for a longer period than the interval specified for it to be triggered. |
#2033
|
|||
|
|||
Hey!
Maybe you can help me, im new to this scripting stuff. I'm trying to write a script, to always have a specific amount of time between two reconnects. I have one script "after each reconnect" which should safe the current time. Another script "before each reconnect" which checks, if the time since the last reconnect is < x, and if not it waits until its < x (e.g. 90s). Now my problem: I cant access the variable from the first script in the second one. How can I make this global? I read that its global in Javascript, if its not inside a function. It isnt, its just now = new Date() Sorry, I'm really a total new to this... |
#2034
|
|||
|
|||
Quote:
Code:
/* After a reconnect */ setProperty("lastReconnectTime", Date.now(), true); Code:
/* Before a reconnect */ var lastReconnectTime = getProperty("lastReconnectTime", true); |
#2035
|
|||
|
|||
Site Specific Script
hi, Thanks for the great software!
(1)Pass through the link grabber. There is always a URL to download. I tried, but dont work.. -- var host = "myhost.com"; var myString = myDownloadLink.getDownloadHost(); startDownloads(); -- (2)Unzip after downloading only the specified URL Now everything is unzip after download. I found a script that does batch processing after unzipping. tnx:) callAsync(function(){},"cmd","/c","c:/myFolder/myBatch.bat"); |
#2036
|
|||
|
|||
Are both scripts not working? Can you explain in detail what do you want the script to do or post your script here?
|
#2037
|
|||
|
|||
sorry,, I am looking for two scripts.
|
#2038
|
|||
|
|||
I will need more info. Contact me in IRC:
Code:
kiwiirc.com/nextclient/irc.libera.chat/#jdownloader |
#2039
|
|||
|
|||
Thank you for your help Mr Script Master!
|
#2040
|
|||
|
|||
Quote:
|
Thread Tools | |
Display Modes | |
|
|