JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #881  
Old 15.09.2019, 09:20
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 642
Default

Quote:
Originally Posted by Bach View Post
... script for an automatic update + restart after all active downloads.
Code:
// Update when JD is Idle
// Trigger Required: "Interval"
// Set interval to 600000 (10 mins.) or more.

(function() {
    if (callAPI("update", "isUpdateAvailable") == false) return;
    if (callAPI("linkcrawler", "isCrawling")) return;
    if (callAPI("linkgrabberv2", "isCollecting")) return;
    if (callAPI("extraction", "getQueue").length > 0) return;
    if (callAPI("downloadcontroller", "getCurrentState") != "IDLE") return;
    callAPI("update", "restartAndUpdate");
})();
Reply With Quote
  #882  
Old 15.09.2019, 09:25
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 642
Default

Quote:
Originally Posted by Demongornot View Post
... adding, deleting and changing or selecting subtitles language ".srt" files for Youtube video in the LinkGrabber ?
You can use myjd API methods:
Code:
my.jdownloader.org/developers/

Namespace: linkgrabberv2
Methods: getVariants, setVariant, addVariantCopy.
Reply With Quote
  #883  
Old 15.09.2019, 15:35
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Update when JD is Idle
// Trigger Required: "Interval"
// Set interval to 600000 (10 mins.) or more.

(function() {
    if (callAPI("update", "isUpdateAvailable") == false) return;
    if (callAPI("linkcrawler", "isCrawling")) return;
    if (callAPI("linkgrabberv2", "isCollecting")) return;
    if (callAPI("extraction", "getQueue").length > 0) return;
    if (callAPI("downloadcontroller", "getCurrentState") != "IDLE") return;
    callAPI("update", "restartAndUpdate");
})();

Danke!

Reply With Quote
  #884  
Old 18.09.2019, 16:40
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Quote:
Originally Posted by mgpai View Post
You can use myjd API methods:
Code:
my.jdownloader.org/developers/

Namespace: linkgrabberv2
Methods: getVariants, setVariant, addVariantCopy.
Sorry for the delay and thanks a lot for the answer, it took me a while but I made a script thanks to your informations.

Here is my script : Youtube Smart Subtitle Selector Script.
As it name suggest, it is made to have control over subtitles files.
All needed informations are in comment inside the script itself here :

