#1141
|
|||
|
|||
![]() Quote:
Code:
// Get Selected packageName // Trigger : "DownloadList Contextmenu Button Pressed" if (name == "Get Selected packageName") { try { var myDownloadlistSelection = dlSelection; var selectionIsPackage = myDownloadlistSelection.isPackageContext(); if (selectionIsPackage) { var myFilePackage = myDownloadlistSelection.getContextPackage(); var myFilePackageName = myFilePackage.getName(); alert("Selected Package: " + myFilePackageName); } else { alert('Select a package'); } } catch (e) { alert(e); } } |
#1142
|
|||
|
|||
![]()
Thanks,
// Objective is to search for duplicate within jd. Not the same as search for existed file on harddrive. // I think Trigger is: "DownloadList Buttombar Button Pressed" At the bottom left of both Downloads/LinkGrabber tabs, you able to search for (Package Name|File Name|Comment|Hoster) With all prior knowlege we know how to get file name via trigger 'DownloadList Contextmenu Button Pressed' How to set that File Name in search Inputbox? I found a few function that able to set text such as setText(), setName(), setComment() ect... but nothing similar to setSearch. |
#1143
|
|||
|
|||
![]() Quote:
Alternatively, you can detect duplicates and export them to a file or perform other actions, such as comment/disable/remove/skip those links. |
#1144
|
|||
|
|||
![]() Quote:
If there is a way to get classname of edit/input box would be nice. |
#1145
|
|||
|
|||
![]() Code:
//works as expected var url = 'https://board.jdownloader.org/'; openURL(url); Is there a work around to open browser history? I think there is a url check for 'http' start of string which is why it failed. Code:
//Not working var url = 'chrome://history/'; openURL(url); |
#1146
|
|||
|
|||
![]() Quote:
Code:
var myBrowser = "D:\\Firefox\\Firefox.exe"; var myURL = "about:downloads"; callSync(myBrowser,myURL); |
#1147
|
|||
|
|||
![]() Quote:
Code:
getPage(url) Will this method work for any site or only on yt? Code:
// Get link property String.prototype.prop = function() { return link.getProperty(this); }; Code:
Video: youtube + "watch?v=" + "YT_ID".prop() + "\">" + "YT_TITLE".prop() |
#1148
|
|||
|
|||
![]()
Hello , I read almost the whole topic (and it took me a lifetime);
I've already copied and tried some scripts , but I didn't find what I was looking for (there was something approaching but I have no idea how I could modify it). So I ask those who know the topic for help , is it possible to have a script that changes the name of the "packages" obtained with "linkcrawler" / plugin? I try to explain myself better: (es) I copy link of site "X" , "Y" ... etc. --> JD do is work , grab the file and pack them (ok) --> in the Linkgrabbe tab show something like: Quote:
now with [ Trigger: Toolbar Button Pressed] , I would need a script that checks the package names and replaces or modifies some of them based on values specified in the script, example: a) if you find "Vol " replace with "V0" b) if you find "~" replace with "-" c) if you find "Darkwing duck & co" replace with "nada" .... etc "clean up" replace strange characters like "❤,:,/,\,*,%,^,",°" with " " therefore after starting the script the titles of the example should become: Quote:
|
#1149
|
|||
|
|||
![]() Quote:
Quote:
Then <PackageName> $1$-V0$3$4 don't forget [x]regex checkbox on the far right |
#1150
|
|||
|
|||
![]()
thanks but I don't think Packagizer rules is helpful for what I want to do:
1)I don't always have to replace / modify the packagename [only when I need it, for this I would have started the script as <Toolbar Button Pressed>] 2) Quote:
, if I enter $1$-V0$3$4 and run the test the name of the package becomes: $1$-V0$3$4 |
#1151
|
|||
|
|||
![]() Quote:
|
#1152
|
|||
|
|||
![]() Quote:
![]() Issue1 : //replace() - Trigger selection limitation Issue2 : //setPackageName() - Trigger selection limitation see comments in the code OPTION 1 Code:
// Rename all Packages in LinkGrabber // Trigger : "Toolbar Button Pressed" if (name == "Rename All Packages in LinkGrabber") { try { var pkgs = getAllCrawledPackages(); for (var i = 0; i < pkgs.length; i++) { var packageName = pkgs[i]; var renamedPkg = _removeSpecialChars(packageName); //replace() limitation on trigger selection/Is there a workaround or other method available? alert('packageName RAW #' + i + ': ' + packageName); //alert('packageName RENAMED #' + i + ': '+renamedPkg); //need to resolve issue above about replace() //???.setPackageName(packageName) if (i > 5) break; //for testing purposes } } catch (e) { alert(e); } } OPTION 2 Code:
// Rename a single selected package - via Right Click // Trigger : "LinkGrabber Contextmenu Button Pressed" //if (name == "Rename Package Selection") { try { var selectionIsPackage = lgSelection.isPackageContext(); if (selectionIsPackage) { var filePackage = lgSelection.getContextPackage(); var packageName = filePackage.getName(); var packageName = _removeSpecialChars(packageName); alert("Selected Package: " + packageName); if (packageName) selectionIsPackage.setPackageName(packageName); //setPackageName() limitation on trigger selection/Is there a workaround or other method available? } } catch (e) { alert(e); } } Code:
//-------------------------------------------------------- //Find and Replace Package Name //-------------------------------------------------------- function _removeSpecialChars(packageName) { //var regex = /(\❤|\:|\/|\\|\*|\%|\^|\°|\!)/ig; //var packageName = packageName.replace(regex, ''); var regex = /(~)/ig; var packageName = packageName.replace(regex, '-'); var regex = /(-vol\s)(\d{1}-)/ig; //find '-Vol 1' var packageName = packageName.replace(regex, '-V0$2-'); var regex = /(-vol\s)(\d{2,3}-)/ig; //find '-Vol 00' to '-Vol 999' var packageName = packageName.replace(regex, '-V$2-'); return packageName; } Last edited by zreenmkr; 06.03.2020 at 02:24. |
#1153
|
|||
|
|||
![]() Quote:
Code:
//var myObject = myDownloadLink.getProperty(myString); var myChannelName = myDownloadLink.getProperty("YT_CHANNEL"); All properties available for a particular link can be accessed using this method. Some plugins will also store media tags like 'artist', 'album' etc. as 'property'. Check plugin source code for the list of properties stored by it. Quote:
|
#1154
|
|||
|
|||
![]() Quote:
Script 1: Code:
var packageName = pkgs[i]; // This is not an packagename string (mycCrawledpackage.getName()). It is a package object (myCrawledPackage = pkgs[i]). var renamedPkg = _removeSpecialChars(packageName); // You are trying to rename a package object (pkgs[i]) and not a a package name string (pgks[i].getName()). ???.setPackageName(packageName) // setPackageName(packageName) is a packagizer link method (myPackagizerLink.setPackageName(myPackageName)). To rename crawled package use myCrawledPackage.setName(packageName) method. Script 2: Code:
selectionIsPackage.setPackageName(packageName); // You are trying to use a packagizer link object method, on a selection object. Use crawled package object method, with crawled package object. (filePackage.setName(packageName)). Note: Variable name 'filePackage' usually means download list package. |
#1155
|
|||
|
|||
![]() Quote:
Code:
// Clean-up packagenames // Trigger: Toolbar Button Pressed if (name == "Clean-up packagenames") { getAllCrawledPackages().forEach(function(package) { var curName = package.getName(); var newName = curName; var replace = function(find, replace) { newName = newName.replace(find, replace); } replace("-Vol ", "-V0"); replace(/[~]/g, "-"); replace("Darkwing duck & co", "nada"); replace(/[❤:/\*%^°"]/g, " "); if (curName != newName) package.setName(newName); }) } |
#1156
|
|||
|
|||
![]() Quote:
Working scripts, thanks @mgpai Option 1 Code:
// ---===---===---===---===---===---===---===---===--- // Rename all Packages in LinkGrabber // Trigger : "Toolbar Button Pressed" // ---===---===---===---===---===---===---===---===--- if (name == "Rename All Packages") { try { var crawledPackages = getAllCrawledPackages(); for (var i = 0; i < crawledPackages.length; i++) { var crawledPackage = crawledPackages[i]; var packageName = crawledPackage.getName(); var renamedPackageName = _removeSpecialChars(packageName); alert('packageName RAW #' + i + ': ' + packageName + '\r\n' + 'packageName RENAMED #' + i + ': ' + renamedPackageName); if (packageName) crawledPackage.setName(renamedPackageName); //if (i > 5) break; //for testing purposes } } catch (e) { alert(e); } } Option 2 Code:
// ---===---===---===---===---===---===---===---===--- // Rename a single selected package - via Right Click // Trigger : "LinkGrabber Contextmenu Button Pressed" // ---===---===---===---===---===---===---===---===--- if (name == "Rename a Selected Package") { try { var selectionIsPackage = lgSelection.isPackageContext(); if (selectionIsPackage) { var selectionPackage = lgSelection.getContextPackage(); var packageName = selectionPackage.getName(); var renamedPackageName = _removeSpecialChars(packageName); alert('packageName RAW #' + i + ': ' + packageName + '\r\n' + 'packageName RENAMED #' + i + ': ' + renamedPackageName); if (packageName) selectionPackage.setName(renamedPackageName); } else { alert('select a crawledPackageName and try again.') } } catch (e) { alert(e); } } |
#1157
|
|||
|
|||
![]() Quote:
Code:
var myChannelName = myDownloadLink.getProperty("YT_CHANNEL"); |
#1158
|
||||
|
||||
![]()
most sites have dedicated plugins, so you need to find them. The easiest way is to download the source code (check the getting started guide). OR use logs to see which plugin then find the source for that specific plugin. Not all plugins have properties. Some plugins have properties, but not saved in that manner.
__________________
raztoki @ jDownloader reporter/developer http://svn.jdownloader.org/users/170 Don't fight the system, use it to your advantage. :] |
#1159
|
||||
|
||||
![]()
Here a link to the getting started guide which raztoki has mentioned in his post:
https://jdownloader.org/knowledge/wi...nt/get-started -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager Erste Schritte & Tutorials || JDownloader 2 Setup Download ----------------------------------- On Vacation / Im Urlaub Start: 2023-12-09 End: TBA |
#1160
|
|||
|
|||
![]()
Is there a script which can add a comment to all the downloads / links being marked / selected (insead of having to do it for each single link separately?).
I asked here for such: https://board.jdownloader.org/showth...123#post459123 |
![]() |
Thread Tools | |
Display Modes | |
|
|