#1161
|
|||
|
|||
Possible, but you will have to also set the desired comment in the script (there will be no popup dialog where you can enter the comment).
|
#1162
|
|||
|
|||
So I each time before I would insert a comment had to open the script in the "Event scripter" and insert the text there anywhere in the script between some delimeters? Would I have to open the script manually (in the usual way) or may be with a button, shortcut in a more convenient way?
|
#1163
|
|||
|
|||
Quote:
Alternatively, I can provide a script which can read the comment from an existing link and then add it to the other links selected along with that link. If you are running JD Windoes a workaround via VBS script might also be possible, but I will have to look into it. |
#1164
|
|||
|
|||
Quote:
thank you it works and inserting variables into the script is simple [= I can do it! yahoo] should i flag (enable) the synchronous script execution option? @zreenmkr Thanks for your help, soon i will test your scripts better but there is one thing i would like to know: what are the "variables" ??? both if I do "test" they give me this error message :<"name" is not defined> Last edited by BJN01; 06.03.2020 at 18:12. |
#1165
|
|||
|
|||
Quote:
Quote:
Quote:
|
#1166
|
|||
|
|||
hello , starting from the mgpai script I managed to make another one that changes the names of the file in the linkgrabber tab , and I activate it with <Toolbar Button Pressed>. (oddly it works., and from my point of view it is a success)
now I have 3 buttons with related scripts, for convenience I added an "alert" in 2 of these scripts . Thanks to this I realized that regardless of which push button all 3 are executed. it's normal ? is there a way to avoid it? [I tried to select / deselect the synchronous script execution option but nothing has changed] |
#1167
|
|||
|
|||
Quote:
|
#1168
|
|||
|
|||
Quote:
Quote:
Am assuming you've created 'EventScripter Trigger' button. You need to give that each button a unique name and it is case sensitive. 1st Button Code:
if (name == "My Button1 Name") { //if button you rename from 'EventScripter Trigger' to '"My Button1 Name'. When this button is pressed then only this 1st codes in this body will be executed } Code:
if (name == "My Button2 Name") { //if button you rename from 'EventScripter Trigger' to '"My Button2 Name'. When this button is pressed then only this 2nd codes in this body will be executed } Last edited by zreenmkr; 07.03.2020 at 05:59. |
#1169
|
|||
|
|||
Quote:
|
#1170
|
|||
|
|||
I'm new to this, can't code and still try figure this out.
Is it possible if you download a video (MP4, MPEG, MKV) from a website (not youtube), to automatically extract the audio part of the video container and then delete the video? Also, is it possible to write a 2nd version of that script that includes also automatic re-encoding with lower bitrate (64kbps?) to drastically shrink the filesize of the audio file? Last edited by Loadrix; 07.03.2020 at 06:28. |
#1171
|
|||
|
|||
Quote:
Code:
callAPI("linkgrabberv2", "addLinks", { "links": readFile(feeds), "autostart": true, "destinationFolder": "\\myFolder\\<jd:packagename>" }); Optionally, use "LinkgrabberSettings.autoconfirmdelay" (Advanced Settings) to adjust the 'autostart delay'. |
#1172
|
|||
|
|||
Quote:
Quote:
|
#1173
|
|||
|
|||
Quote:
|
#1174
|
|||
|
|||
Quote:
Code:
// Extract Audio from Video then Convert to <custom> mp3 bitrate. // Trigger required: "A Download Stopped". // Requires ffmpeg/ffprobe. Uses JD ffmpeg/ffprobe settings if available. // Overwrites destination file (mp3) if it already exists. disablePermissionChecks(); //no prompting dialog //enablePermissionChecks(); //required prompting permision //setDisableOnException(myBoolean); // enable/disable script on exceptions //setNotifyOnException(myBoolean); // enable/disable notification on exceptions if (link.isFinished()) { var fileName = link.name.replace(/(.+)(\..+$)/, "$1"); var fileType = link.name.replace(/(.+)(\..+$)/, "$2"); var sourceFile = link.getDownloadPath(); var videoFile = /\.(mp4|mkv|mov|avi|mpg|mpeg)$/.test(sourceFile); if (videoFile) { var downloadFolder = package.getDownloadFolder(); var videoSourceFile = sourceFile; var audioDestFile = downloadFolder + "/" + fileName + ".mp3"; var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath"); //var ffprobe = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypathprobe"); //--------------------------------------------------------------- //---extract & convert video to audio //---ffmpeg ref cmd: hxxps://gist.github.com/protrolium/e0dbd4bb0f1a396fcb55 //---ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3 //--------------------------------------------------------------- var bitrate = 64000; //option 1 - CallSync callSync(ffmpeg, "-i", videoSourceFile, '-f', 'mp3', '-ab', bitrate, '-vn', audioDestFile); //Option 2 - callAsync //callAsync(function() {}, ffmpeg, '-i', videoSourceFile, '-f', 'mp3', '-ab', bitrate, '-vn', audioDestFile); var deleteSourceFile = false; // Set this to true to delete source file after conversion. if (deleteSourceFile && getPath(audioDestFile).exists()) deleteFile(videoSourceFile, false); } } |
#1175
|
|||
|
|||
Quote:
Code:
// Read comment from file and add it to selected links // Trigger : Downloadlist Contextmenu Button Pressed // Customize download list context menu > Add new 'Eventscripter Trigger' button > Rename it to "Add comment" (without quotes) if (name == "Add comment") { var links = dlSelection.getLinks(); if (links.length) { var textEditor = "notepad.exe"; var commentFile = getPath(JD_HOME + "/tmp/commentFile.txt"); if (!commentFile.exists()) writeFile(commentFile, "Replace this text with new comment, save file and exit", true); callSync(textEditor, commentFile); var comment = readFile(commentFile); if (comment.length) { links.forEach(function(link) { link.setComment(comment); }) } } } |
#1176
|
|||
|
|||
Quote:
Last edited by zreenmkr; 07.03.2020 at 10:21. |
#1177
|
|||
|
|||
Quote:
Thank you very much! What do I have to do here (what does the txt file open?), mark one link or more or nonce at first? Sorry, did a very stupid mistake, got it working, missed to activate the script by checking the box. Sorry again. So the txt file has to be saved and closed after. When it closes the text is added, that is how to use it. Last edited by Dockel; 07.03.2020 at 10:13. |
#1178
|
|||
|
|||
Quote:
|
#1179
|
|||
|
|||
Last edited by zreenmkr; 07.03.2020 at 10:19. |
#1180
|
|||
|
|||
Quote:
|
#1181
|
|||
|
|||
Quote:
I had changed the names even before but I noticed that I had not used what I indicated inside the script (I used the name of the script). fixed names are now working properly |
#1182
|
|||
|
|||
Quote:
Try: Code:
"C:\\Users\\Admin\\Desktop\\New folder\\<jd:packagename>" OR "C:/Users/Admin/Desktop/New folder/<jd:packagename>" |
#1183
|
|||
|
|||
in the topic I found this script that saves the list of files written in a txt:
Code:
/// Simple history // Trigger Required : A Download Stopped // // Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\history") // Default file name: "<current date>.txt" (e.g. "Oct 07 2016.txt") if (link.isFinished()) { var a /*date*/ = new Date().toString().substring(4, 16); var b /*history folder*/ = JD_HOME + "/auto/history/"; var c /*history file Name */ = a + ".txt"; var d /*download url*/ = link.getContentURL(); var e /*download file name*/ = link.getName(); if (!getPath(b).exists()) getPath(b).mkdirs(); writeFile(b + c, [d, e].join(",") + "\r\n", true); } can you add a part where it creates a txt with the name of the packages written? |
#1184
|
|||
|
|||
Quote:
Code:
// Simple history // Trigger Required : A Download Stopped if (link.isFinished()) { var folder = getPath(JD_HOME + "/auto/history/"); var date = new Date().toString().substring(4, 16); var txtFile = getPath(folder + "/" + date + ".txt"); var packageName = link.getPackage().getName(); var fileName = link.getName(); var url = link.getContentURL() || link.PluginURL(); var data = [packageName, fileName, url]; if (!folder.exists()) folder.mkdirs(); writeFile(txtFile, data.join(", ") + "\r\n", true); } |
#1185
|
|||
|
|||
Thank you very much !!
I did some tests and managed to get what I wanted . you have already written it somewhere, but what do you have to insert to change the type of date formatting? that is, to switch from eg "Mar 07 2020.txt" to "2020 Mar 07.txt" [mmm-dd-yyyy.txt] ------> [yyyy-mmm-dd.txt]? |
#1186
|
|||
|
|||
Quote:
Code:
var date = Date().replace(/.{4}(.{6}).(.{4}).+/, "$2 $1"); |
#1187
|
|||
|
|||
Nope, neither one seemed to work it just saves it to the default download location witch is the downloads folder.
|
#1188
|
|||
|
|||
I figured out why it wouldn't change the download location. It was because I didn't have "overwritePackagizerRules": true. My next question is can I tell it to only download the video or audio file without changing the youtube plugin to only display the video or audio file? I ask because I have two links one where I only want the audio file and one where I only want the video file. I know I need to have two separate event scripts for each link.
|
#1189
|
|||
|
|||
@mgpai thanks, I modified what I had to and it works.
I don't know if it has already been asked but is it possible to insert a value through a warning window or similar? the idea was: - I press the button and a window appears where I can insert text - Insert the test (word to delete) - press "ok" (or enter after inserting text) - and the script modifies the names of the packages (or files) Code:
// Remove test/word from packagenames // Trigger: Toolbar Button Pressed if (name == "test") { getAllCrawledPackages().forEach(function(package) { var curName = package.getName(); var newName = curName; var replace = function(find, replace) { newName = newName.replace(find, replace); } wordremove = ("nada"); // <--- alert( [????] ) here the script should "ask me" to enter the variable it should use replace (wordremove, ""); if (curName != newName) package.setName(newName); }) } |
#1190
|
|||
|
|||
Quote:
See Post |
#1191
|
|||
|
|||
Quote:
Example Rule: Code:
File Tye > is not > Audio File Sourceurl(s) > contains > #onlyAudio Quote:
|
#1192
|
|||
|
|||
Quote:
Youtube---Channel name---audio---audio files ---Channel name---videos---video files etc. I think I can create a package rule to set each one's download directory since each video package has the channel name included in it. |
#1193
|
|||
|
|||
Experimenting with api - have no clues what am doing. Assuming packagizer is switched off.
I have a bunch of links but only want to grab the favorite hosters. Unsuccessful start out code below, somehow it grabs all hosters with rar|zip plus more such as js|png|gif which I don't want. Would also like to set packageName and setName as Comment. doable? Thanks Code:
// Selective Hosts Link Grabber // Trigger: A new link has been added String.prototype.prop = function() { return link.getProperty(this); }; var downloadable = /(filefox.cc|rapidgator.net|uploaded.net)/.test(link.getHost()) && (/\.(rar|zip)$/).test(link.getName()); //alert('downloadable: ' + downloadable + ' - ' + link.getHost()); if (downloadable) { var name = link.getName(); var url = link.getContentUrl(); callAPI("linkgrabberv2", "addLinks", { "links": url, "autostart": false, "destinationFolder": "d:\\_downloads", ?? "packageName": "_fav_hosters", ?? "comment": name }); } Last edited by zreenmkr; 08.03.2020 at 09:33. |
#1194
|
|||
|
|||
Quote:
Code:
Select Links > Right-click > Properties > Rename |
#1195
|
|||
|
|||
Quote:
The 'A new link has been added' trigger returns the 'packagizer link' and is suitable to perform task similar to the packagizer extension (you will be able to set the 'download folder', 'package name', comment etc.) on the new link which has been added, but cannot filter/block any links at this stage. You will need to create linkgrabber filter rules to prevent the links from being added to JD. While you can use 'addLink' API method with this trigger to add new links, it wil be treated as a entirely different task (which has no relation whatsoever with the 'new link' returned by that trigger). |
#1196
|
|||
|
|||
thanks.
Want to get some text from the site and append it to the fileName. Could you give an example of get html tag either via javascript getElementById() or parsing source code via regex or the best way. I could think of two possibilities but don't know how to go about it. Code:
//couldn't get it work reliablely //with this full page about 140kb, it take a longtime to parse //and it returns the surround tags as well or sometimes nothing at all //htmlSource = getPage(url) //with given short test segment then it works somewhat var htmlSource = '<p>start</p><div class="main"><p>p1</p><p>p2</p><p style=text-align:center><strong>My Text To Get</strong>item1<br />item2<br />item3<br /></p></div><p>End</p>' regex = /.*?<div class="main">.*?<p style=text-align:center><strong>(.*?)<\/strong>.*?<\/div>.*?/; var result = htmlSource.replace(regex, '$1'); alert(result); //have no ideas how this work, could it be used with getElementById() or what can you do with this? How about focus and click on a link? var browserObject = getBrowser(); Problem with script editor or is it just me: when you first open up the editor, it trying to auto format the script but it takes several seconds to do so. It'll take longer if script is long. The issue is because of that, any text i just typed before it finished up with auto format is lost. normal? |
#1197
|
|||
|
|||
Quote:
Code:
var br = getBrowser(); var myUrl = "https://jdownloader.org/download/index"; var myHtml = br.getPage(myUrl); var re = /href=\"(http[^"]+)\"/g; var result = myHtml.match(re); alert(result); Quote:
|
#1198
|
|||
|
|||
hello , I recently started using the filter and packet function (and at the moment I was able to get them to do what I needed); but I have a question to ask you:
in the script you can set something like: - if there is "this link" (es h**p:/siteA/dirb/img.jpg) in the linkgrabber links ---> delete it - delete any links from the linkgrabber that comes from this path " xx" (es h**p:/siteB/2dir/shit/...) - delete any links from the linkgrabber that comes from this path " xx" (es h**p:/siteB/2dir/shit/...) and have a specific name ( es uglWpg.*) - delete all filtered links [there is a similar function in the menus "reset filtered connections"] |
#1199
|
|||
|
|||
Code:
// Remove crawledlinks which match user-specified pattern var patterns = []; var addPattern = function(pattern) { patterns[patterns.length] = pattern; } addPattern(/microsoft.com\/.+/i); addPattern(/apple.com\/robots.txt/i); addPattern(/google.com/i); addPattern(/robots.txt$/i); getAllCrawledLinks().forEach(function(link) { patterns.forEach(function(pattern) { var url = link.getUrl(); if (pattern.test(url)) link.remove(); }) }) Quote:
|
#1200
|
|||
|
|||
thank you ! I will try to work on it.
[just for peace of mind, with these commands I'm only going to delete the links of files "to be downloaded", I don't delete files already on HD or in download right?] p.s= can all linkgrabber links be saved to a txt file? |
Thread Tools | |
Display Modes | |
|
|