Code:
/*
Youtube Smart Subtitle Selector Script by Demongornot for JDownloader 2.
This script allow you to set a list of subtitles and alternatives to download with variant filters.
If none of the alternatives have been found, it won't pick any, here is how it work :

First you'll need to enable JDownloader 2 Event Scripter,
if this isn't already done and then create this script, follow those steps :
Go to JDownloader 2 > Settings > Extension Modules > Event Scripter,
then on the top right check the Checkbox to enable Event Scripters if this is not already done.
Down left click the "Add" button if the list is empty though one should already be available,
but you'll only see a Checkbox, empty space, a drop down menu with "None" and a "edit" button.
Now (double) click on the left part of the empty script, if it is already named it might be an existing one.
Name it as you want "Youtube Smart Subtitle Selector Script by Demongornot" for example.
On the drop down menu right to the name part, click and select "A new link has been added", click "edit".
A windows appear, remove the text already in it and paste this entire code including "/*" at the beginning,
uncheck the "Synchronous execution of script" checkbox, this is really important !!!
Now down right click the "Save" button, the script windows is now closed,
check the Checkbox of this script to enable it, and it should now run automatically at every new links.

The work will be done when a new youtube video is added and a subtitles is added by the Youtue Plugin.


How to :
There is a variable called "deleteSubNotFound" by default at true, if set to "true",
if no subtitle in your list have been found, it will delete the one Jdownloader 2 & Youtube plugin took.
If set to "false", it will still be selected, this script have no control over which one is selected.
You also have a set of variables, the first one being called "ext" is the subtitle file extension,
if you need to you can change it, but this script being made for Youtube...
I don't think Youtube I don't think another format of subtitles will be taken in a close futur.
The other variables all starting by "lng" are in case the default Youtube subtitle code change.
I also doubt this will happen but this also lets anyone free to tweak if it was to happen anyway.
All those things shoudn't require any change, I also advise you to know what you are doing,
if you are going to change them, I won't take responsibility for miss use of my script.
Now the "SubLangList" array is where this is at, the process is actually really simple :

If you don't know how array work, simply consider it as a list.
It work that way : "var" "array_name" "[your list here]" ";".
Inside the "[]" brackets, you'll write your subtitle choices, inside brackets separated with a comma :
[[Subtitle choice 1],[Subtitle choice 2],[Subtitle choice 3]]; you can create as many as as you want.
By default JDownloader 2 will split them into lines, looking like this :
[[Subtitle choice 1],
[Subtitle choice 2],
[Subtitle choice 3]
];

Each "Subtitle choice" will be a possible subtitle file, so inside "Subtitle choice",
you'll write your chosen subtitle and its alternative if it is not found.
Making something like this :
[[GB English -> US English -> English],[French -> Canada French],[Brasil Portuguese -> Portugal Portuguese]]
As for how you write this, the language respect the IETF Language tag, you can find details here :
https://en.wikipedia.org/wiki/IETF_language_tag
As for which letters you'll need per country, here is a list :
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements

You must use quote or double quote around each of them, and a coma, so the result will look like this :
[["en-GB", "en-US", "en"],['fr', 'fr-CA'],["pt-BR", 'pt-PT']];
The subtitle main language have to be lowercase and the country variant have to be uppercase.
There is no preference over quote or double quote, which is why I mixed them in this example, both work.
This example list will create up to 3 subtitle files if it find the 3 matching languages.
For the first file, it will look for UK English, if not found, US English, if not found, general English.
Of course if the last one isn't found, no file will be added.
The second list will look for French, if not found for Canadian French.
The last list will look for Brazilian Portuguese and if not found for Portuguese from Portugal.
Note that automatically generated and "special" version will be ignored in those cases.

You can also add special filters by using the caracter #, I'll use French ('fr') and as exemple.
A "#" before the language mean automatically generated language, I don't think it exist as country variant.
So '#fr' mean that only the automatically generated French will be looked for.
A "#" after the language mean special variant, with text in its name, like (English - Created by x).
So 'fr#' mean only a "special" variant of French will be looked for, like (English - With commentaries).
The language surrounded by two "#" mean "any variant of this language".
So '#fr#' will look for any subvariant (like 'fr-CA' or 'fr-CH'), but in priority the main one ('fr').
And finally, language with "-" and surrounded by "#" mean any subvariant but not the main language.
So '#fr-#' will look for any subvariant (like 'fr-CA' or 'fr-CH') but will ignore ('fr').
Note that for the "#any# and #any-#" code, automatically generated and special subtitles will be ignored.


In short :

//xx = Exact primary language, no variant, no autogeneration, no additional text in language name.
//xx-XX = xx language version of XX country variant, no autogeneration or additional text.
//xx# = only language with additional text in its name like (English - Created by x).
//#xx = only automatically generated subtitles of this language.
//#xx# = any version and country variant of xx language except autogenerated and additional text.
//#xx-# = any country variant of xx language except original, autogenerated and additional text.
*/

//___________________________________________________________________________________________________________

var deleteSubNotFound = true;
//'true' = delete JDownloader's chosen language if none is found, 'false' will keep it.

//In case the Youtube Subtitles format changed, here is some variables to fix it.
//Change it only if you know what you are doing, at your own risks.
var ext = '.srt'; //Write here the file extension name of the subtitle file.
var lngSep = '-'; //Write here the main and country language separator.
var lngIdf = 'lng='; //Write here the language value indicator.
var lngAGS = 'kind=asr'; //Write here the autogenerated subtitle value and type.
var lngNam = 'name='; //Write here the language display name value indicator.
var lngVID = '&'; //Write here the value indicator separator.
var lngTAS = '+'; //Write here the language display name string separator.

