#1361
|
||||
|
||||
No worries
Thanks - I've forwarded this to the user -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1362
|
|||
|
|||
That is so genius of you @mgpai.
What should the command be if the script only starts after unpacking finished the last download in the queue? Is there also a medicine? Last edited by OCHer; 12.05.2020 at 17:44. |
#1363
|
|||
|
|||
Quote:
Quote:
if still curious on adding ID3v2 Tags to future downloads give this a try, it's nice to have embed metadata. Code:
//Add ID3v2 Tags to Youtube Audio Files Includes AAC* & OGG* (w/ffmpeg) //Trigger: A Download Stopped // //IMPORTANT: // must config Youtube Plugin with this preset // Goto: [Settings > Plugins > (choose) Youtube > Filename to Audio files > (copy and paste custom audio preset below here)] // Preset: [track=`*PLAYLIST_POSITION*`;title=`*TITLE*`;artist=`*USERNAME*`;album=`*PLAYLIST_NAME*`;date=`*DATE*`;.*EXT*] <--without square brackets // // add or remove ID3v2 tags pattern must follow this format: // [ffmpegKeyForID3v2Tag=`*YOUTUBE FileNames/PackageNames*`;] <--without square brackets // // ffmpegKeyForID3v2Tags found here > hxxps://gist.github.com/eyecatchup/0757b3d8b989fe433979db2ea7d95a01 // YOUTUBE FileNames/PackageNames properties are found in [Settings > Plugins > (choose) Youtube > (scroll down toward the bottom)] // //NOTE* ffmpeg cant set ID3v2 tags to some audio formats directly e.g aac&ogg but have no problems with container e.g m4a // hence this script will wrap aac&ogg file in m4a container then add ID3v2 tags that way // // After finished crawling File Name will be temporary hold Id3v2 metadata retrieved. It'll be messy at first both in DL/LG // e.g [track=`0001`;title=`Song Title (Official Video)`;artist=`Uploader Name`;album=`Playlist Name`;date=`Uploaded Date`;.aac] // Once finished downloading Id3v2 tags will be applied then custom File Name will be set as [sTrack - sTitle - sArtist - sDate] // e.g [0001 - Song Title (Official Video) - Uploader Name - Uploaded Date.acc] // //-------------------------------------------------------- disablePermissionChecks(); //no prompting persmision dialog var hoster = link.getHost(); if (hoster == 'youtube.com') { var regexAudioExt = /.+\.(aac|ogg|mp3)$/ig; //<-- add/remove audio file extensions var isFinished = link.isFinished(); var fileName = link.getName(); var fileExt = fileName.replace(regexAudioExt, '$1'); if (fileExt && isFinished && hoster == 'youtube.com') { var sTrack = ''; var sTitle = ''; var sArtist = ''; var sDate = ''; var metaData = ''; var fileDir = link.getPackage().getDownloadFolder(); var filePath = getPath(fileDir + '/' + fileName) var regexMetadata = /^(?:^|\s+)?(track|title|artist|album|date|author_url|comment|copyright)(=`.+`)(?:^|\s+)?$/ig; //<--add/remove ffmpeg keys for ID3v2 tags var regexYear = /^(date=`).+(\d{4}`)$/ig; var regexFile = /^(.*?)\..{2,4}$/ig; var string = fileName.replace(regexFile, '$1'); string.split(';').forEach(function(tag) { var tagTmp = tag; //if (regexMetadata.test(tagTmp)) { //this fails when string contains utf-8 if (tag.match(regexMetadata)) { if (regexYear.test(tag)) tagTmp = tag.replace(regexYear, '$1$2'); if (/^track=/.test(tag)) sTrack = tag.replace(/.+\=`(.+)`$/, '$1 - '); if (/^title=/.test(tag)) sTitle = tag.replace(/.+\=`(.+)`$/, '$1 - '); if (/^artist=/.test(tag)) sArtist = tag.replace(/.+\=`(.+)`$/, '$1 - '); if (/^date=/.test(tag)) sDate = tag.replace(/.+\=`(.+)`$/, '$1'); tagTmp = tagTmp.replace(/`$/g, '"'); tagTmp = tagTmp.replace(/=`/g, '="'); if (tagTmp.length) metaData += ' -metadata ' + tagTmp; } }) var m4aExt = 'm4a' var newFileName = sTrack + sTitle + sArtist + sDate + ' [' + m4aExt + ']' + '.' + fileExt //Custum final file name var m4aContainer = sTrack + sTitle + sArtist + sDate + ' [' + m4aExt + ']' + '.' + m4aExt var newFileNameWithNoID3Set = sTrack + sTitle + sArtist + sDate + '.' + fileExt //Custum final file name var m4aContainerPath = getPath(fileDir + '/' + m4aContainer); var newFilePath = getPath(fileDir + '/' + newFileName); //var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath"); //download ffmpeg var ffmpeg = getPath(JD_HOME + '/tools/Windows/ffmpeg/x64/ffmpeg.exe'); var ffmpegID3Cmd = getPath(fileDir + '/setID3' + newFileName + '.cmd'); if (ffmpeg.exists() && filePath.exists()) { //Option 1 - will fail with some filename contains none ASCII chars or filename is too long. //vbs or ps1 might fix this issue. var deleteOrigFile = '\n\r' + 'del "' + filePath + '"' var deleteBatchCmd = '\n\r' + 'del "' + ffmpegID3Cmd + '"' var renameBacktoOrigExt = '\n\r' + 'ren "' + m4aContainerPath + '" *.' + fileExt //m4aExt > fileExt var windowsId3v2dot3comp = ' -id3v2_version 3 -write_id3v1 1 '; if (/.+\.(aac|ogg)$/ig.test(fileName)) { var ffmpegId3 = '"' + ffmpeg + '" -i "' + filePath + '" ' + metaData + windowsId3v2dot3comp + ' "' + m4aContainerPath + '"' //wrap audio file(s) in m4a container var cmd = ffmpegId3 + renameBacktoOrigExt + deleteOrigFile + deleteBatchCmd; } else { var ffmpegId3 = '"' + ffmpeg + '" -i "' + filePath + '" ' + metaData + windowsId3v2dot3comp + ' "' + newFilePath + '"' var cmd = ffmpegId3 + deleteOrigFile + deleteBatchCmd; } try { deleteFile(ffmpegID3Cmd, false); writeFile(ffmpegID3Cmd, cmd, false); callSync(ffmpegID3Cmd); link.setName(newFileName) } catch (e) { deleteFile(ffmpegID3Cmd, false); link.setName(newFileNameWithNoID3Set) //failed wrapping audio file in m4aExt and no Id3v2 tags applied (occurrs on some non ASCII file names/long file names) } //Option 2 - not working (inputs welcome) //callAsync(ffmpeg, '-i', filePath, '-metadata title="Test Set Title"', newFilePath); //callAsync(ffmpeg, '-i', filePath, metaData, newFilePath); } } } Last edited by zreenmkr; 13.05.2020 at 04:21. Reason: added host and container check |
#1364
|
||||
|
||||
@zreenmkr: Thanks for your great work and help on scripting!
__________________
JD-Dev & Server-Admin |
#1365
|
|||
|
|||
Quote:
Code:
// Call external program // Trigger: Archive extraction finished disablePermissionChecks(); if (isDownloadControllerIdle() && !callAPI("extraction", "getQueue").length) callSync("synoindex", "-R", "video"); This should call the external program if no downloads are running and last archive file has been extracted. Install the script in JD with GUI and copy the JSON value from advanced settings. |
#1366
|
|||
|
|||
Quote:
Last edited by sherif011; 17.05.2020 at 17:09. |
#1367
|
|||
|
|||
I mean, I just need to set the limit for the current session, just after I click start, without counting previous downloads.
|
#1368
|
|||
|
|||
Hi I've got a couple things I'm trying to sort out in this script. One thing I've pretty much done but I haven't got a clue how to do the second thing.
1: This script works fine, until after it runs test.exe, when that task completes the downloads don't start again...I don't understand why. 2: I want to be able to measure the interval between occurrences of the script. For example take the system time, save as a global variable, then compare that with system time the next time a download goes offline. Hope someone can help! Code:
// Script to stop, reset links, run captcha macro, restart downloads // Trigger: "A Download Stopped" var finalStatus = link.getFinalLinkStatus(); disablePermissionChecks(); if (finalStatus == "OFFLINE") { stopDownloads(); link.reset(); callSync("c:\\test.exe"); startDownloads(); } |
#1369
|
|||
|
|||
@mgpai
Hi, regarding the script that deals with Zippyshare's and general links reset, is there a way that it doesn't trigger the sleeping process if there are still pending downloads? I mean, the other day I left a bunch of files downloading and since after a while the system went to sleep, I thought all of them were downloaded, but it wasn't like that. Back when I checked, I noticed the system was put to sleep, but there were many files still not downloaded/interrupted. Thanks. Last edited by ElCho; 18.05.2020 at 14:39. Reason: typo |
#1370
|
|||
|
|||
Quote:
leave the 2nd script alone, dont change anything there. because trigger is interval, it runs silently in the background every x number of mili-seconds (change that at top right corner of eventscript editor, 1000 = 1second) to check if x GB limit is met that is set by the 1st script. 1st script is a controller, allows your to enter x GB limit and also start a new session everytime you select/click on it. to activate the controller, create a button or a menu selector for it. there are 3 options for trigger described but there are also other options to do that. the 3 commonly used are Toolbar Button at the top, or add menu selector when you Right-Mouse-Click or in the Main menu. here is the tutorial, But the easiest way is after you set trigger to e.g 'Toolbar Button Pressed', go back into eventscripter editor, there is now a button at the top call 'Main Toolbar', click on that, follow the tutorial above to create a button. rename 'Event Scripter' to 'Start Monitor Loaded Bytes' Last edited by zreenmkr; 18.05.2020 at 04:04. |
#1371
|
|||
|
|||
Quote:
Code:
//Trigger: Downloadlist ContextMenu Button Pressed if (name == 'CheckLink Status') { try { link = lgSelection.getContextLink(); } catch (e) {} try { link = dlSelection.getContextLink(); } catch (e) {} var lnkStatus1 = link.getStatus(); var lnkStatus2 = link.getFinalLinkStatus(); alert('status1: ' + lnkStatus1 + '\nstatus2: ' + lnkStatus2); } Quote:
alternatively if you know why your files skip downloading or go offline frequently, you can also use trigger Interval and check every links every x minutes. Adapt this script to your own needs Last edited by zreenmkr; 18.05.2020 at 07:11. |
#1372
|
|||
|
|||
Quote:
Also, your issue might be the same with @MrBojangles_ see above for solutions |
#1373
|
|||
|
|||
Quote:
Code:
// Limit per download session // Trigger: Download Controller Started var limit = 20; // <- Session limit (GB) var interval = 30; // <- Interval between checks (seconds) var getLoadedBytes = function() { return callAPI("polling", "poll", { "aggregatedNumbers": true })[0].eventData.data.loadedBytes; } var loadedBytes = getLoadedBytes(); while (isDownloadControllerRunning() || isDownloadControllerPaused()) { sleep(interval * 1000); if ((getLoadedBytes() - loadedBytes) / 1e9 > limit) stopDownloads(); } |
#1374
|
|||
|
|||
Quote:
Quote:
Code:
var myObject = setProperty(myString/*"key"*/, myObject/*anyValue*/, myBoolean/*global(boolean)*/);/*Set a Property. This property will be available until JD-exit or a script overwrites it. if global is true, the property will be available for al scripts*/ /* Example: */var oldValue=setProperty("myobject", { "name": true}, false); var myObject = getProperty(myString/*"key"*/, myBoolean/*global(boolean)*/);/*Get a Property. Set global to true if you want to access a global property*/ /* Example: */var value=getProperty("myobject", false); |
#1375
|
||||
|
||||
Quote:
Before the script runs, the download that failed (/triggered the captcha) is OFFLINE. After the link resets then it goes back to UNKNOWN. Putting it after running the external program doesn't seem to change anything, except resetting the link later. The downloads still don't restart Does startDownloads() not do anything if the links are UNKNOWN? Quote:
Quote:
Quote:
Last edited by MrBojangles_; 18.05.2020 at 14:22. Reason: Answered one of my own questions... |
#1376
|
|||
|
|||
Quote:
If you post the log ID of that session and also provide the urls of the links which fail to start, the developers might be able to check it and provide more information. |
#1377
|
|||
|
|||
Quote:
I'm moving onto problem two now, I have tried to set a global variable that I can recall later, using the commands you showed: Code:
FirstTime = typeof(FirstTime) == 'undefined' ? 0 : FirstTime; setProperty(FirstTime, {"stamp":Date.now()}, true); var RetrievedTimeStamp = getProperty(FirstTime, true); alert(RetrievedTimeStamp.stamp); Last edited by MrBojangles_; 18.05.2020 at 16:31. Reason: More testing. |
#1378
|
|||
|
|||
Quote:
Code:
while (!isDownloadControllerIdle()) sleep(1000); Should work, assuming some other link/script will not try to start the download in the meanwhile. Quote:
"key" should be "String" Code:
if (getProperty("FirstTime", true) === null) { setProperty("FirstTime", { "stamp": Date.now() }, true); } var RetrievedTimeStamp = getProperty("FirstTime", true); alert(RetrievedTimeStamp.stamp); |
#1379
|
|||
|
|||
Quote:
It did create a new problem with the script being triggered repeatedly before the first iteration stopped downloads but I figured a way round that. Quote:
Everything is now working beautifully, thank you so much for your help! |
#1380
|
|||
|
|||
Quote:
Quote:
|
#1381
|
|||
|
|||
i didn't know that, i'm new to object and method in general
|
#1382
|
||||
|
||||
@MrBojangles_
adding links to JD interface will result in linkchecking via website or api account based downloads downloading method for web includes linkchecking part of the download step or not. If websites have direct download option we typically do not do this logged in as it will send data over html. If they always return html we use logged in as its one less request (faster). If its api based two calls, one to check online status, second to start download. free downloads will online check as part of the download routine. which site penalises you ? Maybe best approach is for us to add plugin specific code to just always return links online. Filename/size/onlinestatus will only be available on download adding work around like this is kinda pointless. right? Have you thought about turning linkchecking off (advanced setting)?
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] Last edited by raztoki; 20.05.2020 at 10:34. |
#1383
|
|||
|
|||
Quote:
Quote:
If you felt like making a plugin that handled this that would be amazing (I have 300k files to download!) - because my very hacky solution to getting round the recaptcha with mouse macros works until it starts asking you to match pictures instead of just ticking a box. In my testing I've found that you can complete the captcha on a completely different computer and it'll still reset the download limit - so I'm guessing that it would be possible to automate everything and send the captchas to a farm via a plugin. I'd love to make this myself but I think it's beyond my capabilities |
#1384
|
||||
|
||||
@MrBojangles_
What you want would still require a plugin - everything else is just a workaround/hack. Also keep in mind that there will NEVER be any "general" solution for scenarios like yours - a script always needs to recognize the moment in which that captcha starts to appear and needs to know what to do then. ... not saying it is impossible via LinkCrawler rules though as I did send you here. -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1385
|
||||
|
||||
if your using crawler rules, probably also means you're downloading wiht directhttp plugin which means no in plugin support for captcha for that service. so yes what psp said is that you do need dedicated hoster plugin which could at least provide you with means to answer respective captcha.
alternatively if its all based on IP session, one could reset ip address to avoid said limits. At least on the download side you implied its only requirement once limit is met, resetting ip (if you have dynamic) would be a better solution than answering 1 captcha per download thereon after.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] Last edited by raztoki; 20.05.2020 at 13:29. |
#1386
|
||||
|
||||
@raztoki
I did help him to make that Link Crawler rule and it will work fine, especially in combination with deactivating the linkcheck but once he runs in this limit, all following URLs will get displayed as offline. He then has to solve the captcha after which everything will continue to work with the existing session cookies. -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1387
|
||||
|
||||
arh so its cookie based. so ip resetting most likely wont be a workable solution then
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#1388
|
||||
|
||||
I haven't tried it but don't think it would though I have seen providers which would e.g. reset account limits on reconnect (keep2share) but it's rare.
-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1389
|
|||
|
|||
@raztoki
Sorry I haven't really been clear about how their site works: You get around 75 downloads (varies) between captcha requests The captchas start as just clicks (hence mouse macro), but then turn into the picture ones after (presumably) too many captcha requests have been done in a set amount of time. Something I haven't mentioned which actually seems quite relevant is that the captcha page is generic: (**External links are only visible to Support Staff****External links are only visible to Support Staff**) and resets the download limit even if you browse to it directly without being redirected there (which is why my mouse macro works because it just browses to that page and clicks the box automatically). Presumably then a plugin could pass that link plus the embedded session cookie out to a captcha farm automatically whenever a download fails? It feels like that would be more straightforward than most plugins, but obviously I speak from a position of complete ignorance. Is there a similar plugin already in JD that I could study? |
#1390
|
||||
|
||||
Quote:
Quote:
You're especially looking for some containing reCaptchaV2 solver code aka "CaptchaHelperHostPluginRecaptchaV2" nd also ones that support account login --> text "enablePremium". -psp-"
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1391
|
|||
|
|||
There's a number newer Javascript features that don't seem to be supported in the event scripter, things like default parameter values or arrow expressions.
I suspect is due to using HtmlUnit 2.15, which was released 6 years ago. Is it possible to update HtmlUnit to a newer version to support modern Javascript features? |
#1392
|
||||
|
||||
@BillyCool: Has nothing to do with HtmlUnit but with used JS Engine Rhino and limited JS feature set and old JS support version. It was never goal to fully support JS nor modern language features because lack of JS engine support.
__________________
JD-Dev & Server-Admin |
#1393
|
|||
|
|||
I see, is there any way to maybe import modern JS features using require(), maybe JQuery potentially? I remember trying in the past with no luck. Has anyone attempted and succeeded?
|
#1394
|
||||
|
||||
Not sure they will make support possible as it would require more modern Java and then moves JD away from older Java support. Currently JD supports 1.6 =< *
using 3rd party libraries could be a solution though, see what Jiaz says on his return =]
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#1395
|
|||
|
|||
Quote:
When menu-tools-extract files then archive.getDownloadLinks() not there. How get path(s) from manual open? I need path for case single file (abc.rar or abc.zip etc) but too for multi file like (abc.001, abc.002) so move can work for manual open too. |
#1396
|
|||
|
|||
Quote:
Code:
var myFilePath[] = myArchive.getExtractedFilePaths(); |
#1397
|
|||
|
|||
Thank! Will try soon! Hope it works.
|
#1398
|
||||
|
||||
@BillyCool
I'm afraid that's not possible because the JS engine itself must support the language elements/features. Optional github.com/graalvm/graaljs might be possible I see that modern language features are a nice to have but I think that the the purpose to create simple scripts can also be achieved with current language feature set @mgpai: I think best would be to add generic support for all internal archive file type
__________________
JD-Dev & Server-Admin |
#1399
|
|||
|
|||
Hello, I know something similar has already been asked several times, but no where can I find a solution that works to my liking.
I would like a script for a custom button, that when pressed, will check my Files and Folders if they exist, then compare them with the Files in my Linkgrabber and then either mark them as already existing or move them to a different package or simply delete them from the Linkgrabber list. I do not want it to only disable the Links when attempting to Download, because when I switch to an empty Hard Drive later on, it will no longer be able to check if the Files already exist. |
#1400
|
||||
|
||||
@Fragmata: such a script rings my bell but I couldn't find it right now. Maybe other community users can find it or similiar one or can help with creation of such a script.
__________________
JD-Dev & Server-Admin |
Thread Tools | |
Display Modes | |
|
|