JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #2001  
Old 04.11.2021, 16:44
reddy.shyam reddy.shyam is offline
Mega Loader
 
Join Date: Aug 2013
Posts: 69
Default

Quote:
Originally Posted by mgpai View Post
It is currently configured to append the next execution time to the script name. Each time it is executed, the next execution time will be appended to the script name in the eventscripter panel.

If your current script name is reddy.shyam (you have to set the current name in the script), it will be renamed to reddy.shyam | Next execution: Nov 04 2021 15:46:59.
Hi @mgpai, yes, I see this, pretty neat actually. Just that I will have to goto setting each time to check the next trigger time. You guys have made us so lazy already that everything is a big task for us.
Reply With Quote
  #2002  
Old 04.11.2021, 16:45
reddy.shyam reddy.shyam is offline
Mega Loader
 
Join Date: Aug 2013
Posts: 69
Default

Quote:
Originally Posted by mgpai View Post
You will have to wait for Jiaz to implement it. I can provide a script which can append it to the title bar.
Title bar would be fantastic as well. Can you do this please?
Reply With Quote
  #2003  
Old 04.11.2021, 16:51
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,379
Default

Quote:
Originally Posted by reddy.shyam View Post
Title bar would be fantastic as well. Can you do this please?
Add this code at the end of the existing script:
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
)
Reply With Quote
  #2004  
Old 04.11.2021, 17:13
reddy.shyam reddy.shyam is offline
Mega Loader
 
Join Date: Aug 2013
Posts: 69
Default

Quote:
Originally Posted by mgpai View Post
Add this code at the end of the existing script:
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
)
Super, thanks again @mgpai. What if I dont want this on script window anymore?
Reply With Quote
  #2005  
Old 04.11.2021, 17:18
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,379
Default

Quote:
Originally Posted by reddy.shyam View Post
What if I dont want this on script window anymore?
Remove the relevant code from the script and manually restore the old name.
Reply With Quote
  #2006  
Old 04.11.2021, 17:22
reddy.shyam reddy.shyam is offline
Mega Loader
 
Join Date: Aug 2013
Posts: 69
Default

Quote:
Originally Posted by mgpai View Post
Remove **External links are only visible to Support Staff**... from the script and manually restore the old name.
Thanks @mgpai. You are super awesome! Appreciate your time and help.

Have a good day!
Reply With Quote
  #2007  
Old 04.11.2021, 18:18
KlaraBlik KlaraBlik is offline
I will play nice!
 
Join Date: Jun 2020
Posts: 2
Default 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:
Originally Posted by mgpai View Post
Code:
/*
    Move extracted files
    Trigger: Archive extraction finished
*/

var source = "c:\\downloading";
var destination = "d:\\finished";

archive.extractedFilePaths.forEach(function(filePath) {
    var newFolder = filePath.parent.toString().replace(source,destination);
    filePath.moveTo(newFolder);
})
but I would like to move only certain file types (e.g. .mp3) after successful extraction to a new folder. How do I have to amend this script?

Many thanks for your support and ideas!

KlaraBlik
Reply With Quote
  #2008  
Old 05.11.2021, 06:17
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,379
Default

Quote:
Originally Posted by KlaraBlik View Post
... I would like to move only certain file types (e.g. .mp3) after successful extraction to a new folder. How do I have to amend this script?
This script will preserver folder structure. To move all the files to a single folder you can also just use a packagizer rule.

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);
    }
})
Reply With Quote
  #2009  
Old 05.11.2021, 09:36
KlaraBlik KlaraBlik is offline
I will play nice!
 
Join Date: Jun 2020
Posts: 2
Default

@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?
Reply With Quote
  #2010  
Old 05.11.2021, 11:27
mrjjones mrjjones is offline
Junior Loader
 
Join Date: Nov 2021
Posts: 14
Post 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.
Reply With Quote
  #2011  
Old 05.11.2021, 13:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,379
Default

Quote:
Originally Posted by KlaraBlik View Post
@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?
Extraction is post download, so they are 2 different events. You will have use 2 different scripts, or a single packagizer rule.

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.
Reply With Quote
  #2012  
Old 05.11.2021, 14:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 73,503
Default

@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
Reply With Quote
  #2013  
Old 05.11.2021, 14:47
tb21 tb21 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 11
Default

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)
Reply With Quote
  #2014  
Old 05.11.2021, 15:21
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 73,503
Default

@tb21: move only works if src and dest are on same drive/mountpoint.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2015  
Old 05.11.2021, 15:50
mrjjones mrjjones is offline
Junior Loader
 
Join Date: Nov 2021
Posts: 14
Default

Quote:
Originally Posted by Jiaz View Post
@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.
@Jiaz, just the advice I was looking for. Thank you.

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+"");
Reply With Quote
  #2016  
Old 05.11.2021, 16:06
tb21 tb21 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 11
Default

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.
Reply With Quote
  #2017  
Old 05.11.2021, 16:44
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 73,503
Default

@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 20:07.
Reply With Quote
  #2018  
Old 05.11.2021, 19:06
tb21 tb21 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 11
Default

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");
These methods did not do so well with folders on my system (a Windows Server 2008 R2).
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 */ );
Not less interesting for me while tinkering, what's the actual difference between.. ?
renameTo(), rename(), renamePath() and renameName() - I get the last one at least I think.. o)
Reply With Quote
  #2019  
Old 05.11.2021, 19:16
tb21 tb21 is offline
Junior Loader
 
Join Date: Oct 2021
Posts: 11
Default

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.
Reply With Quote
  #2020  
Old 05.11.2021, 20:03
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 73,503
Default

@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 20:08.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 08:55.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.