var subLangList = [
    ['en'], /*Will only take English*/
    ['xx'], /*Will be ignored*/
    ['en-CA'], /*Will only take Canadian English*/
    ['en-XX'], /*Will also be ignored*/
    ['#en'], /*Will only choose Auto Generated English*/
    ['en#'], /*Will only choose "special" subtitle in English*/
    ['#en#'], /*Will take any non special and non autogenerated English*/
    ['#en-#'], /*Will take any non special and non autogenerated English subvariant*/
    ['fr', 'fr-FR', 'fr-CA', '#fr'], /*Either French, France French, Canadian French or autogenerated*/
    ['fr' + lngSep + 'CA', '#fr'], /*You can also write it this way to always have the right separator*/
    ['fr-CH', '#fr-#'], /*Either Switzerland French or any non special, non autogenerated variant*/
    ['ja'], /*Japanese*/
    ['ko'], /*Korean*/
    ['ru'], /*Russian*/
    ['es-419', 'es'], /*Latin American Spanish or regular Spanish*/
    ['fr', '#fr#', 'en', '#en#'], /*You can also mix multiples languages*/
    ['xx', 'fr', 'en-US'] /*Incorrect first language still allow to choose other languages of the list*/
];
//Note that though there is multiples instance of the same language for demonstrations purposes,
//A specific subtitle can only be added once in the list, so you won't have two ['fr-FR'],
//But you still can have ['fr'] and ['fr-FR'] and/or ['en'] and ['en'] autogenerated and/or special.
//If you want to test, Ted Talk and Kurzgesagt Youtube channels often have many subtitles per video.

//___________________________________________________________________________________________________________


