#1321
|
|||
|
|||
Sorry, but I am not able to understand what you are trying to achieve with the script.
|
#1322
|
|||
|
|||
Dear mgpai,
for quite a while now I am using the script you generously wrote for my use-case. It allows me to play finished AND also partially downloaded files via the context menu. It works really great! I would not want to miss it anymore. :-) Now there is one little thing, which would make it even more convenient in my eyes. If this script would not just work on the file itself ... but already on its folder. (So the folder would not have to be opened before playing the file.) Say dear mgpai ... could you extend the original script and add this feature? Or is this too much of a hassle? This is the original script: Code:
// Open finished or partially download file for the selected download link // Trigger: Downloadlist Contextmenu Button Pressed // Customize download list context menu > Add a new "Eventscripter Trigger" button > Rename it to "[Script] Open file" (without quotes) > Change Icon (Optional) if (name == "[Script] Open file") { var link = dlSelection.getContextLink(); if (link) { var player = "/videolan/vlc/vlc"; // <- Set path to media player var file = getPath(link.getDownloadPath()); if (file.exists()) { callAsync(null, player, file); } else { var partFile = getPath(file + ".part"); if (partFile.exists()) { callAsync(null, player, partFile); } } } } |
#1323
|
|||
|
|||
Code:
// Open selected folder in media player // Trigger: Downloadlist Contextmenu Button Pressed // Customize download list context menu > Add a new "Eventscripter Trigger" button > Rename it to "[Script] Open folder" (without quotes) > Change Icon (Optional) if (name == "[Script] Open folder") { var package = dlSelection.getContextPackage(); if (package) { var player = "/videolan/vlc/vlc"; // <- Set path to media player var folder = getPath(package.getDownloadFolder()); callAsync(null, player, folder); } } |
#1324
|
|||
|
|||
Dear mgpai, ... thank you for your work!
I'm sorry ... I guess, I expressed myself misleading. (I'm German.) Now the new script is playing the whole download-folder. But I was looking for it to just play the files from the "package-folder" (If that is the right name for the folders in the JD-download-list containing one or more "links/files".) And also, I was looking for it to keep the old functionality too, so that it works/plays in all cases: 1. complete file or 2. incomplete file or 3. package-folder (with complete and incomplete files). If this is too complicated, please just say so! ... it is not all that important, would just be really nice ... ;-) |
#1325
|
|||
|
|||
Hello, thanks for the answer. Unfortunately I couldn't make it work with packagizer. But I am currently working on a bash script which I want to run with JDownloader.
I am using a function for the event scripter from you. **External links are only visible to Support Staff****External links are only visible to Support Staff** But my bash script will be executed twice. I can see that by simply echoing something in the bash script. How can I prevent this? Many thanks in advance. |
#1326
|
|||
|
|||
Hi mgapi,
I was redirected to here to ask if is there sany script which can help to prevent this? "We have blocked your account because our security systems have flagged your Pluralsight account for an unusual amount of activity. This means a high volume of requests have occurred every 10-30 seconds for a prolonged period of time. Please note that this high volume of activity is in violation of our terms of service" After I put about 10 link of learning paths and shortly after the linkgrabber started to extract the video links, it happened. Anything that can slow down the process? Many thanks in advance. Last edited by gerijani; 24.04.2020 at 14:34. |
#1327
|
|||
|
|||
I would still recommend using packagizer. You can find me in JD Chat if you need help with it.
Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader Quote:
|
#1328
|
|||
|
|||
Quote:
You can also try reducing the max. threads used by checker and crawler. Try setting both to 1. Advanced settings: Code:
LinkChecker.maxthreads LinkCrawler.maxthreads |
#1329
|
|||
|
|||
The script does not send the contents of the 'package', It only sends the download destination used by it. It is then up to the external program to load files from it. Hence, ff you are using the same download destination with other packages, they will be loaded too. As will be will any other files from that package, even if they are not currently on JD list.
Code:
// Open selected package // Trigger: Downloadlist Contextmenu Button Pressed // Customize download list context menu > Add a new "Eventscripter Trigger" button > Rename it to "[Script] Open package" (without quotes) > Change Icon (Optional) if (name == "[Script] Open package") { var package = dlSelection.getContextPackage(); if (package) { var player = "/videolan/vlc/vlc"; // <- Set path to media player var files = []; package.getDownloadLinks().filter(function(link) { return link.getBytesLoaded(); }).forEach(function(link) { var file = link.getDownloadPath(); file = link.isFinished() ? file : file + ".part"; files.push("\"" + file + "\""); }) if (files.length) callAsync(null, player, files.join(" ")); } } |
#1330
|
|||
|
|||
Dear mgpai,
thank you very much for your effort! Unfortunately I did not get your script to work. The player opens only if the script is triggered from a package ... but not if triggered from a single file. But the opened player does not play the file for unknown (to me) reasons. I managed to combine two of your earlier scripts for me (originally for separate purposes) ... and this comes pretty close: the player plays when triggered from a package and also when triggered from a single file. The only drawback: If the package contains more than one file, it opens many players (instead of putting them in a single playlist.) As a workaround: Can you give me a hint, how to exit the loop, when the first file to play has been found? (So the playlist won't be filled, but at least I don't have a ton of open players.) Code:
if (name == "Play") { var links = dlSelection.getLinks(); if (links.length) { links.forEach(function(link) { var player = "/usr/bin/smplayer"; // <- Set path to media player var file = getPath(link.getDownloadPath()); if (file.exists()) { callAsync(null, player, file); } else { var partFile = getPath(file + ".part"); if (partFile.exists()) { callAsync(null, player, partFile); } } }) } } |
#1331
|
|||
|
|||
As the button name suggests, it only opens a package content. It is not supposed to work on file selection. For that you you will have to use the old script. I have also tested it before posting, and made sure the files were correctly being played.
|
#1332
|
|||
|
|||
Ok, mgpai, thank you very much!
|
#1333
|
|||
|
|||
If it still does't work, find me in JD Chat.
Code:
kiwiirc.com/nextclient/irc.freenode.net/#jdownloader |
#1334
|
|||
|
|||
I need the script to work for both packages and files ... so I stick with my latest version (combined out of 2 of yours). Thank you, mgpai, very much!
|
#1335
|
|||
|
|||
Code:
// Open selected files // Trigger: Downloadlist Contextmenu Button Pressed // Customize download list context menu > Add a new "Eventscripter Trigger" button > Rename it to "[Script] Open files" (without quotes) > Change Icon (Optional) if (name == "[Script] Open files") { var player = "/videolan/vlc/vlc"; dlSelection.getLinks().filter(function(link) { return link.getBytesLoaded(); }).forEach(function(link) { var file = link.getDownloadPath(); file = link.isFinished() ? file : file + ".part"; callAsync(null, player, "--started-from-file", "--playlist-enqueue", file); }) } |
#1336
|
|||
|
|||
Thanks again for your help!
|
#1337
|
|||
|
|||
Data usage limit
Hi,
Can you make an event script to stop downloads when a predefined data limit is reached? E.g: I want downloading to stop when a limit of 20 GB is reached. I need it for all hosts with or without account, just an overall data limit for all sites. Thank you.. Last edited by sherif011; 28.04.2020 at 17:39. Reason: clarification |
#1338
|
||||
|
||||
@sherif011
Your post is missing information e.g.: - Do you mean a quota of an account or do you download without account? - For all hosts or only for a specified host? -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1339
|
|||
|
|||
Updated
|
#1340
|
|||
|
|||
Someone could tell me a scrip, to know the history or all the folders or links, of the download list, I accidentally deleted it, in cleaning disabled and it is urgent for me to recover them
|
#1341
|
||||
|
||||
@mgpai
Seems like this may have been a misunderstanding with user _comus_: https://board.jdownloader.org/showthread.php?t=21012 -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1342
|
|||
|
|||
I have lost my history and I want to recover it or one since I installed the jdonloader, it is indifferent to me, I just need, everything that has passed through the downloads tab
|
#1343
|
|||
|
|||
Is there a way to get this information
Spoiler:
getStatus() only show Finished. |
#1344
|
||||
|
||||
@_cosmus_: There is no such history. What exactly do you mean? Maybe I don't understand correct
@askin2u: At that moment that information is not available. What exactly do you want to achieve? Have in mind?
__________________
JD-Dev & Server-Admin |
#1345
|
|||
|
|||
Quote:
For a more accurate quota management, you may need to use a 3rd party program. Code:
// Stop downloads when target reached // Trigger: Interval (Recommended 60000 or more) if (isDownloadControllerRunning()) { var target = 20; // <- Set limit (in GB) var actual = 0; var t1 = new Date().setHours(0, 0, 0, 0); getAllDownloadLinks().filter(function(link) { var t2 = new Date(link.getFinishedDate()); return t2 > t1 }).forEach(function(link) { actual += link.getBytesLoaded(); }) if (actual / 1e9 > target) stopDownloads(); } |
#1346
|
|||
|
|||
Quote:
Can I set this limit for the current download session with no regards to previous downloads and not for specific time period? Last edited by sherif011; 01.05.2020 at 01:20. |
#1347
|
|||
|
|||
Quote:
just a little mod Code:
// Open selected files or files in packagename if (name == "VLC Player") { //if (name == "VLC Player - Add To Playlist") { newVlcIntance = true; //1-open new intance of vlc player | 0-add to existing intance of vlc player playSelectedFilesNow = true; //1-overwrite existence vlc player and start playing selected files | 0-add selected files to playlist var player = "C:/Program Files (x86)/VideoLAN/VLC/vlc.exe"; // <- Set path to media player var regex = /\.(part|mp4|mov|mkv|mpg|avi|flv|m4a|m4b|m4c|m4d|mp3|acc)$/ig; //only open file with these extensions dlSelection.getLinks().sort().filter(function(link) { return link.getBytesLoaded(); }).forEach(function(link) { var file = link.getDownloadPath(); var fileExt = link.getName().match(regex); var isExist = getPath(file).exists(); if (fileExt && isExist) { file = link.isFinished() ? file : file + fileExt; //!!!this might no longer be required if (!playSelectedFilesNow ) { callAsync(null, player, "--one-instance", "--playlist-enqueue", file); //add selected files to existance of vlc playlist //callAsync(null, player, "--started-from-file", "--playlist-enqueue", file); //add selected files to existance of vlc playlist } else { callAsync(null, player, "--one-instance", "--no-playlist-enqueue", file); //add and start selected files //callAsync(null, player, "--started-from-file", "--no-playlist-enqueue", file); //add and start selected files playSelectedFilesNow = false; } sleep(10); //ensure each file is added to playlist in its intended order (increase if required) //**External links are only visible to Support Staff** //??? can't figure out how to start a new instance of vlc then add the remaining selected files to playlist' //callAsync(null, player, "--no-started-from-file", "-playlist-enqueue", file); //WARNING: start each intance of vlc player for each selected file //callAsync(null, player, "--no-one-instance", "-playlist-enqueue", file); //WARNING: start each intance of vlc player for each selected file } }) } |
#1348
|
|||
|
|||
I'm currently trying to write a script that simply executes the following:
vlc --playlist-enqueue --fullscreen --one-instance --qt-continue=2 <filepath> so far I have this on a trigger of Package finished: var player = "vlc"; var file = getPath(link.getDownloadPath()); callAsync(null, player, file); this works, but doesn't pass the command line switches. how can I pass the command line switches? |
#1349
|
||||
|
||||
@markifi
believe each switch has to be wrapped between "", just how java ProcessBuilderFactory requires inputs. the javascript call is just wrapped into a Java command. there are some working examples above.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#1350
|
|||
|
|||
ID3 tags on MP3s from Youtube downloads
Hi all. I'm very new to this and it was recommended to me that I ask the question in this thread. I've used JD2 to download a series of music (.acc and .ogg) files from Youtube playlists so that I can load them into Traktor. The problem is that they won't load because they lack ID3 tags.
I have no real idea what I'm doing here; but might anyone be able to help with a script that could create those tags? A massive thanks for any advice here! |
#1351
|
||||
|
||||
hi mgpai
I have a question regarding THIS thread. To sum it up, this is what the user wants: - The ability to make JD NOT recognize same files (same name & size) as mirror - Maybe e.g. modify the filename of possible mirrors (e.g. add random numbers to end), maybe change it back to original once user e.g. removes all items except one from that package Any ideas? Do you maybe already have a similar script for something like this? This user wants to download mirrors at the same time so he can manually check which has the best downloadspeed --> Then download this -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1352
|
|||
|
|||
I use this ES script to make sure that everything from gog-games.com gets put into commonly formatted folders based on the game name.
Code:
// Set Package Name for gog-games.com downloads // Tigger Required: "Packagizer Hook" // Forum Topic: https://board.jdownloader.org/showthread.php?t=74182 var ln = link.getName(); //get the filename from the link //alert("ln", ln); // for debugging var newln = ln.replace(/^Plugin Defect\!/, ""); //remove 'Plugin Defect!' error //alert("newln", newln); // for debugging link.setName(newln); // update the filename // these lines strip prefixes off of the filename to be used in the package name var pkg = newln.replace(/^game-/, ""); //remove prefix pkg = pkg.replace(/^extras-/, ""); //remove prefix pkg = pkg.replace(/^patch-/, ""); //remove prefix pkg = pkg.replace(/^fix-/, ""); //remove prefix pkg = pkg.replace(/^other-/, ""); //remove prefix // these lines remove file extensions pkg = pkg.replace(/.rar$/, ""); //remove file extension pkg = pkg.replace(/.zip$/, ""); //remove file extension pkg = pkg.replace(/.7zip$/, ""); //remove file extension pkg = pkg.replace(/.7z$/, ""); //remove file extension // these lines do some additional cleanup pkg = pkg.replace(/\.part(\d+)/, "") //remove part# pkg = pkg.replace(/\./g, "_"); //replace . with _ //alert("pkg", pkg); //for debugging link.setPackageName(pkg); //set the package name to the cleaned up string |
#1353
|
|||
|
|||
Hello dear JDownloader Community,
I'm looking for a solution to run a simple script on Synology after each download is completed and unzipped (ON_ARCHIVE_EXTRACTED). Code:
synoindex -R video Synchronous execution would also be an advantage. Here I found something similar I don't know how such a script for my Synology (Linux) should look like. Does anyone know advice? |
#1354
|
|||
|
|||
Quote:
Quote:
Code:
var regex = /(?:^|game|extra|patch|fix|other)-(.*?)\.(?:^|.{2,4}|part\d{1,2}\..{2,4})$/ig; var pkgName = fileName.replace(regex, '$1'); var pkgName = pkgName.replace(/\./g, "_"); link.setPackageName(pkgName); |
#1355
|
|||
|
|||
Quote:
Code:
// Set Package Name for gog-games.com downloads // Tigger Required: "Packagizer Hook" // Forum Topic: https://board.jdownloader.org/showthread.php?t=74182 var hoster = link.getHost(); if (state == 'BEFORE') { // only file souce download from 'gog-games.com' if (hoster == 'gog-games.com') { //<--edit download sources as desired var newFileName = link.getName(); // only file names with these extensions var fileWithExt = /\.(rar|zip|7zip|7z)$/i; if (fileWithExt.test(newFileName)) { // AND only file names begin with var fileNameBegins = /(game|extra|patch|fix|other)-/i; if (fileNameBegins.test(newFileName)) { var regex = /(?:^|game|extra|patch|fix|other)-(.*?)\.(?:^|(?:part\d{1,2}\.)?.{2,4})$/i; var pkgName = newFileName.replace(regex, '$1'); var pkgName = pkgName.replace(/\./g, "_"); link.setPackageName(pkgName); } } } } Code:
// also available if (state == 'AFTER') { } |
#1356
|
|||
|
|||
Quote:
two scripts needed: 1st one Switch - allow to Reset and Restart loaded bytes session Plus set download limit 2nd one Main - monitor loaded bytes session until limit reached Code:
//1st // NOTE: A SWITCH FOR: Stop downloads when target reached // Get initial loaded bytes state and export initial bytes to txt file // functional: To Start AND/OR Reset and Restart Initial Loaded Bytes Count // also allow user to set Download Limit in GB for new session // Trigger: 3 Options: Downloadlist Contextmenu Button Pressed | Toolbar Button Pressed | Main Menu Button Pressed // ***NOTE: this will always Reset last session and Start a New Session //-------------------------------------------------------- disablePermissionChecks(); //no prompting persmision dialog //enablePermissionChecks(); //required prompting permision //-------------------------------------------------------- //setDisableOnException(true); // enable/disable script on error exceptions //setNotifyOnException(true); // true enable/false disable error notification on exceptions //-------------------------------------------------------- //setAdvancedAlert(true); beginLoadedBytesState = getPath(JD_HOME + '/tmp/_init_loaded_bytes_state.txt'); bytesTarget = getPath(JD_HOME + '/tmp/_set_download_limit_per_session.txt'); if (name == 'Start Monitor Loaded Bytes') { if (isDownloadControllerRunning()) { var loadedBytesInit = 0; if (beginLoadedBytesState.exists()) { deleteFile(beginLoadedBytesState, false); loadedBytesInit = _getCurrentLoadedBytesState(); writeFile(beginLoadedBytesState, loadedBytesInit, false); var bytesLimit = _setDownloadBytesSessionLimit() var bytesLimit = bytesLimit.replace(/^\[(.*?)\]/, '$1'); var bytesLimit = parseInt(bytesLimit.replace(/\[^0-9.]/g, '')); alert('New Session with Limit of: ' + bytesLimit + ' GB'); } else { loadedBytesInit = _getCurrentLoadedBytesState(); writeFile(beginLoadedBytesState, loadedBytesInit, false); } } } //-------------------------------------------------------- function _getCurrentLoadedBytesState() { var loadedBytesCount = 0; getAllDownloadLinks().filter(function(link) { return link.getBytesLoaded(); }).forEach(function(link) { loadedBytesCount += link.getBytesLoaded(); }) return loadedBytesCount } //-------------------------------------------------------- function _setDownloadBytesSessionLimit() { var inputBox = 'notepad.exe'; if (!bytesTarget.exists()) { writeFile(bytesTarget, "[20] <-- Enter New download limit (unit in GB) inside Square Brackets or Leave as it. ***NOTE: Will Reset/Restart New Session!", true); } callSync(inputBox, bytesTarget); return readFile(bytesTarget); } Code:
//2nd // Stop downloads when target reached // Trigger: Interval (Recommended 60000 or more) //-------------------------------------------------------- disablePermissionChecks(); //no prompting persmision dialog //enablePermissionChecks(); //required prompting permision //-------------------------------------------------------- //setDisableOnException(true); // enable/disable script on error exceptions //setNotifyOnException(true); // true enable/false disable error notification on exceptions //-------------------------------------------------------- //setAdvancedAlert(true); beginLoadedBytesState = getPath(JD_HOME + '/tmp/_init_loaded_bytes_state.txt'); bytesTarget = getPath(JD_HOME + '/tmp/_set_download_limit_per_session.txt'); if (isDownloadControllerRunning()) { // get if (beginLoadedBytesState.exists()) { var target = _getTargetBytes(); var loadedBytesInit = readFile(beginLoadedBytesState); var loadedBytesCurr = _getCurrentLoadedBytesState(); // condition if ((loadedBytesCurr - parseInt(loadedBytesInit)) / 1e9 > target) { deleteFile(beginLoadedBytesState, false); stopDownloads(); } // debug - make sure to set interval to at least 10secs otherwise you are not going to like this alert //var loadedBytes = ((loadedBytesCurr - parseInt(loadedBytesInit)) / 1e9); //alert('init:\t' + loadedBytesInit + '\ncurr:\t' + loadedBytesCurr + '\n\r' + 'progress:\t' + loadedBytes + ' GB\ntarget:\t' + target + ' GB'); } else { //Need to run 1st script to set beginLoadedBytesState & bytesTarget //otherwise this script does not execute anything on first run or after target met } } //-------------------------------------------------------- function _getTargetBytes() { if (bytesTarget.exists()) { var target = readFile(bytesTarget); // <- get limit set by user (in GB) var target = target.replace(/^\[(.*?)\]/, '$1'); var target = parseInt(target.replace(/[^0-9.]/g, '')); } else { var target = 20; // <- Set limit (in GB) note: user input will overwrite } return target } //-------------------------------------------------------- function _getCurrentLoadedBytesState() { var loadedBytesCount = 0; getAllDownloadLinks().filter(function(link) { return link.getBytesLoaded(); }).forEach(function(link) { loadedBytesCount += link.getBytesLoaded(); }) return loadedBytesCount } Last edited by zreenmkr; 11.05.2020 at 04:48. Reason: avoid unlimited sessions |
#1357
|
|||
|
|||
It is possible to set session based limit instead of daily limit. But I could not quite understand what you meant by "with no regards to previous downloads".
|
#1358
|
|||
|
|||
Quote:
Most likely, the player (or the version of the player) you are using does not have the necessary codecs to play the files. Check the manual or the support forums of that player to verify if it in facts supports these formats. Some players will require you to install additional codecs to play files which are not supported by default. Another option would be transcode the files to a format supported by your player, but I would strongly advice against it since transcoding files from one lossy format to another will result in loss of quality. |
#1359
|
|||
|
|||
Hello @psp: Sorry for late reply.
Code:
// Add prefix to filename // Tirgger: A Download Started link.getPackage().getDownloadLinks().forEach(function(link, index) { if (link.status == "Mirror http links is loading") { var prefix = "[" + link.getDownloadHost() + "] "; link.setName(prefix + link.getName()); link.setSkipped(true); sleep(1000); link.setSkipped(false); } }) Quote:
Code:
// Remove prefix from filename // Trigger: A Download Stopped if (link.isFinished()) { var prefix = "[" + link.getDownloadHost() + "] "; var file = link.getDownloadPath().replace(prefix, ""); if (!getPath(file).exists()) { var n1 = link.getName(); var n2 = n1.replace(prefix, ""); if (n1 != n2) link.setName(n2); } } |
#1360
|
|||
|
|||
Quote:
Code:
[{ "eventTrigger": "ON_ARCHIVE_EXTRACTED", "enabled": true, "name": "2020.05.12 ", "script": "disablePermissionChecks();\ncallSync(\"synoindex\", \"-R\", \"video\");", "eventTriggerSettings": { "isSynchronous": true }, "id": 1589276857812 }] |
Thread Tools | |
Display Modes | |
|
|