//Use the name of the added link to check if it is a subtitle file by checking it contain ".srt" at the end.
var download = link;
var linkName = download.getName();
if (download.getURL != null && download.name != null && linkName != null) {
    if (linkName.lastIndexOf(ext) == linkName.length - ext.length && linkName.indexOf(ext) >= 0) {

        //If it is a "srt" subtitle file, set some variables and get the list of the languages.
        var linkPackageUUID = null; //download.getPackage().getUUID();
        var parentUUID = null; //download.getUUID();
        //I didn't find any other way to get download UUID and download's package UUID than this loop...
        var myCrawledLink = getAllCrawledLinks();
        for (var i = myCrawledLink.length - 1; i >= 0; i--) {
            if (linkName == myCrawledLink[i].getName() && download.getURL() == myCrawledLink[i].getUrl()) {
                linkPackageUUID = myCrawledLink[i].getPackage().getUUID();
                parentUUID = myCrawledLink[i].getUUID();
                break;
            }
        }
        var subtitleList = callAPI("linkgrabberv2", "getVariants", parentUUID);
        var subtitleData = [];

        //Go through all the variants of the video and get informations about them.
        for (var counterA = 0; counterA < subtitleList.length; counterA++) {
            var subID = subtitleList[counterA].id;

            var mainLanguage = subID.substring(subID.indexOf(lngIdf) + lngIdf.length, subID.indexOf(lngVID, subID.indexOf(lngIdf) + lngIdf.length));

            var language = mainLanguage;

            var isMainLanguage = false;
            if (language.indexOf(lngSep) < 0) isMainLanguage = true;

            if (!isMainLanguage) mainLanguage = language.substring(0, language.indexOf(lngSep));

            var isLangAutoGenerated = false;
            if (subID.indexOf(lngAGS) > 0) isLangAutoGenerated = true;

            var isSpecial = false;
            if ((isMainLanguage && subID.indexOf(lngTAS, subID.indexOf(lngNam)) > 0) && !isLangAutoGenerated) isSpecial = true;

            //Put all gathered informations in an array so they are easily accessible without requiring long code.
            subtitleData.push([subID, mainLanguage, language, isMainLanguage, isLangAutoGenerated, isSpecial]);
        }
        var firstPass = true;

        //Go through all the user determined languages in its array and gather data.
        for (var counterB = 0; counterB < subLangList.length; counterB++) {
            for (var counterC = 0; counterC < subLangList[counterB].length; counterC++) {
                var userLanguage = subLangList[counterB][counterC];

                var isMainLanguage = true;
                if (userLanguage.indexOf(lngSep) > 0) isMainLanguage = false;

                var isAutoGenerated = false;
                if (userLanguage.lastIndexOf('#') == 0) isAutoGenerated = true;

                var isSpecial = false;
                if (userLanguage.indexOf('#') == userLanguage.length - 1) isSpecial = true;

                var isAnyVariant = false;
                if (userLanguage.indexOf('#') == 0 && userLanguage.lastIndexOf('#') ==
                    userLanguage.length - 1) isAnyVariant = true;

                var userMainLanguage = userLanguage.replace(/#/g, '');

                if (!isMainLanguage) {
                    userMainLanguage =
                        userLanguage.substring(0, userLanguage.indexOf(lngSep)).replace(/#/g, '');
                }
                var tmpLanguage = -1;

                /*Check through all the informations gathered from the subtitle list,
                and compare with previously gathered user subtitle(s) list/code.*/
                for (var counterD = 0; counterD < subtitleData.length; counterD++) {

                    //Check if this is the same main language (no point checking anything else if it's not).
                    if (subtitleData[counterD][1] == userMainLanguage) {
                        //Check if the two language (main or with country variant) match (meaning no filters).
                        if (subtitleData[counterD][2] == userLanguage && !subtitleData[counterD][4] && !subtitleData[counterD][5] && userLanguage.indexOf('#') < 0) {
                            //If match, check if it is needed to change the first or add a new subtitle.
                            if (firstPass) {
                                callAPI("linkgrabberv2", "setVariant", parentUUID, subtitleData[counterD][0]);
                                firstPass = false;
                                break;
                            } else {
                                callAPI("linkgrabberv2", "addVariantCopy", parentUUID, parentUUID, linkPackageUUID, subtitleData[counterD][0]);
                                break;
                            }

                            //If it don't match, it might be because there are filters, check without them.
                        } else if (subtitleData[counterD][2] == userLanguage.replace(/#/g, '') && !isAnyVariant && (isSpecial || isAutoGenerated) && (subtitleData[counterD][4] || subtitleData[counterD][5])) {
                            //Check if this is the autogenerated variant.
                            if (subtitleData[counterD][4] && isAutoGenerated) {
                                if (firstPass) {
                                    callAPI("linkgrabberv2", "setVariant", parentUUID, subtitleData[counterD][0]);
                                    firstPass = false;
                                    break;
                                } else {
                                    callAPI("linkgrabberv2", "addVariantCopy", parentUUID, parentUUID, linkPackageUUID, subtitleData[counterD][0]);
                                    break;
                                }
                                //Check if this is a special variant.
                            } else if (subtitleData[counterD][5] && isSpecial) {
                                if (firstPass) {
                                    callAPI("linkgrabberv2", "setVariant", parentUUID, subtitleData[counterD][0]);
                                    firstPass = false;
                                    break;
                                } else {
                                    callAPI("linkgrabberv2", "addVariantCopy", parentUUID, parentUUID, linkPackageUUID, subtitleData[counterD][0]);
                                    break;
                                }
                            }

                            //It might still be any variant user mode, check for matching language.
                        } else if (isAnyVariant && !isAutoGenerated && !isSpecial && !subtitleData[counterD][4] && !subtitleData[counterD][5]) {
                            if (isMainLanguage) {
                                //If it is ""main language"", in any language mode it already match since only equal main language reach here.
                                if (subtitleData[counterD][3]) {
                                    tmpLanguage = -1;
                                    if (firstPass) {
                                        callAPI("linkgrabberv2", "setVariant", parentUUID, subtitleData[counterD][0]);
                                        firstPass = false;
                                        break;
                                    } else {
                                        callAPI("linkgrabberv2", "addVariantCopy", parentUUID, parentUUID, linkPackageUUID, subtitleData[counterD][0]);
                                        break;
                                    }
                                    //If this isn't the main language, this is a variant, it will save its position for latter.
                                } else if (tmpLanguage == -1) {
                                    tmpLanguage = counterD;
                                }

                                //If it get to the end without finding the main language, it will add first found variant if one was found.
                                if (counterD >= subtitleData.length - 1 && tmpLanguage >= 0) {
                                    if (firstPass) {
                                        callAPI("linkgrabberv2", "setVariant", parentUUID, subtitleData[counterD][0]);
                                        firstPass = false;
                                        break;
                                    } else {
                                        callAPI("linkgrabberv2", "addVariantCopy", parentUUID, parentUUID, linkPackageUUID, subtitleData[counterD][0]);
                                        break;
                                    }
                                }

                                //Here it check for 'any except main'
                            } else {
                                if (!subtitleData[counterD][3]) {
                                    if (firstPass) {
                                        callAPI("linkgrabberv2", "setVariant", parentUUID, subtitleData[counterD][0]);
                                        firstPass = false;
                                        break;
                                    } else {
                                        callAPI("linkgrabberv2", "addVariantCopy", parentUUID, parentUUID, linkPackageUUID, subtitleData[counterD][0]);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

            }
            //If no desired subtitles have been found, delete the JDownloader's choosen one if user want to.
            if (counterB >= subLangList.length - 1 && firstPass && deleteSubNotFound) {
                getCrawledLinkByUUID(parentUUID).remove();
            }
        }
    }
}

The code should work properly (I didn't deeply test it) but if you see any problem or issues or encounter a bug, don't hesitate to report it !

Last edited by Demongornot; 23.09.2019 at 02:15. Reason: Fix little mistakes (again) and use the break; rather than counterC = x.length to exit loop and delete crawled link with UUID
Reply With Quote
  #885  
Old 23.09.2019, 16:35
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default Prevent double Downloads

Hello, I asked that in another forum and I was linked here, so I'll ask here.

Is i possible to prevent JD2 to download a link a second time?
At the Moment it is possible while keeping the downloaded files in the download window. That works for a while....

Can that be done in another way?
As I found out, the EventScripter can make files, are something like a maybe ".csv" DB or something else and compare every new link with that pseudo DB?

Bye, Christian
Reply With Quote
  #886  
Old 23.09.2019, 17:15
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Quote:
Originally Posted by Amiganer View Post
Hello, I asked that in another forum and I was linked here, so I'll ask here.

Is i possible to prevent JD2 to download a link a second time?
At the Moment it is possible while keeping the downloaded files in the download window. That works for a while....

Can that be done in another way?
As I found out, the EventScripter can make files, are something like a maybe ".csv" DB or something else and compare every new link with that pseudo DB?

Bye, Christian
I can try and make it for you, I am not familiar with .csv files so I'll simply make a text file with each URL as line, if you insist I can learn to work with csv and make it use them.
But I'll require some informations, what do you want the script do to exactly, warn you, delete the download, disable it and write in its comment it have been already downloaded (recommended), detect them when you add them in downloads or directly from the link grabber and if so make an exception if you try to add the the same file twice in a certain amount of time (recommended), make exception for same links with different names added in the same period of time (like multiples Youtube comments for example who share the same URL) or excluding files from the same URL with different extensions etc...
Reply With Quote
  #887  
Old 23.09.2019, 22:37
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 871
Default

Very good idea, such an option would be very great, indeed!

If I could, if it was allowed, I would give some points, if it would not mind Christian.

It would be good, if that option would do the same like the link grabber window does, if the duplicate links were added to the link grabber window, they are shown in red and can be delted by clicking that item:


And a way to export / transfer the links to the list / csv / txt file from a dlc file would be great.
Reply With Quote
  #888  
Old 24.09.2019, 00:02
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Ok, that mean I'll code it so, it detect duplicates when the files are added in the link grabber, automatically disable them and put in their comment that they are duplicate, leaving the user free to decide whatever or not he should download them or not, and it will only take into account file already in the download list with an option to choose between added and finished download to be added to the already downloaded link list.
Also I think I'll also make so that on first launch, if the option is enabled, and no downloads history have been already recorded, that he add every existing files to the list.
It will work through two scripts, one to add every freshly started downloads or finished downloads (user choice) into the script, and the other to verify added links.

I'll just have to experiment on multiple trigger reading and/or writing on the same file "at the same time" as I don't know how JDownloader 2 handle that.
Might have to create temporary files for each instance of the script and add all the downloads at a certain moment (when downloads are stopped and/or when ETA of all active downloads is big enough) or when JDownloader is closing, for safer writing into the main list though it would mean a third script and you'll need to close JD to update the list, but this is my backup solution.

For the red downloads, I'll have to experiment and search a lot to find how to do that, but I'll try, it will be better than disabling and commenting them.
For the DLC I never tried that and I completely ignore what this is, so I'll do the script without that first, learn what this is and depending of what this is and how it work try to make as you suggest.

Last edited by Demongornot; 24.09.2019 at 00:05.
Reply With Quote
  #889  
Old 24.09.2019, 00:36
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 871
Default

That sounds very great, many thanks!

Quote:
and it will only take into account file already in the download list with an option to choose between added and finished download to be added to the already downloaded link list.
In JD's download list? Or you mean in the list you will build?


Quote:
For the DLC I never tried that and I completely ignore what this is, so I'll do the script without that first, learn what this is and depending of what this is and how it work try to make as you suggest.
So one first could JD let load the container, the DLC file respectively the links of it. And once all of these links are added to the link grabber window they automatically could be added to the anti duplicate list you will make to avoid duplicate downloads. So an export from DLC to the anto duplicate list would not be necessary.
Reply With Quote
  #890  
Old 24.09.2019, 01:45
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Quote:
Originally Posted by Fetter Biff View Post
That sounds very great, many thanks!
Your welcome, though I'll do it tomorrow, bed time now.

Quote:
Originally Posted by Fetter Biff View Post
In JD's download list? Or you mean in the list you will build?
Not sure yet, it will depend on how JD handle multiple script instance on the same file, it could be both (read only for the file and the JD DL list) so no downloads links are skipped from those already in the file list and those recently added.


Quote:
Originally Posted by Fetter Biff View Post
So one first could JD let load the container, the DLC file respectively the links of it. And once all of these links are added to the link grabber window they automatically could be added to the anti duplicate list you will make to avoid duplicate downloads. So an export from DLC to the anto duplicate list would not be necessary.
I'll try to look into it tomorrow.

About the links in the grabber in red, I haven't found a way to do iot, it don't appear in link properties and I haven't found any API method for that, so it might not be possible...Or at least I don't know how.

@mgpai Any idea if this is possible of how we can set a link inside the link grabber as an already existing download even if there isn't a matching file/url in the download list ?
Reply With Quote
  #891  
Old 24.09.2019, 10:49
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default

Quote:
Originally Posted by Demongornot View Post
I can try and make it for you, I am not familiar with .csv files so I'll simply make a text file with each URL as line, if you insist I can learn to work with csv and make it use them.
But I'll require some informations, what do you want the script do to exactly, warn you, delete the download, disable it and write in its comment it have been already downloaded (recommended), detect them when you add them in downloads or directly from the link grabber and if so make an exception if you try to add the the same file twice in a certain amount of time (recommended), make exception for same links with different names added in the same period of time (like multiples Youtube comments for example who share the same URL) or excluding files from the same URL with different extensions etc...
Hello. CSV (= Comma Separated Data) is not necessary, what the Script does, is what I want.
What I need: If the link is exactly as one, that were downloaded before, don't download it again. So delete it from the download list.

The best would be as it happend if the downloads remain in the Download-Screen. If the links comes in with the grabber and it is in the list, pop up the window: "delete allready downloaded files from list". If that is possible.

So: Only add a second possibility to skip already downloaded links.

If that is possible, would be great.

From the other articles that goes the way, it is working right now accept it is compared against his own list, that would be great, if possible...

Thanks....

Bye Christian

Last edited by Amiganer; 24.09.2019 at 11:14.
Reply With Quote
  #892  
Old 24.09.2019, 12:25
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

@Demongornot: you can mark scripts to allow execution concurrently or only sequentially.
currently it's not possible to color highlight via scripting
I would recommend to have one *history* file per hoster where you can read and append new entries. one file per hoster to reduce overall memory requirements. for example after download append the url to file and before download/after adding, check against that file content. another script to compress that history file on startup (remove duplicates, maybe sort....). I would not use CSV as it just creates unneeded overhead. Maybe just add a dummy comment text that can be used for search AND maybe another script to mass remove the duplicates.
You can also read the file on first use and then hold the map in memory for faster processing. maybe don't hold the URLs in memory but only sort of meta information/hash and only check against file if there is a hit. memory consumption is most important here.

Please feel free to contact me via support@jdownloader.org or chat if you've got questions or need help or maybe a new api method

@Fetter_Biff: DLC is not meant for this. It doesn't support all hoster nor does export all meta information. Doesn't make any sense at all to make use of DLC for this.
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 24.09.2019 at 12:27.
Reply With Quote
  #893  
Old 24.09.2019, 12:37
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 871
Default

Quote:
@Fetter_Biff: DLC is not meant for this. It doesn't support all hoster nor does export all meta information. Doesn't make any sense at all to make use of DLC for this.
Yes, but I somehow have to get the links indicated as already downloaded.
Reply With Quote
  #894  
Old 24.09.2019, 12:46
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

I'm sorry but I don't understand what you need DLC for? in case you mean to *fill the history* then this must be done differently because the history should differ between added/loaded state
__________________
JD-Dev & Server-Admin
Reply With Quote
  #895  
Old 24.09.2019, 13:05
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 871
Default

Quote:
I'm sorry but I don't understand what you need DLC for?
To indicate these links as already being downloaded for Demongornot's script.
Reply With Quote
  #896  
Old 24.09.2019, 13:15
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Thanks for the feedback. In that case @Demongornot should add another script to auto learn from current list
__________________
JD-Dev & Server-Admin
Reply With Quote
  #897  
Old 24.09.2019, 13:35
Fetter Biff Fetter Biff is offline
JD Legend
 
Join Date: Oct 2014
Posts: 871
Default

The current list?

Alright, I do not have any idea of anything.
Reply With Quote
  #898  
Old 24.09.2019, 13:38
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Quote:
Originally Posted by Amiganer View Post
From the other articles that goes the way, it is working right now accept it is compared against his own list, that would be great, if possible...
Sorry but I did not understand this sentence, could you please reformulate differently ?

Quote:
Originally Posted by Jiaz View Post
...
Thanks for those advices !
I'll make one file per host as it sound better, I might actually try and use a URL limit per file so it create subversions, the more chances of hit per more sub files, the less memory it will take, I'll just need to check if the file "hostname + incremental number" using "readFile" and "try".
So far I've already made a script that can create an history file if none exist or if it is empty.
I'll use API trigger to make both check new downloads in the Link Grabber windows and put finished ones in the list.
I am currently looking at what API calls id and data are to select the right one.
When adding a new download to the list, it already check if it is already or not in the list using the "indexOf" function and only add it if it doesn't exist, I prefer that over another file who fix things, also this is the same function already used for checking of a new download in the LinkGrabber is in the history or not, so it avoid coding two codes for basically the same thing.
Also a "var myBoolean = fileExist(/*file path*/);" function would be really handy here !


I'll see what I can do with the DLC files after making at least a main script without it.
Reply With Quote
  #899  
Old 24.09.2019, 13:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 642
Default

Quote:
Originally Posted by Demongornot View Post
... a "var myBoolean = fileExist(/*file path*/);" function would be really handy ...
Code:
var myFilePath = getPath(myString/*Path to a file or folder*/);/*Get a FilePath Object*/
var myBoolean = myFilePath.exists();
Reply With Quote
  #900  
Old 24.09.2019, 15:13
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default Prevent double Downloads

Quote:
Originally Posted by Fetter Biff View Post
Yes, but I somehow have to get the links indicated as already downloaded.
I'm not 100% sure, what DLC exact is, I have not used it. If I'm correct it is a short form to provide Links for Download, maybe that links should be in that Database as that links were for download (and so should be checked).
Were can I get Information to DLC?

Bye, Christian
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 15:32.
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 - 2019, Jelsoft Enterprises Ltd.